Rename mj_stackAlloc to mj_stackAllocNum.
PiperOrigin-RevId: 561040193 Change-Id: I49ea21ffb5b596471d2aacefb1961c11c5c905d0
This commit is contained in:
committed by
Copybara-Service
parent
ea5e00cad8
commit
b979a26b10
@@ -53,12 +53,12 @@ mjMARKSTACK
|
||||
#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` function, and assumes that mjData\* d is defined. The use pattern is this:
|
||||
: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_stackAlloc(d, 100);
|
||||
mjtNum* temp = mj_stackAllocNum(d, 100);
|
||||
// ... use temp as needed
|
||||
mjFREESTACK;
|
||||
|
||||
|
||||
@@ -1232,12 +1232,12 @@ mj_resetDataKeyframe
|
||||
|
||||
Reset data, set fields from specified keyframe.
|
||||
|
||||
.. _mj_stackAlloc:
|
||||
.. _mj_stackAllocNum:
|
||||
|
||||
mj_stackAlloc
|
||||
~~~~~~~~~~~~~
|
||||
mj_stackAllocNum
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mj_stackAlloc
|
||||
.. mujoco-include:: mj_stackAllocNum
|
||||
|
||||
Allocate array of mjtNums on :ref:`mjData` stack. Call mju_error on stack overflow.
|
||||
|
||||
|
||||
+3
-2
@@ -38,17 +38,18 @@ General
|
||||
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.
|
||||
#. Renamed the function ``mj_stackAlloc`` to ``mj_stackAllocNum``.
|
||||
|
||||
Python bindings
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
8. Fixed `#870 <https://github.com/deepmind/mujoco/issues/870>`__ where calling ``update_scene`` with an invalid
|
||||
9. Fixed `#870 <https://github.com/deepmind/mujoco/issues/870>`__ where calling ``update_scene`` with an invalid
|
||||
camera name used the default camera.
|
||||
|
||||
Bug fixes
|
||||
^^^^^^^^^
|
||||
|
||||
9. Fixed a bug that was causing the geom margins to be ignored during the midphase.
|
||||
10. Fixed a bug that was causing the geom margins to be ignored during the midphase.
|
||||
|
||||
|
||||
Version 2.3.7 (July 20, 2023)
|
||||
|
||||
@@ -2212,7 +2212,7 @@ mjData* mj_copyData(mjData* dest, const mjModel* m, const mjData* src);
|
||||
void mj_resetData(const mjModel* m, mjData* d);
|
||||
void mj_resetDataDebug(const mjModel* m, mjData* d, unsigned char debug_value);
|
||||
void mj_resetDataKeyframe(const mjModel* m, mjData* d, int key);
|
||||
mjtNum* mj_stackAlloc(mjData* d, int size);
|
||||
mjtNum* mj_stackAllocNum(mjData* d, int size);
|
||||
int* mj_stackAllocInt(mjData* d, int size);
|
||||
void mj_deleteData(mjData* d);
|
||||
void mj_resetCallbacks(void);
|
||||
|
||||
@@ -713,16 +713,17 @@ the scope. If not, saving and restoring the stack pointer should be done manuall
|
||||
mjMARKSTACK;
|
||||
|
||||
// allocate space
|
||||
mjtNum* myqpos = mj_stackAlloc(d, m->nq);
|
||||
mjtNum* myqvel = mj_stackAlloc(d, m->nv);
|
||||
mjtNum* myqpos = mj_stackAllocNum(d, m->nq);
|
||||
mjtNum* myqvel = mj_stackAllocNum(d, m->nv);
|
||||
|
||||
// restore stack from _mark
|
||||
mjFREESTACK;
|
||||
|
||||
The function :ref:`mj_stackAlloc` 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; see :ref:`diagnostics <siDiagnostics>` below.
|
||||
Note that :ref:`mj_stackAlloc` is only used for allocating ``mjtNum`` arrays, the most common type of array.
|
||||
:ref:`mj_stackAllocInt` is provided for integer array allocation. Allocators for other types are also possible, as in
|
||||
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;
|
||||
see :ref:`diagnostics <siDiagnostics>` below. Note that :ref:`mj_stackAllocNum` is only used for allocating
|
||||
``mjtNum`` arrays, the most common type of array. :ref:`mj_stackAllocInt` is provided for integer array allocation.
|
||||
Allocators for other types are also possible, as in
|
||||
`engine_collision_driver.c <https://github.com/deepmind/mujoco/blob/main/src/engine/engine_collision_driver.c>`__.
|
||||
|
||||
.. _siError:
|
||||
|
||||
Reference in New Issue
Block a user