google-deepmind / google-deepmind/mujoco
Utilities for dealing with non-convex meshes
- Dominant language
- C++
- Stars
- 15.2k
- Forks
- 1.8k
- Avg merge
- 10d 16h
- Merged PRs (30d)
- 25
Description
### The feature, motivation and pitch
It'd be great if Mujoco bundled some helper functions for dealing with non-convex meshes. Right now this is clunky. The approach I originally took in my Python project involved a Bash script to call coacd with certain parameters, a Python script to split the coacd's output .stl into loose parts, `git commit`ing those .stl files, and constructing the Mujoco model XML using string templating (this last part could have been done with the `MjSpec` API).
I since re-wrote that code to use a helper function `def split_nonconvex_meshes(xml: str, mesh_names: list[str] | str, coacd_kwargs: dict = frozendict()) -> str`. This function removes the given mesh(es) from the XML file, calls `coacd.run_coacd` on the `.stl` files with the given arguments, caches the results on disk, re-adds the split meshes, and updates all `geoms` to reference the new split meshes. This helper has made my code a lot cleaner: I was able to delete the helper scripts and the checked-in .stl files and string munging.
[There's an implementation of this function here.](https://gist.github.com/kerrickstaley/9e63c4f03166e9e85451e1b9a3d555b0). Is this helper something that y'all would be interested in shipping with Mujoco? Is there another design for this that might work better? (The implementation is AI-written and I would clean it up before opening a PR).
Thanks for building Mujoco!
### Alternatives
_No response_
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.