Add mj_copyState

PiperOrigin-RevId: 836588419
Change-Id: I7609e121dc0ac697d4d015d4244bdd5962650def
This commit is contained in:
Yuval Tassa
2025-11-25 03:08:01 -08:00
committed by Copybara-Service
parent eac8e60037
commit 888d3a7b07
12 changed files with 139 additions and 0 deletions
+9
View File
@@ -291,6 +291,15 @@ is not a subset of the bits set in ``srcsig``.
Copy concatenated state components specified by ``sig`` from ``state`` into ``d``. The bits of the integer
``sig`` correspond to element fields of :ref:`mjtState`. Fails with :ref:`mju_error` if ``sig`` is invalid.
.. _mj_copyState:
`mj_copyState <#mj_copyState>`__
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. mujoco-include:: mj_copyState
Copy state from src to dst.
.. _mj_setKeyframe:
`mj_setKeyframe <#mj_setKeyframe>`__
+1
View File
@@ -20,6 +20,7 @@ General
- Increase Windows stack size to 16MB to enable models with deep nested body hierarchies.
- Added a new :ref:`mj_extractState` function that allows a subset of a state that was previously returned by
:ref:`mj_getState` to be extracted without having to be written back into ``mjData`` first.
- Added a new :ref:`mj_copyState` function that copies state components from one ``mjData`` to another.
- Tendon paths can now be queried from Python via ``MjsTendon.path``, the returned object
is iterable and indexing it will give the ``MjsWrap`` at the given index in the path.
- ``MjsWrap`` now exposes:
+1
View File
@@ -3181,6 +3181,7 @@ void mj_getState(const mjModel* m, const mjData* d, mjtNum* state, unsigned int
void mj_extractState(const mjModel* m, const mjtNum* src, unsigned int srcsig,
mjtNum* dst, unsigned int dstsig);
void mj_setState(const mjModel* m, mjData* d, const mjtNum* state, unsigned int sig);
void mj_copyState(const mjModel* m, const mjData* src, mjData* dst, unsigned int sig);
void mj_setKeyframe(mjModel* m, const mjData* d, int k);
int mj_addContact(const mjModel* m, mjData* d, const mjContact* con);
int mj_isPyramidal(const mjModel* m);