You also need to properly set the data path to Chrono::Vehicle data file.
Look at the https://github.com/projectchrono/chrono-projects repository.  I 
just added an example of building the CityBus demo as an external project in 
https://github.com/projectchrono/chrono-projects/tree/develop/configuration_tests/vehicle.
  This should be exactly what you are trying to do.

--Radu

From: [email protected] <[email protected]> On Behalf 
Of Freya the Goddess
Sent: Saturday, July 2, 2022 10:43 AM
Cc: ProjectChrono <[email protected]>
Subject: Re: [chrono] Re: CityBus Demo : path to CityBus_Vis.obj

I try to move the citybus folder 
(https://github.com/glanzkaiser/glanzshamzs/blob/main/ProjectChrono/example/citybus/)
 to
 /opt/hamzstlib/Physics/chrono2/build/citybus

 the distribution demos are in
 /opt/hamzstlib/Physics/chrono2/build/bin

still the same error

Le sam. 2 juil. 2022 à 14:26, Freya the Goddess 
<[email protected]<mailto:[email protected]>> a écrit :
Thanks Marcel and Radu, I add the line :
SetChronoDataPath(CHRONO_DATA_DIR);
inside the main() of the
demo_VEH_CityBus.cpp<https://github.com/glanzkaiser/glanzshamzs/blob/main/ProjectChrono/example/citybus/demo_VEH_CityBus.cpp>

Then the error changes. segmentation fault.

The build directory of Project Chrono is: /opt/hamzstlib/Physics/chrono2, where 
the data folder is there and the CityBus_Vis.obj is there too. You can see from 
my screenshot along with the newest error to run the executable.

Le jeu. 30 juin 2022 à 15:47, 'Radu Serban' via ProjectChrono 
<[email protected]<mailto:[email protected]>> a écrit 
:
Marcel is correct.  When running a Chrono-based program from a location other 
than where the distribution demos are, you must point to the correct path for 
the various data files.

Assuming you use the CMake Chrono project configuration script to link to the 
Chrono libraries either in a build directory or an install directory, you have 
access to a CMake variable (CHRONO_DATA_DIR) which contains the relevant 
information.   You must ensure this variable can be used from within your C++ 
code and then make a call such as
    SetChronoDataPath(CHRONO_DATA_DIR);
At the top of your main function.

See the example in the 
template_project<https://github.com/projectchrono/chrono/tree/develop/template_project>
 and look at how (1) the CMake variable is used in CMakeLists.txt to define a 
C++ macro and (2) how that is used in the call to SetChronoDataPath in 
my_example.cpp.

--Radu

From: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> On 
Behalf Of Marcel Offermans
Sent: Thursday, June 30, 2022 9:20 AM
To: ProjectChrono 
<[email protected]<mailto:[email protected]>>
Subject: [chrono] Re: CityBus Demo : path to CityBus_Vis.obj

The obvious answer is that it is probably looking in the wrong place. That 
said, working out what the "current directory" is when running an executable 
can be a bit tricky depending on how you run it. So if you've built and 
executable for this demo, go to a command line and:

  1.  Change directory to the folder where the executable lives.
  2.  Make sure that from that folder, if you go one folder up, you see your 
"data" directory (and it actually contains the files you need to run this demo).
  3.  Run the demo. It should now find the files.
Now if you're running inside the IDE (Visual Studio or whatever you are using) 
you can set this current directory to be whatever you want. What I have done to 
make my life a bit easier, is to add a few lines of code to the start of the 
main() of such demos that will print this directory:

// Output the current directory, just to make sure we understand where we're 
running.
#define PATH_MAX 1024
char buff[PATH_MAX];
_getcwd(buff, PATH_MAX);
std::string current_working_dir(buff);
GetLog() << "Working dir = " << current_working_dir << "\n\n";

Another thing that might help you is to explicitly set the data path. This was 
mentioned on the forum before, and you can do it somewhat like this (also do 
this at the start of main()):

// This can be used to point to different data paths (for core and vehicle 
modules):
chrono::SetChronoDataPath("../data/");
vehicle::SetDataPath("../data/vehicle/");

Hope this helps!

Greetings, Marcel

On Thursday, June 30, 2022 at 9:02:14 AM UTC+2 
[email protected]<mailto:[email protected]> wrote:
Dear all,

I am trying to build a single project chrono demo:
https://github.com/projectchrono/chrono/blob/develop/src/demos/vehicle/wheeled_models/demo_VEH_CityBus.cpp

I can create the executable, but when I run it, there is an error:
Error Loading OBJ file ../data/vehicle/citybus/CityBus_Vis.obj

segmentation fault.

If I compile the whole chrono, then of course demo_VEH_CityBus is working. I 
just want to try to compile single demo. Why it can't find the path to the 
CityBus object?

Thank You.

--
С наилучшими пожеланиями, Богиня Фрейя
Atenciosamente, Freya the Goddess
Meilleurs voeux, Freya the Goddess
Liebe Grüße, Freya the Goddess
Best wishes, Freya the Goddess
よろしくお願いします、Freya the Goddess
最好的祝福,Freya the Goddess
Matakwa mema, Freya the Goddess
مع أطيب التمنيات ، فريا الإلهة
--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/679fcb35-b782-4e3b-b787-f81c2b1665b6n%40googlegroups.com<https://groups.google.com/d/msgid/projectchrono/679fcb35-b782-4e3b-b787-f81c2b1665b6n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/PH0PR06MB82372459EFA5EC0F889C540DA7BA9%40PH0PR06MB8237.namprd06.prod.outlook.com<https://groups.google.com/d/msgid/projectchrono/PH0PR06MB82372459EFA5EC0F889C540DA7BA9%40PH0PR06MB8237.namprd06.prod.outlook.com?utm_medium=email&utm_source=footer>.


--
С наилучшими пожеланиями, Богиня Фрейя
Atenciosamente, Freya the Goddess
Meilleurs voeux, Freya the Goddess
Liebe Grüße, Freya the Goddess
Best wishes, Freya the Goddess
よろしくお願いします、Freya the Goddess
最好的祝福,Freya the Goddess
Matakwa mema, Freya the Goddess
مع أطيب التمنيات ، فريا الإلهة


--
С наилучшими пожеланиями, Богиня Фрейя
Atenciosamente, Freya the Goddess
Meilleurs voeux, Freya the Goddess
Liebe Grüße, Freya the Goddess
Best wishes, Freya the Goddess
よろしくお願いします、Freya the Goddess
最好的祝福,Freya the Goddess
Matakwa mema, Freya the Goddess
مع أطيب التمنيات ، فريا الإلهة
--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/projectchrono/CALUh_%2B2A82LHTdj_1dek%3DmktMcrEizMLg9Fp14XZO5kyctbhRw%40mail.gmail.com<https://groups.google.com/d/msgid/projectchrono/CALUh_%2B2A82LHTdj_1dek%3DmktMcrEizMLg9Fp14XZO5kyctbhRw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
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 on the web visit 
https://groups.google.com/d/msgid/projectchrono/PH0PR06MB8237C4FE89CF180A2A1696DFA7BC9%40PH0PR06MB8237.namprd06.prod.outlook.com.

Reply via email to