google-deepmind / google-deepmind/mujoco

meshdir does not work for flexcomp while including

Open
#1,834 2 comments 0 reactions 1 assignee Assigned to @quagla View on GitHub
bug
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

Hi,

I was trying to include an object into a scene, and I found the compiler cannot find the mesh correctly when I was trying to load the scene that includes the object with its absolute path, however, when I tried to load the scene with its relative path or load the object file which include the scene, it worked pretty fine. I have also tried use the absolute meshdir path it still does not work.

**Here is the test directory structure I have**
```XML
.
├── meshes
│ └── insole.msh
├── model_include_scene.xml
├── model.xml
├── scene_include_model.xml
├── scene.xml
└── test.py

```

**Here are the xml files I used for test**

model.xml

```XML
















```

scene.xml

```XML
















```

model_include_scene.xml

```XML

















```

scene_include_model.xml

```XML

















```

**Here is the test code**

```python
from os import path
import mujoco

dir_absolute = path.dirname(__file__)
relative_scene_include_model = "scene_include_model.xml"
relative_model_include_scene = "model_include_scene.xml"
absolute_scene_include_model = path.join(dir_absolute, relative_scene_include_model)
absolute_model_include_scene = path.join(dir_absolute, relative_model_include_scene)

if __name__ == "__main__":
try:
model = mujoco.MjModel.from_xml_path(absolute_scene_include_model)
except Exception as e:
print("*" * 50)
print("scene include model absolute failed")
print("*" * 50)
print(e)

try:
model = mujoco.MjModel.from_xml_path(relative_scene_include_model)
except Exception as e:
print("*" * 50)
print("scene include model relative failed")
print("*" * 50)
print(e)

try:
model = mujoco.MjModel.from_xml_path(absolute_model_include_scene)
except Exception as e:
print("*" * 50)
print("model include scene absolute failed")
print("*" * 50)
print(e)

try:
model = mujoco.MjModel.from_xml_path(relative_model_include_scene)
except Exception as e:
print("*" * 50)
print("model include scene relative failed")
print("*" * 50)
print(e)

```

**Issues Encountered:**
```
**************************************************
scene include model absolute failed
**************************************************
XML Error: Error: resource not found via provider or OS filesystem: '/home/kaixing/assets/insole.msh'
Element 'flexcomp', line 0
```

**MuJoCo Version: 3.1.6
OS: Ubuntu 22.04.4 x86_64
Using mujoco python binding**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.