Add per-body gravity compensation (buoyancy) passive force.

PiperOrigin-RevId: 485342531
Change-Id: Icb3e6bb5080b6ef17a3d3b1cc67e0503cfeaeffb
This commit is contained in:
Kyle Bayes
2022-11-01 09:47:13 -07:00
committed by Copybara-Service
parent c7960385be
commit 23092a11d7
18 changed files with 233 additions and 10 deletions
+1
View File
@@ -1464,6 +1464,7 @@ mjModel
mjtNum* body_subtreemass; // mass of subtree starting at this body (nbody x 1)
mjtNum* body_inertia; // diagonal inertia in ipos/iquat frame (nbody x 3)
mjtNum* body_invweight0; // mean inv inert in qpos0 (trn, rot) (nbody x 2)
mjtNum* body_gravcomp; // antigravity force, units of body weight (nbody x 1)
mjtNum* body_user; // user data (nbody x nuser_body)
int* body_plugin; // plugin instance id (-1 if not in use) (nbody x 1)
+5
View File
@@ -1690,6 +1690,11 @@ defined. Its body name is automatically defined as "world".
unit quaternion, thus specifying it is optional even in local coordinates. If the body frame was copied from the body
inertial frame per the above rules, the copy operation applies to both position and orientation, and the setting of
the orientation-related attributes is ignored.
:at:`gravcomp`: :at-val:`real, "0"`
Gravity compensation force, specified as fraction of body weight. This attribute creates an upwards force applied to
the body's center of mass, countering the force of gravity. As an example, a value of ``1`` creates an upward force
equal to the body's weight and compensates for gravity exactly. Values greater than ``1`` will create a net upwards
force or buoyancy effect.
:at:`user`: :at-val:`real(nbody_user), "0 0 ..."`
See :ref:`CUser`.
+1 -1
View File
@@ -585,7 +585,7 @@
| | | +-------------------------+-------------------------+-------------------------+ |
| | | | :at:`xyaxes` | :at:`zaxis` | :at:`euler` | |
| | | +-------------------------+-------------------------+-------------------------+ |
| | | | :at:`user` | | | |
| | | | :at:`gravcomp` | :at:`user` | | |
| | | +-------------------------+-------------------------+-------------------------+ |
+--------------------------+----+------------------------------------------------------------------------------------+
| |_2|:el:`plugin` | \* | .. table:: |
+6
View File
@@ -21,8 +21,14 @@ General
This is a minor breaking API change. ``mjModel.tendon_lengthspring`` now has size ``ntendon x 2`` rather than
``ntendon x 1``.
.. youtube:: -PJ6afdETUg
:align: right
:height: 150px
- Removed the requirement that stateless actuators come before stateful actuators.
- Added :ref:`mju_fill`, :ref:`mju_symmetrize` and :ref:`mju_eye` utility functions.
- Added :at:`gravcomp` attribute to :ref:`body<body>`, implementing gravity compensation and bouyancy.
See `balloons.xml <https://github.com/deepmind/mujoco/tree/main/model/balloons/balloons.xml>`_ example model.
Version 2.3.0 (October 18, 2022)
--------------------------------
+12 -7
View File
@@ -359,17 +359,22 @@ by MuJoCo are also passive in the sense of physics, i.e., they do not increase e
callback :ref:`mjcb_passive` and add forces to ``mjData.qfrc_passive`` that may increase energy. This will not interfere
with MuJoCo's operation as long as such user forces depend only on position and velocity.
MuJoCo can compute two types of passive forces: spring-dampers in joints and tendons, and fluid dynamics. When Euler
integration is used, joint damping is integrated implicitly (by modifying the inertia matrix internally) which
significantly increases stability. Thus, even though damping can be alternatively modeled as an actuator property, it is
better to model it as a joint property. Note also the XML :ref:`joint <body-joint>` attribute springdamper which
automates the creation of mass-spring-dampers with desired time constants and damping ratios; in that case the compiler
computes the stiffness and damping coefficients of the joint by taking the joint inertia into account.
MuJoCo can compute three types of passive forces: spring-dampers in joints and tendons, gravity compensation forces, and
fluid dynamics.
When Euler or the implicit integator are used, joint damping is integrated implicitly which significantly increases
stability. Thus, even though damping can be modeled as an actuator property, it is better to model it as a joint
property. Note also the XML :ref:`joint <body-joint>` attribute springdamper which automates the creation of mass-
spring-dampers with desired time constants and damping ratios; in that case the compiler computes the stiffness and
damping coefficients of the joint by taking the joint inertia into account.
Gravity compensation is a force applied to a body's center of mass opposing gravity, see :ref:`body gravcomp<body>` for
details.
Proper simulation of fluid dynamics is beyond the scope of MuJoCo, and would be too slow for the applications we aim to
facilitate. Nevertheless we provide a phenomenological model which is sufficient for simulating behaviors such as flying
and swimming. It is enabled by setting ``mjModel.opt.viscosity`` and ``mjModel.opt.density`` to positive values (they
are zero by default.) These parameters specify the viscosity :math:`\beta` and density :math:`\rho` of the medium and
are zero by default). These parameters specify the viscosity :math:`\beta` and density :math:`\rho` of the medium and
apply to all bodies. The shape of each body for fluid dynamics purposes is assumed to be the equivalent inertia box,
which can also be visualized. Each forward-facing (relative to the linear velocity) face of the box experiences force
along its normal direction. All faces also experience torque due to the angular velocity; this torque is obtained by