Skip to content

Commit 3577e2c

Browse files
committed
Version 2.1.2: Python bindings, OBJ assets support, bugfixes.
PiperOrigin-RevId: 434731612 Change-Id: I0cfda3e7a3d1c72036764986efc252ffa1b8c6b0
1 parent 175d25c commit 3577e2c

File tree

304 files changed

+23909
-1016
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

304 files changed

+23909
-1016
lines changed

doc/APIreference.rst

Lines changed: 137 additions & 53 deletions
Large diffs are not rendered by default.

doc/XMLreference.rst

Lines changed: 96 additions & 66 deletions
Large diffs are not rendered by default.

doc/changelog.rst

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,83 @@
22
Changelog
33
=========
44

5+
Version 2.1.2 (Date TBD, 2022)
6+
------------------------------
7+
8+
New modules
9+
^^^^^^^^^^^
10+
11+
1. Added new :doc:`Python bindings<python>`, which can be installed via ``pip install mujoco``,
12+
and imported as ``import mujoco``.
13+
#. Added new :doc:`Unity plug-in<unity>`.
14+
#. Added a new ``introspect`` module, which provides reflection-like capability for MuJoCo's public API, currently
15+
describing functions and enums. While implemented in Python, this module is expected to be generally useful for
16+
automatic code generation targeting multiple languages. (This is not shipped as part of the ``mujoco`` Python
17+
bindings package.)
18+
19+
API changes
20+
^^^^^^^^^^^
21+
22+
4. Moved definition of ``mjtNum`` floating point type into a new header
23+
`mjtnum.h <https://github.com/deepmind/mujoco/blob/main/include/mjtnum.h>`_.
24+
#. Renamed header `mujoco_export.h` to :ref:`mjexport.h<inHeader>`.
25+
#. Added ``mj_printFormattedData``, which accepts a format string for floating point numbers, for example to increase
26+
precision.
27+
28+
General
29+
^^^^^^^
30+
31+
7. MuJoCo can load `OBJ <https://en.wikipedia.org/wiki/Wavefront_.obj_file>`_ mesh files.
32+
33+
a. Meshes containing polygons with more than 4 vertices are not supported.
34+
#. In OBJ files containing multiple object groups, any groups after the first one will be ignored.
35+
36+
#. Added optional frame-of-reference specification to :ref:`framepos<sensor-framepos>`,
37+
:ref:`framequat<sensor-framequat>`, :ref:`framexaxis<sensor-framexaxis>`, :ref:`frameyaxis<sensor-frameyaxis>`,
38+
:ref:`framezaxis<sensor-framezaxis>`, :ref:`framelinvel<sensor-framelinvel>`, and
39+
:ref:`frameangvel<sensor-frameangvel>` sensors. The frame-of-reference is specified by new :at:`reftype` and
40+
:at:`refname` attributes.
41+
42+
#. Sizes of :ref:`user parameters <CUser>` are now automatically inferred.
43+
44+
a. Declarations of user parameters in the top-level :ref:`size <size>` clause (e.g. :at:`nuser_body`,
45+
:at:`nuser_jnt`, etc.) now accept a value of -1, which is the default. This will automatically set the value to
46+
the length of the maximum associated :at:`user` attribute defined in the model.
47+
#. Setting a value smaller than -1 will lead to a compiler error (previously a segfault).
48+
#. Setting a value to a length smaller than some :at:`user` attribute defined in the model will lead to an error
49+
(previously additional values were ignored).
50+
51+
#. Increased the maximum number of lights in an :ref:`mjvScene` from 8 to 100.
52+
53+
#. Saved XML files only contain explicit :ref:`inertial <inertial>` elements if the original XML included them. Inertias
54+
that were automatically inferred by the compiler's :ref:`inertiafromgeom <compiler>` mechanism remain unspecified.
55+
56+
#. User-selected geoms are always rendered as opaque. This is useful in interactive visualizers.
57+
58+
#. Static geoms now respect their :ref:`geom group<geom>` for visualisation. Until this change rendering of static geoms
59+
could only be toggled using the :ref:`mjVIS_STATIC<mjtVisFlag>` visualisation flag . After this change, both the geom
60+
group and the visualisation flag need to be enabled for the geom to be rendered.
61+
62+
#. Pointer parameters in function declarations in :ref:`mujoco.h<inHeader>` that are supposed to represent fixed-length
63+
arrays are now spelled as arrays with extents, e.g. ``mjtNum quat[4]`` rather than ``mjtNum* quat``. From the
64+
perspective of C and C++, this is a non-change since array types in function signatures decay to pointer types.
65+
However, it allows autogenerated code to be aware of expected input shapes.
66+
67+
Bug Fixes
68+
^^^^^^^^^
69+
70+
15. ``mj_loadXML`` and ``mj_saveLastXML`` are now locale-independent. The Unity plugin should now work correctly for
71+
users whose system locales use commas as decimal separators.
72+
#. XML assets in VFS no longer need to end in a null character. Instead, the file size is determined by the size
73+
parameter of the corresponding VFS entry.
74+
#. Fix a vertex buffer object memory leak in ``mjrContext`` when skins are used.
75+
#. Camera quaternions are now normalized during XML compilation.
76+
77+
Binary build
78+
^^^^^^^^^^^^
79+
80+
18. Windows binaries are now built with Clang.
81+
582
Version 2.1.1 (Dec. 16, 2021)
683
-----------------------------
784

@@ -45,7 +122,7 @@ Bug Fixes
45122
:ref:`weld <equality-weld>` constraints.
46123

47124
.. note::
48-
Forces generated by :ref:`spatial tendons <spatial>` which are outside the kinematic tree (i.e. between bodies
125+
Forces generated by :ref:`spatial tendons <spatial>` which are outside the kinematic tree (i.e., between bodies
49126
which have no ancestral relationship) are still not taken into account by force and torque sensors. This remains a
50127
future work item.
51128

@@ -118,7 +195,7 @@ New features
118195
General
119196
^^^^^^^
120197

121-
3. The pre-allocated sizes in the virtual file system (VFS) increased to 2000 and 1000, to allow for larger projects.
198+
3. The preallocated sizes in the virtual file system (VFS) increased to 2000 and 1000, to allow for larger projects.
122199
#. The C structs in the ``mjuiItem`` union are now named, for compatibility.
123200
#. Fixed: ``mjcb_contactfilter`` type is ``mjfConFilt`` (was ``mjfGeneric``).
124201
#. Fixed: The array of sensors in ``mjCModel`` was not cleared.

doc/computation.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ change at runtime. In that case there is still a fixed enumeration order (corres
189189
elements appear in ``mjModel``) but any inactive constraints are omitted.
190190

191191
The number of position coordinates :math:`n_Q` is larger than the number of degrees of freedom :math:`n_V` whenever
192-
quaternions are used to represent 3D orientations. This occurs when the model contains ball joints or free joints (i.e.
192+
quaternions are used to represent 3D orientations. This occurs when the model contains ball joints or free joints (i.e.,
193193
in most models). In that case :math:`\dot{q}` does not equal :math:`v`, at least not in the usual sense. Instead one has
194194
to consider the group of rigid body orientations :math:`SO(3)` - which has the geometry of a unit sphere in 4D space.
195195
Velocities live in the 3D tangent space to this sphere. This is taken into account by all internal computations. For
@@ -326,7 +326,7 @@ Passive forces
326326
Passive forces are defined as forces that depend only on position and velocity, and not on control in forward dynamics
327327
or acceleration in inverse dynamics. As a result, such forces are inputs to both the forward and inverse dynamics
328328
computations, and are identical in both cases. They are stored in ``mjData.qfrc_passive``. The passive forces computed
329-
by MuJoCo are also passive in the sense of physics, i.e. they do not increase energy, however the user can install the
329+
by MuJoCo are also passive in the sense of physics, i.e., they do not increase energy, however the user can install the
330330
callback :ref:`mjcb_passive` and add forces to ``mjData.qfrc_passive`` that may increase energy. This will not interfere
331331
with MuJoCo's operation as long as such user forces depend only on position and velocity.
332332

@@ -460,7 +460,7 @@ constraint contributes :math:`\dim(r)` elements to the total constraint count :m
460460
properties of quaternions, differentiation with respect to :math:`q` produces vectors of size :math:`n_V` rather than
461461
:math:`n_Q`.
462462

463-
Among other applications, equality constraints can be used to create "loop joints", i.e. joints that cannot be modeled
463+
Among other applications, equality constraints can be used to create "loop joints", i.e., joints that cannot be modeled
464464
via the kinematic tree. Gaming engines represent all joints in this way. The same can be done in MuJoCo but is not
465465
recommended - because it leads to both slower and less accurate simulation, effectively turning MuJoCo into a gaming
466466
engine. The only reason to represent joints with equality constraints would be to model soft joints - which can be done
@@ -562,7 +562,7 @@ with a 1 at the joint address. For tendons this is known as the moment arm vecto
562562
spatial tendons this could be used to model friction between the tendon and the surfaces it wraps around. Such
563563
friction will be load-independent though. To construct a more detailed model of this phenomenon, create several small
564564
floating spheres and connect them with tendons in series. Then the contacts between the spheres and the surrounding
565-
surfaces will have load-dependent (i.e. Coulomb) friction, but this is less efficient to simulate.
565+
surfaces will have load-dependent (i.e., Coulomb) friction, but this is less efficient to simulate.
566566

567567
.. _coLimit:
568568

@@ -588,7 +588,7 @@ because solving for equality constraint forces is generally faster.
588588
``joint`` : 1 or 2
589589
Limits can be defined for scalar joints (hinge and slide) as well as for ball joints. Scalar joints are treated as
590590
described above. Ball joint limits are applied to the exponential-map or angle-axis representation of the joint
591-
quaternion, i.e. the vector :math:`(\theta x, \theta y, \theta z)` where :math:`\theta` is the rotation angle and
591+
quaternion, i.e., the vector :math:`(\theta x, \theta y, \theta z)` where :math:`\theta` is the rotation angle and
592592
:math:`(x, y, z)` is the unit vector corresponding to the rotation axis. The limit is applied to the absolute value
593593
of the rotation angle :math:`\theta`. At runtime the limit is determined by the larger of the two range parameters.
594594
For semantic clarity however, one should use the second range parameter to specify the limit and set the first range
@@ -1022,7 +1022,7 @@ compute it.
10221022

10231023
Note that the quadratic term in the inverse problem is weighted by :math:`R` instead of :math:`A+R`. This tells us two
10241024
things. First, in the limit :math:`R \to 0` corresponding to hard constraints the inverse is no longer defined, as one
1025-
would expect. Second and more useful, the inverse problem is diagonal, i.e. it decouples into independent optimization
1025+
would expect. Second and more useful, the inverse problem is diagonal, i.e., it decouples into independent optimization
10261026
problems over the individual constraint forces. The only remaining coupling is due to the constraint set :math:`\Omega`,
10271027
but that set is also decoupled over the conceptual constraints discussed earlier. It turns out that all these
10281028
independent optimization problems can be solved analytically. The only non-trivial case is the elliptic friction cone
@@ -1110,7 +1110,7 @@ Substituting :math:`f^+` in the constraint dynamics :eq:`eq:identity` and rearra
11101110
11111111
Thus the constrained acceleration interpolates between the unconstrained and the reference acceleration. In particular,
11121112
in the limit :math:`R \to 0` we have a hard constraint and :math:`a^1 = a^*`, while in the limit :math:`R \to \infty` we
1113-
have have an infinitely soft constraint (i.e. no constraint) and :math:`a^1 = a^0`. It is then natural to introduce a
1113+
have have an infinitely soft constraint (i.e., no constraint) and :math:`a^1 = a^0`. It is then natural to introduce a
11141114
model parameter which directly controls the interpolation. We call this parameter *impedance* and denote it :math:`d`.
11151115
It is a vector with dimensionality :math:`n_C` satisfying :math:`0<d<1` element-wise. Once it is specified, we compute
11161116
the diagonal elements of the regularizer as

doc/conf.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Copyright 2021 DeepMind Technologies Limited
1+
# Copyright 2021 DeepMind Technologies Limited
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -8,13 +8,11 @@
88
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,
11-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
"""Configuration file for the Sphinx documentation builder."""
1515

16-
import doctest
17-
import inspect
1816
import os
1917
import sys
2018

doc/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
XMLreference
1414
programming
1515
APIreference
16+
python
1617
unity
1718
changelog

0 commit comments

Comments
 (0)