Error loading obj file

102 views
Skip to first unread message

Davide

unread,
Jan 10, 2024, 10:19:32 AM1/10/24
to ProjectChrono
Hi all,
when I try to build demos involving the HMMWV vehicle or parts of it such as "demo_VEH_HMMWV" or "demo_VEH_Multicore_TireTestRig", the following error message is shown:

"tiny_obj error message: Cannot open file [../data/vehicle/hmmwv/hmmwv_tire_left.obj]"

Given that all the demos work fine when I installed Chrono, I'm not understanding what could be the problem. Might someone give me a help?
Thank you in advance!
Davide

Radu Serban

unread,
Jan 10, 2024, 11:53:44 AM1/10/24
to ProjectChrono

Davide,

 

I take it that you are working now *outside* the Chrono source and build trees.  And yet, you still want to use data files from the Chrono data/ directory.  The error message from tiny_obj is pretty clear: it cannot find the specified OBJ file at the given path *relative* to where your executable is. 

 

The default path for the Chrono data/ directory is set up so that it works fine for the demos executable as they are created in the Chrono build tree. 

If you work now in some other location, you must tell Chrono where to find those files. You have 2 options:

  • You can provide the full path to the data files (e.g. to the location of that file in the data/ directory in the Chrono source tree).
  • If you want to use things such as
         chrono::vehicle::
    vehicle::GetDataFile(“hmmwv/hmmwv_tire_left.obj”);
    then you must first call chrono::vehicle::SetDataPath(), typically right at the top of your main function, to specify the root path for your vehicle data directory.
  • Similarly, if you want to access data files using something like
         chrono::
    GetChronoDataFile(“textures/pink.png”)
    then you must first call chrono::
    SetChronoDataPath() to specify the root path for your data directory.

 

See for example how that is done in the template_project distributed with Chrono.

 

--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/ebc711cf-151f-4ebc-8c64-01d82e6b1b0bn%40googlegroups.com.

sarina shahhosseini

unread,
Jan 10, 2024, 2:55:41 PM1/10/24
to ProjectChrono
Hi all,

I've been following this discussion, as I've recently run into the same issue myself. As Radu mentioned, I've double-checked that the directory and full path are correctly set. Chrono seems to locate other .obj files in the same folder without any trouble. Typically, if there's a file missing, I encounter an error message along the lines of "no such file or directory".

However, since this particular error mentions "tiny_obj", I'm wondering if the problem might lie with the .obj file itself. Any insight into this aspect of the issue?

Thanks a lot for any help or suggestions!

Sarina,

Davide

unread,
Jan 11, 2024, 4:10:16 AM1/11/24
to Radu Serban, ProjectChrono
Hi Radu,
now it works, I was giving the wrong path as you mentioned. 
Thank you very much for the help!
Davide

Prabasgarage

unread,
Feb 27, 2024, 6:26:10 AM2/27/24
to ProjectChrono
Hi David,

I am facing a similar issue. Can you let me know how exactly did you specify the full path or resolve the issue?

Thanks,
Prabanjan

Reply all
Reply to author
Forward
0 new messages