google-deepmind / google-deepmind/mujoco
Move mjcb_.* callbacks into mjModel
Open
enhancement
- Dominant language
- C++
- Stars
- 15.2k
- Forks
- 1.8k
- Avg merge
- 10d 16h
- Merged PRs (30d)
- 25
Description
### The feature, motivation and pitch
Multiple different MuJoCo simulation models in one process are not cleanly separated
because the installed `mjcb_.*` callbacks from `mujoco.h` are global.
Please move these function pointers into the `mjModel` struct to provide separation
between different simulation contexts. All callbacks except `mjcb_time` already require a pointer to a `mjModel` struct so this change should not be too invasive.
### Alternatives
It is possible to swap the pointers before each call to `mj_step`.
However, this results in some kind of "Big Simulator Lock".
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.