Add frame element to MJCF.
PiperOrigin-RevId: 585598244 Change-Id: I4c06be3dd586dab5a4458f05faaf1e7f2b615458
This commit is contained in:
committed by
Copybara-Service
parent
8010aad7be
commit
eb9568a48b
+90
-2
@@ -103,13 +103,72 @@ In the remainder of this chapter we describe all valid MJCF elements and their a
|
||||
multiple contexts, in which case their meaning depends on the parent element. This is why we always show the parent as a
|
||||
prefix in the documentation below.
|
||||
|
||||
.. _meta-element:
|
||||
|
||||
Meta elements
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
These elements are not strictly part of the low-level MJCF format definition, but rather instruct the compiler to
|
||||
perform some operation on the model. A general property of meta-elements is that they disappear from the model upon
|
||||
saving the XML. There are currently four meta-elements in MJCF:
|
||||
|
||||
- :ref:`include<include>` and :ref:`frame<frame>`, which are outside of the schema.
|
||||
- :ref:`composite<body-composite>` and :ref:`flexcomp<body-flexcomp>` which are part of the schema, but serve to
|
||||
procedurally generate other MJCF elements.
|
||||
|
||||
.. _frame:
|
||||
|
||||
**frame** (R)
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
The frame meta-element is a pure coordinate transformation that can wrap any group of elements in the kinematic tree
|
||||
(under :ref:`worldbody<body>`). After compilation, frame elements disappear and their transformation is accumulated
|
||||
in their direct children. The attributes of the frame meta-element are documented :ref:`below<body-frame>`.
|
||||
|
||||
.. collapse:: Usage example of frame
|
||||
|
||||
Loading this model and saving it:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<mujoco>
|
||||
<worldbody>
|
||||
<frame quat="0 0 1 0">
|
||||
<geom name="Alice" quat="0 1 0 0" size="1"/>
|
||||
</frame>
|
||||
|
||||
<frame pos="0 1 0">
|
||||
<geom name="Bob" pos="0 1 0" size="1"/>
|
||||
<body name="Carl" pos="1 0 0">
|
||||
...
|
||||
</body>
|
||||
</frame>
|
||||
</worldbody>
|
||||
</mujoco>
|
||||
|
||||
Results in this model:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<mujoco>
|
||||
<worldbody>
|
||||
<geom name="Alice" quat="0 0 0 1" size="1"/>
|
||||
<geom name="Bob" pos="0 2 0" size="1"/>
|
||||
<body name="Carl" pos="1 1 0">
|
||||
...
|
||||
</body>
|
||||
</worldbody>
|
||||
</mujoco>
|
||||
|
||||
Note that in the saved model, the frame elements have disappeared but their transformation was accumulated with those
|
||||
of their child elements.
|
||||
|
||||
.. _include:
|
||||
|
||||
**include** (*)
|
||||
~~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^^
|
||||
|
||||
This element does not strictly speaking belong to MJCF. Instead it is a meta-element, used to assemble multiple XML
|
||||
This element does not strictly belong to MJCF. Instead it is a meta-element, used to assemble multiple XML
|
||||
files in a single document object model (DOM) before parsing. The included file must be a valid XML file with a unique
|
||||
top-level element. This top-level element is removed by the parser, and the elements below it are inserted at the
|
||||
location of the :el:`include` element. At least one element must be inserted as a result of this procedure. The
|
||||
@@ -3913,6 +3972,35 @@ Associate this flexcomp with an :ref:`engine plugin<exPlugin>`. Either :at:`plug
|
||||
:at:`instance`: :at-val:`string, optional`
|
||||
Instance name, used for explicit plugin instantiation.
|
||||
|
||||
|
||||
.. _body-frame:
|
||||
|
||||
:el-prefix:`body/` |-| **frame** (*)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Frames specify a coordinate transformation which is applied to all child elements. They disappear during compilation
|
||||
and the transformation they encode is accumulated in their direct children. See :ref:`frame<frame>` for examples.
|
||||
|
||||
.. _frame-pos:
|
||||
|
||||
:at:`pos`: :at-val:`real(3), "0 0 0"`
|
||||
The 3D position of the frame, in the parent coordinate system.
|
||||
|
||||
.. _frame-quat:
|
||||
|
||||
.. _frame-axisangle:
|
||||
|
||||
.. _frame-xyaxes:
|
||||
|
||||
.. _frame-zaxis:
|
||||
|
||||
.. _frame-euler:
|
||||
|
||||
:at:`quat`, :at:`axisangle`, :at:`xyaxes`, :at:`zaxis`, :at:`euler`
|
||||
See :ref:`COrientation`.
|
||||
|
||||
|
||||
|
||||
.. _contact:
|
||||
|
||||
**contact** (*)
|
||||
|
||||
+2
-1
@@ -7,10 +7,11 @@ Upcoming version (not yet released)
|
||||
|
||||
General
|
||||
^^^^^^^
|
||||
|
||||
- Improved convergence of Signed Distance Function (SDF) collisions by using line search and a new objective function
|
||||
for the optimization. This allows to decrease the number of initial points needed for finding the contacts and is more
|
||||
robust for very small or large geom sizes.
|
||||
- Added :ref:`frame<frame>` to MJCF, a :ref:`meta-element<meta-element>` which defines a pure coordinate transformation
|
||||
on its direct children, without requiring a :ref:`body<body>`.
|
||||
|
||||
Plugins
|
||||
^^^^^^^
|
||||
|
||||
+8
-3
@@ -204,16 +204,21 @@ cameras and lights.
|
||||
A related attribute is :ref:`compiler/angle<compiler-angle>`. It specifies whether angles in the MJCF file are expressed
|
||||
in degrees or radians (after compilation, angles are always expressed in radians).
|
||||
|
||||
Positions are specified using
|
||||
|
||||
:at:`pos`: :at-val:`real(3), "0 0 0"`
|
||||
Position relative to parent.
|
||||
|
||||
.. _COrientation:
|
||||
|
||||
Frame orientations
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Several model elements have right-handed spatial frames associated with them. These are all the elements defined in the
|
||||
kinematic tree except for joints. A spatial frame is defined by its position and orientation. Specifying 3D positions is
|
||||
straightforward, but specifying 3D orientations can be challenging. This is why MJCF provides several alternative
|
||||
mechanisms. No matter which mechanism the user chooses, the frame orientation is always represented as a unit quaternion
|
||||
after compilation. Recall that a 3D rotation by angle :math:`a` around axis given by the unit vector :math:`(x, y, z)`
|
||||
mechanisms. No matter which mechanism the user chooses, the frame orientation is always converted internally to a unit
|
||||
quaternion. Recall that a 3D rotation by angle :math:`a` around axis given by the unit vector :math:`(x, y, z)`
|
||||
corresponds to the quaternion :math:`(\cos(a/2), \: \sin(a/2) \cdot (x, y, z))`. Also recall that every 3D orientation
|
||||
can be uniquely specified by a single 3D rotation by some angle around some axis.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user