This change also requires user scripts to explicitly synchronize changes to physics state to the viewer. The Simulate class was reconfigured so that certain UI events are handled during this sync operation, outside of the render loop on the main thread. These correspond to operations that require access to the full mjModel/mjData.
To support other, more interactive operations (e.g. camera movements), a new mjvSceneState struct is introduced which captures only the portion of the physics state required for scene re-rendering. The mjvSceneState is updated from mjModel/mjData during the viewer sync operation, and is significantly cheaper than a full mj_copyModel and mj_copyData.
Fixes https://github.com/deepmind/mujoco/issues/796
PiperOrigin-RevId: 525723636
Change-Id: Id08d0210a2c067d5afe85e2bf104f276aeddd75e
Also missing struct fields to the Python bindings that were discovered as a result of the new `introspect` metadata.
PiperOrigin-RevId: 523947396
Change-Id: I367fd2dc8d5fd7e5712a45b70a5c50da51d152e4
It is quite possible that there are a few other fields still missing since we currently do not yet have automated testing of struct field existence.
Fixes#747.
PiperOrigin-RevId: 517189048
Change-Id: I7c1d95e700eaea05aaa3cde1fd05e1a259553117
- Add private function `mj_arenaAlloc`. This is used internally to allocate memory from the arena.
- Add private function `mj_nefc` to count constraints. This function returns a tight upper bound on `d->nefc`. The number of counted constraints can be slightly bigger than exact `d->nefc` in the case of constraints with empty Jacobian, as when placing a frictional tendon between two world sites.
- Add new `memory` attribute to the `size` XML element for specification of arena memory size. This attribute is mutually exclusive with `nstack` and `njmax` specifications, which are now deprecated (but left around for the time being for legacy compatibility).
- Move `d->stack` to the end of the new arena space. The stack now grows in reverse from the end.
PiperOrigin-RevId: 479341539
Change-Id: Ie019c202e0908577ffc6f833a37920858116f667
List all valid names in the error message.
Fix an off-by-one error when accessing elements by numeric index (rather than name).
PiperOrigin-RevId: 457702283
Change-Id: I6e4f1518b4ecd9ca91ac9b0bf6b0963fc0a9bd18
Indiscriminate memset into d->buffer and m->buffer previously caused msan to not detect uninitialized reads.
Also fix tests with uninitialized read bugs that are detected by msan after this change.
PiperOrigin-RevId: 451508224
Change-Id: I1f4b080a8ef765c34ba7a0adc2c686419f6e5516