google-deepmind / google-deepmind/mujoco
Attach of FlexComp gives repeated name error and doesn't generate Flex Equality
- Dominant language
- C++
- Stars
- 15.2k
- Forks
- 1.8k
- Avg merge
- 10d 16h
- Merged PRs (30d)
- 25
Description
### Intro
Hi!
I am an automotive engineer and technical artist experimenting with Mujoco as the physics engine for real-time visualisation. Previously I have been using Bullet for this, but looking for better support of soft bodies in Mujoco.
You can see the state of my Bullet-based demo here: https://www.linkedin.com/posts/alan-ramsay-a50a8a5_autodesk-vred-bulletphysics-activity-7396634112872116224-JgRF?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAEMmVwBk8WU7q3HVFdlZ90RkRU-gm0rSSU
### My setup
Mujoco version 3.3.7
Using simulation.exe to test model development
Ryzen 9 9950X, Windows 11 Pro 25H2
### What's happening? What did you expect?
Issue Observed:
- Using attach to add a flexcomp to my model gives a 'repeated name' error if another element with the same name has already been attached or included
- If there is no previous name to clash and prevent attachment, the attach does not generate the specified flex equality constraint for the bodies.
- I expect the prefix element of the attach to prevent name clashes, and for the flex equality constraint to be generated.
Possible Solution:
- Adding call mjCBase::NameSpace(m); in mjCFlex::Namespace on line 4033 of user_mesh.cc appears to solve this, let me know if I should submit a PR for that.
[issue_flex_attach.zip](https://github.com/user-attachments/files/24082157/issue_flex_attach.zip)
### Steps for reproduction
1. Load _my_model.xml_ from the .zip using _simulate.exe_
2. Comment out selected includes or attaches to see the interaction between them
5. See summary in _README.txt_
3. _generated_softbody_include.xml_ shows successful parsing and generation of flexcomp by include
4. _generated_softbox_attach.xml_ shows the absence of prefixing and flex equality generated by attach
### Minimal model for reproduction
Since this is specifically a multi-file issue, I've included xml files for reproduction in the attached .zip, please advise if there is a better way to provide this.
### Code required for reproduction
N/A - using simulate.exe
### 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
Assessment
This issue has not been assessed yet.