Issues With Importing JSON for RigidTerrain (PyChrono)

45 views
Skip to first unread message

Jack Wagner

unread,
Aug 4, 2024, 2:53:11 PM8/4/24
to ProjectChrono
I have been trying to import the example RigidTerrain JSON with the example Wavefront OBJ to examine vehicle behavior on variable landforms and learn more about the wavefront terrain structure, however just trying to implement it into the simulation is causing me issues. I have the following code block to signify the directory for the JSON file:

chrono.SetChronoDataPath('Users/wagne/anaconda3/envs/pychrono/Library/data/vehicle/terrain/')
veh.SetDataPath(chrono.GetChronoDataPath() + 'WaveFrontTest.json')
terrain_file = veh.GetDataPath()

Then simply implement and initialize the terrain with the terrain file:

    terrain = veh.RigidTerrain(hmmwv.GetSystem(), terrain_file)
    terrain.Initialize()

However, every time I try to run this, I receive a fatal access violation and am unsure of what i am doing wrong. I keep thinking it's a simple syntax issue, however everything I try moving around (making terrain_file equal to the exact data path, switching around using Set/GetDataPath, etc.) has been ineffective. 

Assistance would be very helpful. Below is a copy of my terminal's output and the JSON file I am using for reference, although the JSON is nearly identical to the example specified in the PyChrono documentation.

Screenshot 2024-08-04 145215.png
WaveFrontTest.json

Jack Wagner

unread,
Aug 4, 2024, 4:35:16 PM8/4/24
to ProjectChrono
Additionally, I am using the win-64_pychrono-9.0.0-py39_4852 package downloaded through Anaconda.

Jack Wagner

unread,
Aug 4, 2024, 4:36:44 PM8/4/24
to ProjectChrono
Sorry for spam of replies, but I forgot to include one of the screenshots of my console output, here it the console output in its entirety.Screenshot 2024-08-04 145114.png
Screenshot 2024-08-04 145215.png

Radu Serban

unread,
Aug 5, 2024, 7:51:35 AM8/5/24
to ProjectChrono

Jack,

 

You misunderstand the meaning of the Chrono and Chrono::Vehicle data paths.  What you are supposed to provide through the functions chrono.SetChronoDataPath and veh.SetDataPath are the locations of *directories* containing data file.  With what you have, the terrain file is probably found fine, but the incorrect setting for the vehicle data path may mess up something else (difficult to tell without seeing your code, but one possibility is if you are using some visualization mesh for the HMMWV vehicle).

 

Try something like this:

chrono.SetChronoDataPath('Users/wagne/anaconda3/envs/pychrono/Library/data/)

veh. SetDataPath(chrono.GetChronoDataPath() + ‘vehicle/')

terrain = veh.RigidTerrain(hmmwv.GetSystem(), veh.GetDataFile(‘terrain/WaveFrontTest.json’)

 

(Of course, this also assumes that your JSON terrain specification file is correct)

 

--Radu

--
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 projectchron...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/projectchrono/9f78401a-09bf-4608-af53-0a7428159dcen%40googlegroups.com.

Message has been deleted

Jack Wagner

unread,
Aug 6, 2024, 10:29:24 AM8/6/24
to ProjectChrono
Radu,

Thank you for the response!

After making these changes, I realized that the issue relied with chrono.SetDataPath, as commenting this out immediately removed the access violations albeit without generating any of the mesh terrain. I think the script had a data path already set, however using that method caused some sort of access violation which generated issues in trying to access vehicle information earlier on in the initialization process. 

I think the issue is in my JSON, then? When I loaded the sample RigidHeighMap JSON instead, it was able to run the simulation at ease and with everything loaded correctly, however I think this issue is seperate from what I've been encountering with actually getting the simulation to work.

Thanks again!
-Jack 

Reply all
Reply to author
Forward
0 new messages