Document engine plugins.

Rename `mjPLUGIN_DYNAMIC_LIBRARY_INIT` -> `mjPLUGIN_LIB_INIT`.

PiperOrigin-RevId: 521458377
Change-Id: I42aaec923e4f392899dfe53ab6ce1dddc75a83b3
This commit is contained in:
Yuval Tassa
2023-04-03 07:54:41 -07:00
committed by Copybara-Service
parent ebb150fa3d
commit 01b84089dd
10 changed files with 578 additions and 61 deletions
+26
View File
@@ -43,6 +43,7 @@ API function can be classified as:
Macros
^^^^^^
.. _mjMARKSTACK:
mjMARKSTACK
@@ -62,6 +63,7 @@ This macro is helpful when using the MuJoCo stack in custom computations. It wor
// ... use temp as needed
mjFREESTACK
.. _mjFREESTACK:
mjFREESTACK
@@ -73,6 +75,7 @@ mjFREESTACK
Reset the MuJoCo stack pointer to the variable \_mark, normally saved by mjMARKSTACK.
.. _mjDISABLED:
mjDISABLED
@@ -85,6 +88,7 @@ mjDISABLED
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
@@ -97,6 +101,7 @@ mjENABLED
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
@@ -108,6 +113,7 @@ mjMAX
Return maximum value. To avoid repeated evaluation with mjtNum types, use the function :ref:`mju_max`.
.. _mjMIN:
mjMIN
@@ -118,3 +124,23 @@ mjMIN
#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.
+46 -6
View File
@@ -26,6 +26,7 @@ MuJoCo defines a large number of types:
- Structs for :ref:`abstract visualization<tyVisStructure>`.
- Structs used by the :ref:`openGL renderer<tyRenderStructure>`.
- Structs used by the :ref:`UI framework<tyUIStructure>`.
- Structs used by :ref:`engine plugins<tyPluginStructure>`.
- Several :ref:`tyFunction` for user-defined callbacks.
@@ -555,6 +556,25 @@ Item types used in the UI framework.
.. mujoco-include:: mjtItem
.. _tyPluginEnums:
Plugins
^^^^^^^
The enums below are defined in `mjplugin.h <https://github.com/deepmind/mujoco/blob/main/include/mujoco/mjplugin.h>`_.
See :ref:`exPlugin` for details.
.. _mjtPluginCapabilityBit:
mjtPluginCapabilityBit
~~~~~~~~~~~~~~~~~~~~~~
Capabilities declared by an engine plugin.
.. mujoco-include:: mjtPluginCapabilityBit
.. _tyStructure:
@@ -838,7 +858,8 @@ This structure contains the custom OpenGL rendering context, with the ids of all
User Interface
^^^^^^^^^^^^^^
The names of these struct types are prefixed with ``mjui``.
The names of these struct types are prefixed with ``mjui``, except for the main :ref:`mjUI` struct itself.
.. _mjuiState:
@@ -890,6 +911,16 @@ This structure defines one section of the UI.
.. mujoco-include:: mjuiSection
.. _mjuiDef:
mjuiDef
~~~~~~~
This structure defines one entry in the definition table used for simplified UI construction.
.. mujoco-include:: mjuiDef
.. _mjUI:
mjUI
@@ -900,14 +931,23 @@ This structure defines the entire UI.
.. mujoco-include:: mjUI
.. _mjuiDef:
.. _tyPluginStructure:
mjuiDef
~~~~~~~
Plugins
^^^^^^^
This structure defines one entry in the definition table used for simplified UI construction.
The names of these struct types are prefixed with ``mjp``. See :ref:`exPlugin` for more details.
.. mujoco-include:: mjuiDef
.. _mjpPlugin:
mjpPlugin
~~~~~~~~~
This structure contains the definition of a single engine plugin. It mostly contains a set of callbacks, which are
triggered by the compiler and the engine during various phases of the computation pipeline.
.. mujoco-include:: mjpPlugin