Hi Vanessa,
All Chrono demos, as they are distributed, assume a certain location of the data/ directory, relative to where the demo is located and run from. Running the demo through the Python script does not respect this anymore and as such, the underlying (unmodified) Chrono demo cannot find files in the data/ directory. Whatever demos you say you were able to run from your Python script do not attempt to use any files from the Chrono data/ directory (as is the case with demo_IRR_raycast_test).
The solution is to modify the C++ code to make an explicit call to chrono::SetChronoDataPath() and provide the location of the data/ directory you wish to use.
In general, I strongly suggest not to modify demos inside the Chrono distribution. Those are set up the way they are so that they can run from the location where they are built (and only from there), regardless of the particular user setup.
What you should do is copy the Chrono demo you are interested in somewhere else and then set it up as an external project. Look at the sample we provide in template_project and the additional instructions at https://api.projectchrono.org/tutorial_install_project.html.
When you do this, make sure to modify the copied demo so that it makes a call to SetChronoDataPath() before any other calls to Chrono library functions, just as is done in my_example.cpp at line 30 and point it to, say, the data/ directory in the Chjrono source tree. If you set that to an absolute path, you should then be able to invoke the resulting executable from your Python script, regardless of the relative locations of the Chrono executable and the Python script.
--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/ebe1d031-e02a-4474-bac0-16bdd8558f0bn%40googlegroups.com.