Error loading OBJ file

52 views
Skip to first unread message

yaoyiyao

unread,
Nov 24, 2022, 9:22:22 PM11/24/22
to ProjectChrono
Hi,I  run template_project successfully.Then I copy demo_VEH_RigidTerrain's code in  template_project and  modify cmakelist file ,but run failed.

$V~9~(_WW$@%CX28[B2JD52.png
what's wrong with it?
Many thanks in advance.

Radu Serban

unread,
Nov 25, 2022, 2:10:38 AM11/25/22
to ProjectChrono

As the message indicates, files in the Chrono data/ directory cannot be found (you can verify that there is no directory data/ at that location relative to where your executable is).

This is because you moved the demo away from its place in the Chrono file hierarchy.

 

To address this issue, you must specify a new location of where the code should be looking for data files.  If you look at the source of my_example.cpp in the template_project, you will see that this is done on the very first line in the main() function:

    // Set path to Chrono data directory

    SetChronoDataPath(CHRONO_DATA_DIR);

Simply add this to your relocated demo_VEH_RigidTerrain code.

 

The manner in which the problem of locating Chrono data files is addressed in the sample template_project is one possibility (study carefully how the CMakeLists file is set up there to understand what is being done).  There are other ways in which you could address the problem, but at the end of the day, you must make a call to SetChronoDataPath() to properly locate any Chrono data files your program uses.

 

--Radu

 

From: projec...@googlegroups.com <projec...@googlegroups.com> On Behalf Of yaoyiyao
Sent: Friday, 25 November 2022 03:22
To: ProjectChrono <projec...@googlegroups.com>
Subject: [chrono] Error loading OBJ file

 

Hi,I  run template_project successfully.Then I copy demo_VEH_RigidTerrain's code in  template_project and  modify cmakelist file ,but run failed.


what's wrong with it?

Many thanks in advance.

--
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/91958766-b73d-4974-83bf-7e2e906c50b2n%40googlegroups.com.

yaoyiyao

unread,
Nov 26, 2022, 2:48:04 AM11/26/22
to ProjectChrono
Hi,I  add  SetChronoDataPath(CHRONO_DATA_DIR);   to my  relocated demo_VEH_RigidTerrain code,I think my data files location is  right.
I debug my codes,I  found  it read jpg file  normally,but it read obj file abnormally.
U6}LUS[I7[5D$@3UBEJ6$AR.png
Many thanks in anvance.

Radu Serban

unread,
Nov 26, 2022, 4:41:32 AM11/26/22
to ProjectChrono

In fact, I don’t think it finds the texture concrete.jpg on line 91. It just doesn’t crash because of it.

 

To access vehicle data as it’s done in this demo, you should also make a call like:

vehicle::SetDataPath(CHRONO_DATA_PATH + “/vehicle”);

 

Alternatively, you can access vehicle-related files like this:

patch2->SetTexture(GetChronoDataFile("vehicle/terrain/textures/concrete.png"), 20, 20);

auto patch3 = terrain.AddPatch(patch3_mat, ChCoordsys<>(0, -42, 0), QUNIT),GetChronoDataFile("vehicle/terrain/meshes/bump.obj"));

and so on.

 

--Radu

 

From: projec...@googlegroups.com <projec...@googlegroups.com> On Behalf Of yaoyiyao
Sent: Saturday, 26 November 2022 08:48
To: ProjectChrono <projec...@googlegroups.com>
Subject: Re: [chrono] Error loading OBJ file

 

Hi,I  add  SetChronoDataPath(CHRONO_DATA_DIR);   to my  relocated demo_VEH_RigidTerrain code,I think my data files location is  right.

I debug my codes,I  found  it read jpg file  normally,but it read obj file abnormally.

Many thanks in anvance.

On Friday, November 25, 2022 at 3:10:38 PM UTC+8 Radu Serban wrote:

As the message indicates, files in the Chrono data/ directory cannot be found (you can verify that there is no directory data/ at that location relative to where your executable is).

This is because you moved the demo away from its place in the Chrono file hierarchy.

 

To address this issue, you must specify a new location of where the code should be looking for data files.  If you look at the source of my_example.cpp in the template_project, you will see that this is done on the very first line in the main() function:

    // Set path to Chrono data directory

    SetChronoDataPath(CHRONO_DATA_DIR);

Simply add this to your relocated demo_VEH_RigidTerrain code.

 

The manner in which the problem of locating Chrono data files is addressed in the sample template_project is one possibility (study carefully how the CMakeLists file is set up there to understand what is being done).  There are other ways in which you could address the problem, but at the end of the day, you must make a call to SetChronoDataPath() to properly locate any Chrono data files your program uses.

 

--Radu

 

From: projec...@googlegroups.com <projec...@googlegroups.com> On Behalf Of yaoyiyao
Sent: Friday, 25 November 2022 03:22
To: ProjectChrono <projec...@googlegroups.com>
Subject: [chrono] Error loading OBJ file

 

Hi,I  run template_project successfully.Then I copy demo_VEH_RigidTerrain's code in  template_project and  modify cmakelist file ,but run failed.


Image removed by sender.

what's wrong with it?

Many thanks in advance.

--
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/91958766-b73d-4974-83bf-7e2e906c50b2n%40googlegroups.com.

--
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.

yaoyiyao

unread,
Nov 26, 2022, 8:23:52 AM11/26/22
to ProjectChrono
Thank you for your help, I think I should improve my programming ability first.
Reply all
Reply to author
Forward
0 new messages