Improve compiler-related documentation.

PiperOrigin-RevId: 651827545
Change-Id: I85c12dc12967e49087c342445dbfa049c5cdbcdf
This commit is contained in:
Yuval Tassa
2024-07-12 11:04:20 -07:00
committed by Copybara-Service
parent 5d51b4cd5f
commit e13ddfa2ab
8 changed files with 213 additions and 52 deletions
+10 -6
View File
@@ -1078,12 +1078,13 @@ is initialized, others change at runtime.
.. _tySpecStructure:
mjSpec
^^^^^^
Model Editing
^^^^^^^^^^^^^
The strucs below are defined in `mjspec.h <https://github.com/google-deepmind/mujoco/blob/main/include/mujoco/mjspec.h>`__
and, with the exception of the top level :ref:`mjSpec` struct, begin with the ``mjs`` prefix.
For more details, see the :doc:`Model Editing <../programming/modeledit>` chapter.
The strucs below are defined in
`mjspec.h <https://github.com/google-deepmind/mujoco/blob/main/include/mujoco/mjspec.h>`__ and, with the exception of
the top level :ref:`mjSpec` struct, begin with the ``mjs`` prefix. For more details, see the :doc:`Model Editing
<../programming/modeledit>` chapter.
.. _mjSpec:
@@ -1375,6 +1376,8 @@ Plugin specification.
.. mujoco-include:: mjsPlugin
.. _ArrayHandles:
.. _mjString:
.. _mjStringVec:
@@ -1392,7 +1395,8 @@ Plugin specification.
Array handles
~~~~~~~~~~~~~
Explain how handles work.
C handles for C++ strings and vector types. When using from C, use the provided :ref:`getters<AttributeGetters>` and
:ref:`setters<AttributeSetters>`.
.. code-block:: C++
+13 -2
View File
@@ -56,7 +56,17 @@ mj_recompile
.. mujoco-include:: mj_recompile
Recompile spec to model, preserving the state.
Recompile spec to model, preserving the state. Like :ref:`mj_compile`, this function compiles an :ref:`mjSpec` to an
:ref:`mjModel`, with two differences. First, rather than returning an entirely new model, it will
reallocate existing :ref:`mjModel` and :ref:`mjData` instances in-place. Second, it will preserve the
:ref:`integration state<geIntegrationState>`, as given in the provided :ref:`mjData` instance, while accounting for
newly added or removed degrees of freedom. This allows the user to continue simulation with the same model and data
struct pointers while editing the model programmatically.
.. admonition:: Incomplete implementation
:class: attention
This function is currently incomplete, preserving only ``mjData.qpos`` and ``mjData.qvel``.
.. _mj_saveLastXML:
@@ -2682,7 +2692,8 @@ Note that derivatives depend only on :math:`h` and :math:`v` (in fact, on :math:
All outputs are optional.
These functions provide high level manipulation for :ref:`mjSpec` structs, which represent an uncompiled :ref:`mjModel`.
These functions provide high level manipulation for the :ref:`mjSpec` struct, which represents an
uncompiled :ref:`mjModel`.
.. _Plugins-api:
+16 -2
View File
@@ -29,6 +29,20 @@ The key function here is :ref:`mj_loadXML`. It invokes the built-in parser and c
a valid mjModel, or NULL - in which case the user should check the error information in the user-provided string.
The model and all files referenced in it can be loaded from disk or from a VFS when provided.
.. _mj_recompile:
Recompile spec to model, preserving the state. Like :ref:`mj_compile`, this function compiles an :ref:`mjSpec` to an
:ref:`mjModel`, with two differences. First, rather than returning an entirely new model, it will
reallocate existing :ref:`mjModel` and :ref:`mjData` instances in-place. Second, it will preserve the
:ref:`integration state<geIntegrationState>`, as given in the provided :ref:`mjData` instance, while accounting for
newly added or removed degrees of freedom. This allows the user to continue simulation with the same model and data
struct pointers while editing the model programmatically.
.. admonition:: Incomplete implementation
:class: attention
This function is currently incomplete, preserving only ``mjData.qpos`` and ``mjData.qvel``.
.. _Mainsimulation:
These are the main entry points to the simulator. Most users will only need to call :ref:`mj_step`, which computes
@@ -638,5 +652,5 @@ All outputs are optional.
.. _SpecManip:
These functions provide high level manipulation for :ref:`mjSpec` structs, which represent an uncompiled :ref:`mjModel`.
These functions provide high level manipulation for the :ref:`mjSpec` struct, which represents an
uncompiled :ref:`mjModel`.