Improve plugin documentation.

PiperOrigin-RevId: 690974299
Change-Id: Iadaabafb7434ada9579d6e2f64aae435cdfedbd8
This commit is contained in:
Yuval Tassa
2024-10-29 05:06:19 -07:00
committed by Copybara-Service
parent ce5f8b4728
commit 6703a40fcf
+35 -21
View File
@@ -201,22 +201,22 @@ the ``copy`` callback from :ref:`mjpPlugin` for each plugin instance present.
.. _exActuatorAct: .. _exActuatorAct:
Actuator activations Actuator states
"""""""""""""""""""" """""""""""""""
When writing stateful actuator plugins, there are two choices for where to save the actuator state. One option is using When writing stateful actuator plugins, there are two choices for where to save the actuator state. One option is using
``plugin_state`` as described above, and the other is to use ``mjData.act`` by implementing the ``actuator_actdim`` and ``plugin_state`` as described above, and the other is to use ``mjData.act`` by implementing the callback on
``actuator_act_dot`` callbacks on :ref:`mjpPlugin`. :ref:`mjpPlugin`.
When using the latter option, the actuator plugin's state will be added to ``mjData.act``, and MuJoCo will When using the latter option, the actuator plugin's state will be added to ``mjData.act``, and MuJoCo will
automatically integrate ``mjData.act_dot`` values between timesteps. One advantage of this approach is that automatically integrate ``mjData.act_dot`` values between timesteps. One advantage of this approach is that
finite-differencing functions like :ref:`mjd_transitionFD` will work as they do for native actuators. The finite-differencing functions like :ref:`mjd_transitionFD` will work as they do for native actuators. The
``mjpPlugin.advance`` callback will be called after ``act_dot`` is integrated, and actuator plugins may overwrite ``mjpPlugin.advance`` callback will be called after ``act_dot`` is integrated, and actuator plugins may overwrite
the ``act`` values at that point, if Euler integration isn't appropriate. the ``act`` values at that point, if the built-in integrator is not appropriate.
Users may specify the :ref:`dyntype<actuator-plugin-dyntype>` attribute on actuator plugins, to introduce a filter or Users may specify the :ref:`dyntype<actuator-plugin-dyntype>` attribute on actuator plugins, to introduce a filter or
an integrator between user inputs and actuator activations. When they do, the activation variable introduced by an integrator between user inputs and actuator states. When they do, the state variable introduced by
``dyntype`` will be placed *after* the plugin's activation variables in the ``act`` array. ``dyntype`` will be placed *after* the plugin's state variables in the ``act`` array.
.. _exRegistration: .. _exRegistration:
@@ -269,20 +269,34 @@ A future version of this section will include:
There are several first-party plugin directories: There are several first-party plugin directories:
* **actuator:** The plugins in the `actuator/ <https://github.com/google-deepmind/mujoco/tree/main/plugin/actuator>`__ actuator
directory implement custom actuators, so far only a PID controller. See the """"""""
`README <https://github.com/google-deepmind/mujoco/blob/main/plugin/actuator/README.md>`__ for details. The plugins in the `actuator/ <https://github.com/google-deepmind/mujoco/tree/main/plugin/actuator>`__ directory
* **elasticity:** The plugins in the `elasticity/ implement custom actuators, so far only a PID controller. See the `README
<https://github.com/google-deepmind/mujoco/tree/main/plugin/elasticity>`__ directory are passive forces based on <https://github.com/google-deepmind/mujoco/blob/main/plugin/actuator/README.md>`__ for details.
continuum mechanics for 1-dimensional and 2-dimensional bodies. The 1D model is invariant under rotations and captures
the large deformation of elastic cables, decoupling twisting and bending strains. The 2D model is a suitable for
computing the bending stiffness of thin elastic plates (i.e. shells having a flat stress-free configuration). In this elasticity
case, the elastic energy is quadratic and therefore the stiffness matrix is constant. For more information, please see """"""""""
the `README <https://github.com/google-deepmind/mujoco/blob/main/plugin/elasticity/README.md>`__. The plugins in the `elasticity/ <https://github.com/google-deepmind/mujoco/tree/main/plugin/elasticity>`__ directory are
* **sensor:** The plugins in the `sensor/ <https://github.com/google-deepmind/mujoco/tree/main/plugin/sensor>`__ passive forces based on continuum mechanics for 1-dimensional and 2-dimensional bodies. The 1D model is invariant under
directory implement custom sensors. Currently the sole sensor plugin is the touch grid sensor, see the rotations and captures the large deformation of elastic cables, decoupling twisting and bending strains. The 2D model is
`README <https://github.com/google-deepmind/mujoco/blob/main/plugin/sensor/README.md>`__ for details. a suitable for computing the bending stiffness of thin elastic plates (i.e. shells having a flat stress-free
* **sdf:** The plugins in the `sdf/ <https://github.com/google-deepmind/mujoco/tree/main/plugin/sdf>`__ directory configuration). In this case, the elastic energy is quadratic and therefore the stiffness matrix is constant. For more
information, please see the `README
<https://github.com/google-deepmind/mujoco/blob/main/plugin/elasticity/README.md>`__.
sensor
""""""
The plugins in the `sensor/ <https://github.com/google-deepmind/mujoco/tree/main/plugin/sensor>`__ directory implement
custom sensors. Currently the sole sensor plugin is the touch grid sensor, see the `README
<https://github.com/google-deepmind/mujoco/blob/main/plugin/sensor/README.md>`__ for details.
sdf
"""
The plugins in the `sdf/ <https://github.com/google-deepmind/mujoco/tree/main/plugin/sdf>`__ directory
specify custom shapes in a mesh-free manner, by defining methods computing a signed distance field and its gradient at specify custom shapes in a mesh-free manner, by defining methods computing a signed distance field and its gradient at
query points. This shape then acts as a new geom type in the collision table at the top of `engine_collision_driver.c query points. This shape then acts as a new geom type in the collision table at the top of `engine_collision_driver.c
<https://github.com/google-deepmind/mujoco/blob/main/src/engine/engine_collision_driver.c>`__. For more information <https://github.com/google-deepmind/mujoco/blob/main/src/engine/engine_collision_driver.c>`__. For more information