Remove mjMARKSTACK and mjFREESTACK macros.
PiperOrigin-RevId: 562844184 Change-Id: Id2f57f5d132c47094dad75c6dab7297d7aa73458
This commit is contained in:
committed by
Copybara-Service
parent
329ed193ac
commit
4929077211
@@ -43,39 +43,6 @@ API function can be classified as:
|
||||
Macros
|
||||
^^^^^^
|
||||
|
||||
|
||||
.. _mjMARKSTACK:
|
||||
|
||||
mjMARKSTACK
|
||||
~~~~~~~~~~~
|
||||
|
||||
.. code-block:: C
|
||||
|
||||
#define mjMARKSTACK int _mark = d->pstack;
|
||||
|
||||
This macro is helpful when using the MuJoCo stack in custom computations. It works together with the next macro and the
|
||||
:ref:`mj_stackAlloc` family of functions, and assumes that mjData\* d is defined. The use pattern is this:
|
||||
|
||||
.. code-block:: C
|
||||
|
||||
mjMARKSTACK;
|
||||
mjtNum* temp = mj_stackAllocNum(d, 100);
|
||||
// ... use temp as needed
|
||||
mjFREESTACK;
|
||||
|
||||
|
||||
.. _mjFREESTACK:
|
||||
|
||||
mjFREESTACK
|
||||
~~~~~~~~~~~
|
||||
|
||||
.. code-block:: C
|
||||
|
||||
#define mjFREESTACK d->pstack = _mark;
|
||||
|
||||
Reset the MuJoCo stack pointer to the variable \_mark, normally saved by mjMARKSTACK.
|
||||
|
||||
|
||||
.. _mjDISABLED:
|
||||
|
||||
mjDISABLED
|
||||
|
||||
+50
-28
@@ -5,58 +5,80 @@ Changelog
|
||||
Upcoming version (not yet released)
|
||||
-----------------------------------
|
||||
|
||||
General
|
||||
^^^^^^^
|
||||
New features
|
||||
^^^^^^^^^^^^
|
||||
|
||||
.. youtube:: Vc1tq0fFvQA
|
||||
:align: right
|
||||
:width: 240px
|
||||
|
||||
1. Added constraint island discovery in :ref:`mj_island`. Constraint islands are disjoint sets of constraints
|
||||
and degrees-of-freedom that do not interact. In a future release the constraint solver will be refactored to
|
||||
exploit the disjoint structure. Island discovery can be activated using a new :ref:`enable flag<option-flag-island>`
|
||||
which will be removed after the refactor. If island discovery is enabled, geoms, contacts and
|
||||
tendons will be colored according to the corresponding island, see video.
|
||||
|
||||
.. youtube:: QewlEqIZi1o
|
||||
:align: right
|
||||
:width: 240px
|
||||
|
||||
1. Added new signed distance field (SDF) collision primitive. SDFs can take any shape and are not constrained to be
|
||||
2. Added new signed distance field (SDF) collision primitive. SDFs can take any shape and are not constrained to be
|
||||
convex. Collision points are found by minimizing the maximum of the two colliding SDFs via gradient descent.
|
||||
|
||||
- Added new SDF plugin for defining implicit geometries. The plugin must define methods computing an SDF and its
|
||||
gradient at query points See the :ref:`documentation<exWriting>` for more details.
|
||||
|
||||
.. youtube:: Vc1tq0fFvQA
|
||||
:align: right
|
||||
:width: 240px
|
||||
3. Added :ref:`mjThreadPool` and :ref:`mjTask` which allow for multi-threaded operations within MuJoCo engine pipeline.
|
||||
|
||||
#. Added constraint island discovery in :ref:`mj_island`. Constraint islands are disjoint sets of constraints
|
||||
and degrees-of-freedom that do not interact. In a future release the constraint solver will be refactored to
|
||||
exploit the disjoint structure. Island discovery can be activated using a new :ref:`enable flag<option-flag-island>`
|
||||
which will be removed after the refactor. If island discovery is enabled, geoms, contacts and
|
||||
tendons will be colored according to the corresponding island, see video.
|
||||
#. Added a new :ref:`dyntype<actuator-general-dyntype>`, ``filterexact``, which updates first-order filter states with
|
||||
General
|
||||
^^^^^^^
|
||||
|
||||
.. admonition:: Breaking API changes
|
||||
:class: attention
|
||||
|
||||
4. Removed macros ``mjMARKSTACK`` and ``mjFREESTACK``.
|
||||
|
||||
.. admonition:: Migration note
|
||||
:class: note
|
||||
|
||||
These macros have been replaced by new functions :ref:`mj_markStack` and :ref:`mj_freeStack`. These functions
|
||||
manages ``mjData`` stack frames in a fully encapsulated way (i.e. without having to introduce a local variable
|
||||
at the call site).
|
||||
|
||||
5. Changed the function :ref:`mj_stackAlloc` to allocate an arbitrary number of bytes, rather than in multiples of
|
||||
``sizeof(mjtNum)``, and add an additional argument for specifying the alignment of the returned pointer.
|
||||
|
||||
.. admonition:: Migration note
|
||||
:class: note
|
||||
|
||||
The old functionality for allocating ``mjtNum`` arrays is still available through a new function
|
||||
:ref:`mj_stackAllocNum`.
|
||||
|
||||
6. Renamed the ``nstack`` field in :ref:`mjModel` and :ref:`mjData` to ``narena``. Changed ``narena``, ``pstack``,
|
||||
and ``maxuse_stack`` to count number of bytes rather than number of :ref:`mjtNum` |-| s.
|
||||
|
||||
7. Added a new :ref:`dyntype<actuator-general-dyntype>`, ``filterexact``, which updates first-order filter states with
|
||||
the exact formula rather than with Euler integration.
|
||||
#. Added an actuator attribute, :ref:`actearly<actuator-general-actearly>`, which uses semi-implicit integration for
|
||||
8. Added an actuator attribute, :ref:`actearly<actuator-general-actearly>`, which uses semi-implicit integration for
|
||||
actuator forces: using the next step's actuator state to compute the current actuator forces at the current timestep.
|
||||
#. Renamed ``actuatorforcerange`` and ``actuatorforcelimited``, introduced in the previous version to
|
||||
9. Renamed ``actuatorforcerange`` and ``actuatorforcelimited``, introduced in the previous version to
|
||||
:ref:`actuatorfrcrange<body-joint-actuatorfrcrange>` and
|
||||
:ref:`actuatorfrclimited<body-joint-actuatorfrclimited>`, respectively.
|
||||
#. Added the flag :ref:`eulerdamp<option-flag-eulerdamp>`, which disables implicit integration of joint damping in the
|
||||
Euler integrator. See the :ref:`Numerical Integration<geIntegration>` section for more details.
|
||||
#. Added the flag :ref:`invdiscrete<option-flag-invdiscrete>`, which enables discrete-time inverse dynamics for all
|
||||
:ref:`integrators<option-integrator>` other than ``RK4``. See the flag documentation for more details.
|
||||
#. Changed the function :ref:`mj_stackAlloc` to allocate an arbitrary number of bytes, rather than in multiples of
|
||||
``sizeof(mjtNum)``, and add an additional argument for specifying the alignment of the returned pointer. The existing
|
||||
functionality of allocating ``mjtNum`` arrays is still available through the new function :ref:`mj_stackAllocNum`.
|
||||
#. Renamed the ``nstack`` field in :ref:`mjModel` and :ref:`mjData` to ``narena``. Changed ``narena``, ``pstack``, and
|
||||
``maxuse_stack`` to count number of bytes rather than number of :ref:`mjtNum` |-| s.
|
||||
#. Added new functions ``mj_markStack`` and ``mj_freeStack`` that manages ``mjData`` stack frames in a fully
|
||||
encapsulated way (i.e. without having to introduce a local variable at the call site).
|
||||
#. Added :ref:`mjThreadPool` and :ref:`mjTask` which allow for multi-threaded operations within MuJoCo engine pipeline.
|
||||
10. Added the flag :ref:`eulerdamp<option-flag-eulerdamp>`, which disables implicit integration of joint damping in the
|
||||
Euler integrator. See the :ref:`Numerical Integration<geIntegration>` section for more details.
|
||||
11. Added the flag :ref:`invdiscrete<option-flag-invdiscrete>`, which enables discrete-time inverse dynamics for all
|
||||
:ref:`integrators<option-integrator>` other than ``RK4``. See the flag documentation for more details.
|
||||
|
||||
Python bindings
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
10. Fixed `#870 <https://github.com/deepmind/mujoco/issues/870>`__ where calling ``update_scene`` with an invalid
|
||||
12. Fixed `#870 <https://github.com/deepmind/mujoco/issues/870>`__ where calling ``update_scene`` with an invalid
|
||||
camera name used the default camera.
|
||||
|
||||
Bug fixes
|
||||
^^^^^^^^^
|
||||
|
||||
11. Fixed a bug that was causing the geom margins to be ignored during the midphase.
|
||||
13. Fixed a bug that was causing the geom margins to be ignored during the midphase.
|
||||
|
||||
|
||||
Version 2.3.7 (July 20, 2023)
|
||||
|
||||
@@ -2456,7 +2456,7 @@ void mju_addTo3(mjtNum res[3], const mjtNum vec[3]);
|
||||
void mju_subFrom3(mjtNum res[3], const mjtNum vec[3]);
|
||||
void mju_addToScl3(mjtNum res[3], const mjtNum vec[3], mjtNum scl);
|
||||
void mju_addScl3(mjtNum res[3], const mjtNum vec1[3], const mjtNum vec2[3], mjtNum scl);
|
||||
mjtNum mju_normalize3(mjtNum res[3]);
|
||||
mjtNum mju_normalize3(mjtNum vec[3]);
|
||||
mjtNum mju_norm3(const mjtNum vec[3]);
|
||||
mjtNum mju_dot3(const mjtNum vec1[3], const mjtNum vec2[3]);
|
||||
mjtNum mju_dist3(const mjtNum pos1[3], const mjtNum pos2[3]);
|
||||
@@ -2466,10 +2466,10 @@ void mju_cross(mjtNum res[3], const mjtNum a[3], const mjtNum b[3]);
|
||||
void mju_zero4(mjtNum res[4]);
|
||||
void mju_unit4(mjtNum res[4]);
|
||||
void mju_copy4(mjtNum res[4], const mjtNum data[4]);
|
||||
mjtNum mju_normalize4(mjtNum res[4]);
|
||||
mjtNum mju_normalize4(mjtNum vec[4]);
|
||||
void mju_zero(mjtNum* res, int n);
|
||||
void mju_fill(mjtNum* res, mjtNum val, int n);
|
||||
void mju_copy(mjtNum* res, const mjtNum* data, int n);
|
||||
void mju_copy(mjtNum* res, const mjtNum* vec, int n);
|
||||
mjtNum mju_sum(const mjtNum* vec, int n);
|
||||
mjtNum mju_L1(const mjtNum* vec, int n);
|
||||
void mju_scl(mjtNum* res, const mjtNum* vec, mjtNum scl, int n);
|
||||
|
||||
@@ -703,21 +703,19 @@ internally when an instability is detected in :ref:`mj_step`, :ref:`mj_step1` an
|
||||
take advantage of the custom stack, this needs to be done in-between MuJoCo calls that have the potential to reset the
|
||||
simulation.
|
||||
|
||||
Below is the general template for using the custom stack in user code. This assumes that ``mjData\* d`` is defined in
|
||||
the scope. If not, saving and restoring the stack pointer should be done manually instead of using the
|
||||
:ref:`mjMARKSTACK` and :ref:`mjFREESTACK` macros.
|
||||
Below is the general template for using the custom stack in user code.
|
||||
|
||||
.. code-block:: C
|
||||
|
||||
// save stack pointer in the "hidden" variable _mark
|
||||
mjMARKSTACK;
|
||||
// mark an mjData stack frame
|
||||
mj_markStack(d);
|
||||
|
||||
// allocate space
|
||||
mjtNum* myqpos = mj_stackAllocNum(d, m->nq);
|
||||
mjtNum* myqvel = mj_stackAllocNum(d, m->nv);
|
||||
|
||||
// restore stack from _mark
|
||||
mjFREESTACK;
|
||||
// restore the mjData stack frame
|
||||
mj_freeStack(d);
|
||||
|
||||
The function :ref:`mj_stackAllocNum` checks if there is enough space, and if so it advances the stack pointer,
|
||||
otherwise it triggers an error. It also keeps track of the maximum stack allocation;
|
||||
|
||||
Reference in New Issue
Block a user