google-deepmind / google-deepmind/mujoco

Move mjcb_.* callbacks into mjModel

Open
#2,724 2 comments 1 reaction 0 assignees View on GitHub
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

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.