Improve order and categorization in function API reference.

Also, move macros to the globals section.

PiperOrigin-RevId: 641936967
Change-Id: I5b1f6aa52c69e68cc6310093c5811f0f20828bab
This commit is contained in:
Yuval Tassa
2024-06-10 10:00:03 -07:00
committed by Copybara-Service
parent 238736393b
commit 171b0d6e06
3 changed files with 718 additions and 699 deletions
+42 -99
View File
@@ -9,105 +9,48 @@ large number of functions. However the functions that most users are likely to n
API function can be classified as:
- :ref:`Parse and compile<Parseandcompile>` an :ref:`mjModel` from XML files and assets.
- :ref:`Main simulation<Mainsimulation>` entry points, including :ref:`mj_step`.
- :ref:`Support<Support>` functions requiring :ref:`mjModel` and :ref:`mjData`.
- :ref:`Components<Components>` of the simulation pipeline, called from :ref:`mj_step`, :ref:`mj_forward` and :ref:`mj_inverse`.
- :ref:`Sub components<Subcomponents>` of the simulation pipeline.
- :ref:`Ray collisions<Raycollisions>`.
- :ref:`Printing<Printing>` of various quantities.
- :ref:`Virtual file system<Virtualfilesystem>`, used to load assets from memory.
- :ref:`Initialization<Initialization>` of data structures.
- :ref:`Abstract interaction<Interaction>`: mouse control of cameras and perturbations.
- :ref:`Abstract Visualization<Visualization-api>`.
- :ref:`OpenGL rendering<OpenGLrendering>`.
- :ref:`UI framework<UIframework>`.
- :ref:`Error and memory<Errorandmemory>`.
- :ref:`Aliases for C standard math<Standardmath>` functions.
- :ref:`Vector math<Vectormath>`.
- :ref:`Quaternions<Quaternions>`.
- :ref:`Poses transformations<Poses>`.
- :ref:`Matrix decompositions and solvers<Decompositions>`.
- :ref:`Miscellaneous<Miscellaneous>` functions.
- :ref:`Derivatives<Derivatives-api>`.
- :ref:`Plugin<Plugins-api>` related functions.
- :ref:`Macros<Macros>`.
- :ref:`Thread<Thread>` related functions.
- **Main entry points**
- :ref:`Parse and compile<Parseandcompile>` an :ref:`mjModel` from XML files and assets.
- :ref:`Main simulation<Mainsimulation>` entry points, including :ref:`mj_step`.
.. TODO(b/273075045): Better category-label namespacing.
- **Support functions**
- :ref:`Support<Support>` functions requiring :ref:`mjModel` and :ref:`mjData`.
- Pipeline :ref:`components<Components>`, called from :ref:`mj_step`, :ref:`mj_forward` and :ref:`mj_inverse`.
- :ref:`Sub components<Subcomponents>` of the simulation pipeline.
- :ref:`Ray casting<Raycollisions>`.
- :ref:`Printing<Printing>` of various quantities.
- :ref:`Virtual file system<Virtualfilesystem>`, used to load assets from memory.
- :ref:`Initialization<Initialization>` of data structures.
- :ref:`Error and memory<Errorandmemory>`.
- :ref:`Miscellaneous<Miscellaneous>` functions.
- **Visualization, Rendering, UI**
- :ref:`Abstract interaction<Interaction>`: mouse control of cameras and perturbations.
- :ref:`Abstract Visualization<Visualization-api>`.
- :ref:`OpenGL rendering<OpenGLrendering>`.
- :ref:`UI framework<UIframework>`.
- **Threads, Plugins, Derivatives**
- :ref:`Derivatives<Derivatives-api>`.
- :ref:`Thread<Thread>` |-| -related functions.
- :ref:`Plugin<Plugins-api>` |-| -related functions.
- **Math**
- Aliases for C :ref:`standard math<Standardmath>` functions.
- :ref:`Vector math<Vectormath>`.
- :ref:`Quaternions<Quaternions>`.
- :ref:`Pose transformations<Poses>`.
- :ref:`Matrix decompositions and solvers<Decompositions>`.
- **Model editing**
- :ref:`Attachment<Attachment>`.
- :ref:`Tree elements<AddTreeElements>`.
- :ref:`Non-tree elements<AddNonTreeElements>`.
- :ref:`Assets<AddAssets>`.
- :ref:`Find and get utilities<FindAndGetUtilities>`.
- :ref:`Attribute setters<AttributeSetters>`.
- :ref:`Attribute getters<AttributeGetters>`.
- :ref:`Spec utilities<SpecUtilities>`.
- :ref:`Element initialization<ElementInitialization>`.
.. include:: functions.rst
.. _Macros:
Macros
^^^^^^
.. _mjDISABLED:
mjDISABLED
~~~~~~~~~~
.. code-block:: C
#define mjDISABLED(x) (m->opt.disableflags & (x))
Check if a given standard feature has been disabled via the physics options, assuming mjModel\* m is defined. x is of
type :ref:`mjtDisableBit`.
.. _mjENABLED:
mjENABLED
~~~~~~~~~
.. code-block:: C
#define mjENABLED(x) (m->opt.enableflags & (x))
Check if a given optional feature has been enabled via the physics options, assuming mjModel\* m is defined. x is of
type :ref:`mjtEnableBit`.
.. _mjMAX:
mjMAX
~~~~~
.. code-block:: C
#define mjMAX(a,b) (((a) > (b)) ? (a) : (b))
Return maximum value. To avoid repeated evaluation with mjtNum types, use the function :ref:`mju_max`.
.. _mjMIN:
mjMIN
~~~~~
.. code-block:: C
#define mjMIN(a,b) (((a) < (b)) ? (a) : (b))
Return minimum value. To avoid repeated evaluation with mjtNum types, use the function :ref:`mju_min`.
.. _mjPLUGIN_LIB_INIT:
mjPLUGIN_LIB_INIT
~~~~~~~~~~~~~~~~~
.. code-block:: C
#define mjPLUGIN_LIB_INIT \
static void _mjplugin_dllmain(void); \
mjEXTERNC int __stdcall mjDLLMAIN(void* hinst, unsigned long reason, void* reserved) { \
if (reason == 1) { \
_mjplugin_dllmain(); \
} \
return 1; \
} \
static void _mjplugin_dllmain(void)
Register a plugin as a dynamic library. See :ref:`plugin registration<exRegistration>` for more details.
+76
View File
@@ -13,6 +13,7 @@ Global variable and constant definitions can be classified as:
- The :ref:`collision table<glCollision>` containing narrow-phase collision functions.
- :ref:`String constants<glString>`.
- :ref:`Numeric constants<glNumeric>`.
- :ref:`Macros<Macros>`.
- :ref:`X Macros<tyXMacro>`.
.. _glError:
@@ -528,6 +529,81 @@ shown in the table below. Their names are in the format ``mjKEY_XXX``. They corr
number with the same meaning but for the compiled library.
.. _Macros:
Macros
^^^^^^
.. _mjDISABLED:
mjDISABLED
~~~~~~~~~~
.. code-block:: C
#define mjDISABLED(x) (m->opt.disableflags & (x))
Check if a given standard feature has been disabled via the physics options, assuming mjModel\* m is defined. x is of
type :ref:`mjtDisableBit`.
.. _mjENABLED:
mjENABLED
~~~~~~~~~
.. code-block:: C
#define mjENABLED(x) (m->opt.enableflags & (x))
Check if a given optional feature has been enabled via the physics options, assuming mjModel\* m is defined. x is of
type :ref:`mjtEnableBit`.
.. _mjMAX:
mjMAX
~~~~~
.. code-block:: C
#define mjMAX(a,b) (((a) > (b)) ? (a) : (b))
Return maximum value. To avoid repeated evaluation with mjtNum types, use the function :ref:`mju_max`.
.. _mjMIN:
mjMIN
~~~~~
.. code-block:: C
#define mjMIN(a,b) (((a) < (b)) ? (a) : (b))
Return minimum value. To avoid repeated evaluation with mjtNum types, use the function :ref:`mju_min`.
.. _mjPLUGIN_LIB_INIT:
mjPLUGIN_LIB_INIT
~~~~~~~~~~~~~~~~~
.. code-block:: C
#define mjPLUGIN_LIB_INIT \
static void _mjplugin_dllmain(void); \
mjEXTERNC int __stdcall mjDLLMAIN(void* hinst, unsigned long reason, void* reserved) { \
if (reason == 1) { \
_mjplugin_dllmain(); \
} \
return 1; \
} \
static void _mjplugin_dllmain(void)
Register a plugin as a dynamic library. See :ref:`plugin registration<exRegistration>` for more details.
.. _tyXMacro:
X Macros
File diff suppressed because it is too large Load Diff