Add mj_extractState as a public API function.
This function allows the caller to extract a subset of components of a state previously obtained via `mj_getState` without having to first write it back into `mjData`. PiperOrigin-RevId: 822165077 Change-Id: I6433261f4f5ec2e8d024bb7dee8f7dbf1e62666c
This commit is contained in:
committed by
Copybara-Service
parent
25f5be82ff
commit
2f65e23779
@@ -259,6 +259,17 @@ correspond to element fields of :ref:`mjtState`.
|
||||
Copy concatenated state components specified by ``sig`` from ``d`` into ``state``. The bits of the integer
|
||||
``sig`` correspond to element fields of :ref:`mjtState`. Fails with :ref:`mju_error` if ``sig`` is invalid.
|
||||
|
||||
.. _mj_extractState:
|
||||
|
||||
`mj_extractState <#mj_extractState>`__
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mj_extractState
|
||||
|
||||
Extract into ``dst`` the subset of components specified by ``dstsig`` from a state ``src`` previously obtained via
|
||||
:ref:`mj_getState` with components specified by ``srcsig``. Fails with :ref:`mju_error` if the bits set in ``dstsig``
|
||||
is not a subset of the bits set in ``srcsig``.
|
||||
|
||||
.. _mj_setState:
|
||||
|
||||
`mj_setState <#mj_setState>`__
|
||||
|
||||
@@ -195,6 +195,12 @@ correspond to element fields of :ref:`mjtState`.
|
||||
Copy concatenated state components specified by ``sig`` from ``d`` into ``state``. The bits of the integer
|
||||
``sig`` correspond to element fields of :ref:`mjtState`. Fails with :ref:`mju_error` if ``sig`` is invalid.
|
||||
|
||||
.. _mj_extractState:
|
||||
|
||||
Extract into ``dst`` the subset of components specified by ``dstsig`` from a state ``src`` previously obtained via
|
||||
:ref:`mj_getState` with components specified by ``srcsig``. Fails with :ref:`mju_error` if the bits set in ``dstsig``
|
||||
is not a subset of the bits set in ``srcsig``.
|
||||
|
||||
.. _mj_setState:
|
||||
|
||||
Copy concatenated state components specified by ``sig`` from ``state`` into ``d``. The bits of the integer
|
||||
|
||||
@@ -10,6 +10,8 @@ General
|
||||
|
||||
- Raise an error if there are name collisions also during parsing.
|
||||
- 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.
|
||||
|
||||
Version 3.3.7 (October 13, 2025)
|
||||
-----------------------------------
|
||||
|
||||
@@ -3118,6 +3118,8 @@ void mj_constraintUpdate(const mjModel* m, mjData* d, const mjtNum* jar,
|
||||
mjtNum cost[1], int flg_coneHessian);
|
||||
int mj_stateSize(const mjModel* m, unsigned int sig);
|
||||
void mj_getState(const mjModel* m, const mjData* d, mjtNum* state, unsigned int sig);
|
||||
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_setKeyframe(mjModel* m, const mjData* d, int k);
|
||||
int mj_addContact(const mjModel* m, mjData* d, const mjContact* con);
|
||||
|
||||
Reference in New Issue
Block a user