Multi-Joint dynamics with Contact. A general purpose physics simulator.
See the changelog.
See the changelog.
See the changelog.
See the changelog.
See the changelog.
See the changelog.
Added simulation on GPU and TPU via the new MuJoCo XLA (MJX) Python module. Python users can now natively run MuJoCo simulations at millions of steps per second on Google TPU or their own accelerator hardware.
Added new signed distance field (SDF) collision primitive. SDFs can take any shape and are not constrained to be convex. Collision points are found by minimizing the maximum of the two colliding SDFs via gradient descent.
Added new low-level model element called flex
, used to define deformable objects. These simplicial complexes can be of dimension 1, 2 or 3, corresponding to stretchable lines, triangles or tetrahedra. Two new MJCF elements are used to define flexes. The top-level deformable section contains the low-level flex definition. The flexcomp element, similar to composite is a convenience macro for creating deformables, and supports the GMSH tetrahedral file format.
Added shell passive force plugin, computing bending forces using a constant precomputed Hessian (cotangent operator).
Note: This feature is still under development and subject to change. In particular, deformable object functionality is currently available both via deformable and composite, and both are modifiable by the first-party elasticity plugins. We expect some of this functionality to be unified in the future.
Added constraint island discovery with mj_island
. Constraint islands are disjoint sets of constraints and degrees-of-freedom that do not interact. The only solver which currently supports islands is CG. Island discovery can be activated using a new enable flag. If island discovery is enabled, geoms, contacts and tendons will be colored according to the corresponding island, see video. Island discovery is currently disabled for models that have deformable objects (see previous item).
Added mjThreadPool
and mjTask
which allow for multi-threaded operations within the MuJoCo engine pipeline. If engine-internal threading is enabled, the following operations will be multi-threaded:
Engine-internal threading is a work in progress and currently only available in first-party code via the testspeed utility, exposed with the npoolthread
flag.
Added capability to initialize composite
particles from OBJ files. Fixes #642 and #674.
[!IMPORTANT] Breaking API changes
Removed the macros
mjMARKSTACK
andmjFREESTACK
.Migration: These macros have been replaced by new functions
mj_markStack
andmj_freeStack
. These functions manage themjData
stack in a fully encapsulated way (i.e., without introducing a local variable at the call site).Renamed
mj_stackAlloc
tomj_stackAllocNum
. The new functionmj_stackAllocByte
allocates an arbitrary number of bytes and has an additional argument for specifying the alignment of the returned pointer.Migration: The functionality for allocating
mjtNum
arrays is now available viamj_stackAllocNum
.Renamed the
nstack
field inmjModel
andmjData
tonarena
. Changednarena
,pstack
, andmaxuse_stack
to count number of bytes rather than number ofmjtNum
s.Changed
mjData.solver
, the array used to collect solver diagnostic information. This array ofmjSolverStat
structs is now of lengthmjNISLAND * mjNSOLVER
, interpreted as as a matrix. Each row of lengthmjNSOLVER
contains separate solver statistics for each constraint island. If the solver does not use islands, only row 0 is filled.
- The new constant
mjNISLAND
was set to 20.mjNSOLVER
was reduced from 1000 to 200.- Added
mjData.solver_nisland
: the number of islands for which the solver ran.- Renamed
mjData.solver_iter
tosolver_niter
. Both this member andmjData.solver_nnz
are now integer vectors of lengthmjNISLAND
.Removed
mjOption.collision
and the associatedoption/collision
attribute.Migration:
- For models which have
<option collision="all"/>
, delete the attribute.- For models which have
<option collision="dynamic"/>
, delete allpair
elements.- For models which have
<option collision="pair"/>
, disable all dynamic collisions (determined via contype/conaffinity) by first deleting allcontype
andconaffinity
attributes in the model and then setting them globally to0
using<default> <geom contype="0" conaffinity="0"/> </default>
.Removed the
rope
andcloth
composite objects.Migration: Users should use the
cable
andshell
elasticity plugins.Added
mjData.eq_active
user input variable, for enabling/disabling the state of equality constraints. RenamedmjModel.eq_active
tomjModel.eq_active0
, which now has the semantic of "initial value ofmjData.eq_active
". Fixes #876.Migration: Replace uses of
mjModel.eq_active
withmjData.eq_active
.Changed the default of
autolimits
from "false" to "true". This is a minor breaking change. The potential breakage applies to models which have elements with "range" defined and "limited" not set. Such models cannot be loaded since version 2.2.2 (July 2022).
Added a new dyntype
, filterexact
, which updates first-order filter states with the exact formula rather than with Euler integration.
Added an actuator attribute, actearly
, which uses semi-implicit integration for actuator forces: using the next step's actuator state to compute the current actuator forces.
Renamed actuatorforcerange
and actuatorforcelimited
, introduced in the previous version to actuatorfrcrange
and actuatorfrclimited
, respectively.
Added the flag eulerdamp
, which disables implicit integration of joint damping in the Euler integrator. See the Numerical Integration section for more details.
Added the flag invdiscrete
, which enables discrete-time inverse dynamics for all integrators other than RK4
. See the flag documentation for more details.
Added ls_iterations
and ls_tolerance
options for adjusting linesearch stopping criteria in CG and Newton solvers. These can be useful for performance tuning.
Added mesh_pos
and mesh_quat
fields to mjModel
to store the normalizing transformation applied to mesh assets. Fixes #409.
Added camera resolution
attribute and camprojection
sensor. If camera resolution is set to positive values, the camera projection sensor will report the location of a target site, projected onto the camera image, in pixel coordinates.
Added camera
calibration attributes:
resolution
, focal
, focalpixel
, principal
, principalpixel
and sensorsize
.mjVIS_CAMERA
visualization flag when these attributes are specified. See the following example model.Implemented reversed Z rendering for better depth precision. An enum mjtDepthMap
was added with values mjDEPTH_ZERONEAR
and mjDEPTH_ZEROFAR
, which can be used to set the new readDepthMap
attribute in mjrContext
to control how the depth returned by mjr_readPixels
is mapped from znear
to zfar
. Contribution #978 by @aftersomemath.
Deleted the code sample testxml
. The functionality provided by this utility is implemented in the WriteReadCompare test.
Deleted the code sample derivative
. Functionality provided by mjd_transitionFD
.
update_scene
with an invalid camera name used the default camera.user_scn
to the passive viewer handle, which allows users to add custom visualization geoms (#1023).show_left_ui
and show_right_ui
to the functions viewer.launch
and viewer.launch_passive
, which allow users to launch a viewer with UI panels hidden.Added state history mechanism to simulate
and the managed Python viewer. State history can be viewed by scrubbing the History slider and (more precisely) with the left and right arrow keys.
The LOADING...
label is now shown correctly. Contribution #1070 by @aftersomemath.
Fixed a bug that was causing geom margin to be ignored during the construction of midphase collision trees.
Fixed a bug that was generating incorrect values in efc_diagApprox
for weld equality constraints.
joint-actuatorforcerange
for clamping total actuator force at joints and sensor-jointactuatorfrc<sensor-jointactuatorfrc>
for measuring total actuation force applied at a joint. The most important use case for joint-level actuator force clamping is to ensure that Cartesian actuator forces are realizable by individual motors at the joints. See Actuator force clamping for details.content_type
attribute to hfield
, texture
, and mesh
assets. This attribute supports a formatted Media Type (previously known as MIME type) string used to determine the type of the asset file without resorting to pulling the type from the file extension.mjv_connector
which has identical functionality to mjv_makeConnector
, but with more convenient "from-to" argument parametrization. mjv_makeConnector
is now deprecated.update_hfield
, update_mesh
, and update_texture
methods to allow users to update renderable assets. (#812 , #958, #965)NOTE: MuJoCo 2.3.6 is the last version to officially support Python 3.7.
shellinertia
is equal to true
.mj_ray
, in line with geom visualisation conventions:
geom_group
and flg_static
arguments. Before this change, rays would intersect planes and height-fields unconditionally.flg_static
now applies to all static geoms, not just those which are direct children of the world body.visual
MJCF element. After modifying values in the GUI, a saved XML will contain the new values. The modifiable members of mjStatistic
(extent
, meansize
and center
) are computed by the compiler and therefore do not have defaults. In order for these attributes to appear in the saved XML, a value must be specified in the loaded XML.mj_getState
and mj_setState
for getting and setting the simulation state as a concatenated vector of floating point numbers. See the State section for details.mjContact.solreffriction
, allowing different solref
parameters for the normal and frictional axes of contacts when using elliptic friction cones. This attribute is required for elastic frictional collisions, see associated example model mimicking the spin-bounce recoil behaviour of elastic rubber balls. This is an advanced option currently only supported by explicit contact pairs, using the solreffriction
attribute.mjd_inverseFD
for finite-differenced inverse-dynamics derivatives.mju_cholFactorBand
documentation for details.mj_multiRay
function for intersecting multiple rays emanating from a single point. This is significantly faster than calling mj_ray
multiple times.mjMAXUIITEM
(maximum number of UI elements per section in Simulate) to 100.mju_sigmoid
, a finite-support sigmoid $s: \mathbf{R} \rightarrow [0, 1]$. Previously, the smooth part consisted of two stitched quadratics, once continuously differentiable. It is now a single quintic, twice continuously differentiable:$$ s(x) = \begin{cases} 0, & & x \le 0 \ 6x^5 - 15x^4 + 10x^3, & 0 \lt & x \lt 1 \ 1, & 1 \le & x \qquad \end{cases} $$
tausmooth
attribute to muscle actuators. When positive, the time-constant $\tau$ of muscle activation/deactivation uses mju_sigmoid
to transition smoothly between the two extremal values given by the Millard et al. (2013) muscle model, within a range of width tausmooth
. See Muscle actuators for more details. Relatedly, mju_muscleDynamics
now takes 3 parameters instead of 2, adding the new smoothing-width parameter.pstack
and parena
from the output of mj_printData
, since these are implementation details of the mjData
allocators that are affected by diagnostic paddings in instrumented builds.mj_activate
and mj_deactivate
functions. These had been kept around for compatibility with old user code from when MuJoCo was closed source, but have been no-op functions since open sourcing.Fix asset loading bug that prevented OBJ and PNG files from being read from disk when mjVFS
is used.
Fix occasional segmentation faults on macOS when mouse perturbations are applied in the Python passive viewer.