google-deepmind / google-deepmind/mujoco

Inconsistent behavior with VFS and mjSpec

Open
#2,484 8 comments 0 reactions 2 assignees Claimed by @havess View on GitHub
bug
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### Intro

Hi!

One of the early MuJoCo developer

### My setup

Mac, python, mujoco==3.2.4

### What's happening? What did you expect?

When using a virtual file system with mjSpec, there are inconsistencies in the behavior (especially when names with Caps are involved)

**Case**: when the asset/mesh/file is only the filename
| name on disc | name in XML | loads w/ mjSpec? | loads natively? |
|--------|--------|--------|--------|
| cube.stl | Cube.stl | True |True |
| cube.stl | cube.stl | True | True |
| Cube.stl | Cube.stl | True | True |
| Cube.stl | cube.stl | False | True |

**Case**: when the asset/mesh/file is more complex
| name on disc | name in XML | loads w/ mjSpec? | loads natively? |
|--------|--------|--------|--------|
| cube.stl | path/Cube.stl | True | True |
| cube.stl | path/cube.stl | True | True |
| Cube.stl | path/Cube.stl | False | True |
| Cube.stl | path/cube.stl | False | True |

In summary,
1. capitalization is not respected natively. Everything works
2. capitalization is partially respected in mjSpec
3. capitalization behavior depends on how the name is specified

### Steps for reproduction

1. Unzip the folder
2. Run `python test.py `
3. Change filenames on disc and on XML as specified above.

NOTE:
1. When trying out cases with VFS, ensure that the fallback of loading assets from the disc doesn't work otherwise the bug won't highlight.
2. This is extremely important as this bug is about discrepancies between VFS and load from the disc.

Recommendation:
The docs around how caps, relative paths, partial paths, etc are handled in VFS are non-existent. Consider updating the docs.

### Minimal model for reproduction

See attached

[vfs_caps_bug.zip](https://github.com/user-attachments/files/19141359/vfs_caps_bug.zip)

### Code required for reproduction

python test.py

### Confirmations

- [x] I searched the [latest documentation](https://mujoco.readthedocs.io/en/latest/overview.html) thoroughly before posting.
- [x] I searched previous [Issues](https://github.com/google-deepmind/mujoco/issues) and [Discussions](https://github.com/google-deepmind/mujoco/discussions), I am certain this has not been raised before.

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.