Hello, I am trying to load a custom vehicle in Project Chrono using JSON 
files, but I am receiving a 0xC0000005: Access violation (*Null Pointer*) 
error that I cannot solve.

The program always crashes when it reaches the vehicle.Initialize(...) 
line. This indicates that the WheeledVehicle constructor failed, and the 
vehicle object is being created as a null pointer (nullptr).

I believe the file references in my JSON files and my main.cpp code are 
correct. My JSON file structure is as follows:  
 C:/Projects/vehicle_project/data/temp/vehicle/vehicle.json

Here is the relevant section of my main.cpp:

#include "chrono_vehicle/ChVehicleModelData.h"
// ... other includes ...

using namespace chrono;
using namespace chrono::vehicle;

int main() {

    // SetDataPath points to the 'data' directory from the file tree above
    const std::string vehicle_data_path = 
"C:/Projects/vehicle_project/data";
    chrono::vehicle::SetDataPath(vehicle_data_path);

    // The vehicle JSON is called relative to the 'data' directory
    const std::string vehfile = "temp/vehicle/Vehicle.json";
    WheeledVehicle vehicle(vehfile, ChContactMethod::SMC, false, false);

    // THE ERROR OCCURS ON THIS EXACT LINE
    vehicle.Initialize(ChCoordsys<>(ChVector3d(0, 0, 0.6), 
QuatFromAngleZ(0)));

    // ... (rest of the code)
}

I would greatly appreciate it if you could tell me what is causing this 
problem and how to solve it. Thank you.  



-- 
You received this message because you are subscribed to the Google Groups 
"ProjectChrono" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/projectchrono/4726cd2f-6b05-4bb9-8f99-66708abb54d5n%40googlegroups.com.

Reply via email to