# Changelog

## Upcoming version (not yet released)

### General

• The contact array and arrays prefixed with efc_ in mjData were moved out of the buffer into a new arena memory space. These arrays are no longer allocated with fixed sizes when mjData is created. Instead, the exact memory requirement is determined during each call to mj_forward (specifically, in mj_collision and mj_makeConstraint) and the arrays are allocated from the arena space. The stack now also shares its available memory with arena. This change reduces the memory footprint of mjData in models that do not use the PGS solver, and will allow for significant memory reductions in the future. See the Memory allocation section for details.

• Added colab notebook tutorial showing how to balance the humanoid on one leg with a Linear Quadratic Regulator. The notebook uses MuJoCo’s native Python bindings, and includes a draft Renderer class, for easy rendering in Python.
Try it yourself:

• Updates to humanoid model:

• Added two keyframes (stand-on-one-leg and squat).

• Increased maximum hip flexion angle.

• Added hamstring tendons which couple the hip and knee at high hip flexion angles.

• General cosmetic improvements, including improved use of defaults and better naming scheme.

• Added mju_boxQP and allocation function mju_boxQPmalloc for solving the box-constrained Quadratic Program:

$x^* = \text{argmin} \; \tfrac{1}{2} x^T H x + x^T g \quad \text{s.t.} \quad l \le x \le u$

The algorithm, introduced in Tassa et al. 2014, converges after 2-5 Cholesky factorisations, independent of problem size.

• Added mju_mulVecMatVec to multiply a square matrix $$M$$ with vectors $$x$$ and $$y$$ on both sides. The function returns $$x^TMy$$.

• Added new plugin API. Plugins allow developers to extend MuJoCo’s capability without modifying core engine code. The plugin mechanism is intended to replace the existing callbacks, though these will remain for the time being as an option for simple use cases and backward compatibility. The new mechanism manages stateful plugins and supports multiple plugins from different sources, allowing MuJoCo extensions to be introduced in a modular fashion, rather than as global overrides. Note the new mechanism is currently undocumented except in code, as we test it internally. If you are interested in using the plugin mechanism, please get in touch first.

• Added assetdir compiler option, which sets the values of both meshdir and texturedir. Values in the latter attributes take precedence over assetdir.

• Added realtime option to visual (*) for starting a simulation at a slower speed.

### Python bindings

• Added id and name properties to named accessor objects. These provide more Pythonic API access to mj_name2id and mj_id2name respectively.

• The length of MjData.contact is now ncon rather than nconmax, allowing it to be straightforwardly used as an iterator without needing to check ncon.

## Version 2.2.2 (September 7, 2022)

### General

1. Added adhesion actuators mimicking vacuum grippers and adhesive biomechanical appendages.

2. Added related example model and video:

3. Added mj_jacSubtreeCom for computing the translational Jacobian of the center-of-mass of a subtree.

4. Added torquescale and anchor attributes to weld constraints. torquescale sets the torque-to-force ratio exerted by the constraint, anchor sets the point at which the weld wrench is applied. See weld for more details.

5. Increased mjNEQDATA, the row length of equality constraint parameters in mjModel.eq_data, from 7 to 11.

6. Added visualisation of anchor points for both connect and weld constraints (activated by the ‘N’ key in simulate).

7. Added weld.xml showing different uses of new weld attributes.

8. Cartesian 6D end-effector control is now possible by adding a reference site to actuators with site transmission. See description of new refsite attribute in the actuator documentation and refsite.xml example model.

9. Added autolimits compiler option. If true, joint and tendon limited attributes and actuator ctrllimited, forcelimited and actlimited attributes will automatically be set to true if the corresponding range is defined and false otherwise.

If autolimits="false" (the default) models where a range attribute is specified without the limited attribute will fail to compile. A future release will change the default of autolimits to true, and this compilation error allows users to catch this future change of behavior.

Attention

This is a breaking change. In models where a range was defined but limited was unspecified, explicitly set limited to false or remove the range to maintain the current behavior of your model.

10. Added moment of inertia computation for all well-formed meshes. This option is activated by setting the compiler flag exactmeshinertia to true (defaults to false). This default may change in the future.

11. Added parameter shellinertia to geom, for locating the inferred inertia on the boundary (shell). Currently only meshes are supported.

12. For meshes from which volumetric inertia is inferred, raise error if the orientation of mesh faces is not consistent. If this occurs, fix the mesh in e.g., MeshLab or Blender.

13. Added catenary visualisation for hanging tendons. The model seen in the video can be found here.

14. Added azimuth and elevation attributes to visual/global, defining the initial orientation of the free camera at model load time.

15. Added mjv_defaultFreeCamera which sets the default free camera, respecting the above attributes.

16. simulate now supports taking a screenshot via a button in the File section or via Ctrl-P.

17. Improvements to time synchronisation in simulate, in particular report actual real-time factor if different from requested factor (if e.g., the timestep is so small that simulation cannot keep up with real-time).

18. Added a disable flag for sensors.

19. mju_mulQuat and mju_mulQuatAxis support in place computation. For example
mju_mulQuat(a, a, b); sets the quaternion a equal to the product of a and b.

20. Added sensor matrices to mjd_transitionFD (note this is an API change).

### Deleted/deprecated features

1. Removed distance constraints.

### Bug fixes

1. Fixed rendering of some transparent geoms in reflection.

2. Fixed intvelocity defaults parsing.

## Version 2.2.1 (July 18, 2022)

### General

1. Added mjd_transitionFD to compute efficient finite difference approximations of the state-transition and control-transition matrices, see here for more details.

2. Added derivatives for the ellipsoid fluid model.

3. Added ctrl attribute to keyframes.

4. Added clock sensor which measures time.

5. Added visualisation groups to skins.

6. Added actuator visualisation for free and ball joints and for actuators with site transmission.

7. Added visualisation for actuator activations.

8. Added <intvelocity> actuator shortcut for “integrated velocity” actuators, documented here.

9. Added <damper> actuator shortcut for active-damping actuators, documented here.

10. mju_rotVecMat and mju_rotVecMatT now support in-place multiplication.

11. mjData.ctrl values are no longer clamped in-place, remain untouched by the engine.

12. Arrays in mjData’s buffer now align to 64-byte boundaries rather than 8-byte.

13. Added memory poisoning when building with Address Sanitizer (ASAN) and Memory Sanitizer (MSAN). This allows ASAN to detect reads and writes to regions in mjModel.buffer and mjData.buffer that do not lie within an array, and for MSAN to detect reads from uninitialised fields in mjData following mj_resetData.

14. Added a slider-crank example model.

### Bug fixes

1. Activation clamping was not being applied in the implicit integrator.

2. Stricter parsing of orientation specifiers. Before this change, a specification that included both quat and an alternative specifier e.g., <geom ... quat=".1 .2 .3 .4" euler="10 20 30">, would lead to the quat being ignored and only euler being used. After this change a parse error will be thrown.

3. Stricter parsing of XML attributes. Before this change an erroneous XML snippet like <geom size="1/2 3 4"> would have been parsed as size="1 0 0" and no error would have been thrown. Now throws an error.

4. Trying to load a NaN via XML like <geom size="1 NaN 4">, while allowed for debugging purposes, will now print a warning.

5. Fixed null pointer dereference in mj_loadModel.

6. Fixed memory leaks when loading an invalid model from MJB.

7. Integer overflows are now avoided when computing mjModel buffer sizes.

8. Added missing warning string for mjWARN_BADCTRL.

### Packaging

1. Changed MacOS packaging so that the copy of mujoco.framework embedded in MuJoCo.app can be used to build applications externally.

## Version 2.2.0 (May 23, 2022)

### Open Sourcing

1. MuJoCo is now fully open-source software. Newly available top level directories are:

a. src/: All source files. Subdirectories correspond to the modules described in the Programming chapter introduction:

• src/engine/: Core engine.

• src/xml/: XML parser.

• src/user/: Model compiler.

• src/visualize/: Abstract visualizer.

• src/ui/: UI framework.

1. test/: Tests and corresponding asset files.

2. dist/: Files related to packaging and binary distribution.

2. Added contributor’s guide and style guide.

### General

1. Added analytic derivatives of smooth (unconstrained) dynamics forces, with respect to velocities:

• Centripetal and Coriolis forces computed by the Recursive Newton-Euler algorithm.

• Damping and fluid-drag passive forces.

• Actuation forces.

2. Added implicit integrator. Using the analytic derivatives above, a new implicit-in-velocity integrator was added. This integrator lies between the Euler and Runge Kutta integrators in terms of both stability and computational cost. It is most useful for models which use fluid drag (e.g. for flying or swimming) and for models which use velocity actuators. For more details, see the Numerical Integration section.

3. Added actlimited and actrange attributes to general actuators, for clamping actuator internal states (activations). This clamping is useful for integrated-velocity actuators, see the Activation clamping section for details.

4. mjData fields qfrc_unc (unconstrained forces) and qacc_unc (unconstrained accelerations) were renamed qfrc_smooth and qacc_smooth, respectively. While “unconstrained” is precise, “smooth” is more intelligible than “unc”.

5. Public headers have been moved from /include to /include/mujoco/, in line with the directory layout common in other open source projects. Developers are encouraged to include MuJoCo public headers in their own codebase via #include <mujoco/filename.h>.

6. The default shadow resolution specified by the shadowsize attribute was increased from 1024 to 4096.

7. Saved XMLs now use 2-space indents.

### Bug fixes

1. Antialiasing was disabled for segmentation rendering. Before this change, if the offsamples attribute was greater than 0 (the default value is 4), pixels that overlapped with multiple geoms would receive averaged segmentation IDs, leading to incorrect or non-existent IDs. After this change offsamples is ignored during segmentation rendering.

2. The value of the enable flag for the experimental multiCCD feature was made sequential with other enable flags. Sequentiality is assumed in the simulate UI and elsewhere.

3. Fix issue of duplicated meshes when saving models with OBJ meshes using mj_saveLastXML.

## Version 2.1.5 (Apr. 13, 2022)

### General

1. Added an experimental feature: multi-contact convex collision detection, activated by an enable flag. See full description here.

### Bug fixes

1. GLAD initialization logic on Linux now calls dlopen to load a GL platform dynamic library if a *GetProcAddress function is not already present in the process’ global symbol table. In particular, processes that use GLFW to set up a rendering context that are not explicitly linked against libGLX.so (this applies to the Python interpreter, for example) will now work correctly rather than fail with a gladLoadGL error when mjr_makeContext is called.

2. In the Python bindings, named indexers for scalar fields (e.g. the ctrl field for actuators) now return a NumPy array of shape (1,) rather than (). This allows values to be assigned to these fields more straightforwardly.

## Version 2.1.4 (Apr. 4, 2022)

### General

1. MuJoCo now uses GLAD to manage OpenGL API access instead of GLEW. On Linux, there is no longer a need to link against different GL wrangling libraries depending on whether GLX, EGL, or OSMesa is being used. Instead, users can simply use GLX, EGL, or OSMesa to create a GL context and mjr_makeContext will detect which one is being used.

2. Added visualisation for contact frames. This is useful when writing or modifying collision functions, when the actual direction of the x and y axes of a contact can be important.

### Binary build

1. The _nogl dynamic library is no longer provided on Linux and Windows. The switch to GLAD allows us to resolve OpenGL symbols when mjr_makeContext is called rather than when the library is loaded. As a result, the MuJoCo library no longer has an explicit dynamic dependency on OpenGL, and can be used on system where OpenGL is not present.

### Simulate

1. Fixed a bug in simulate where pressing ‘[’ or ‘]’ when a model is not loaded causes a crash.

2. Contact frame visualisation was added to the Simulate GUI.

3. Renamed “set key”, “reset to key” to “save key” and “load key”, respectively.

4. Changed bindings of F6 and F7 from the not very useful “vertical sync” and “busy wait” to the more useful cycling of frames and labels.

### Bug fixes

1. mj_resetData zeroes out the solver_nnz field.

2. Removed a special branch in mju_quat2mat for unit quaternions. Previously, mju_quat2mat skipped all computation if the real part of the quaternion equals 1.0. For very small angles (e.g. when finite differencing), the cosine can evaluate to exactly 1.0 at double precision while the sine is still nonzero.

## Version 2.1.3 (Mar. 23, 2022)

### General

1. simulate now supports cycling through cameras (with the [ and ] keys).

2. mjVIS_STATIC toggles all static bodies, not just direct children of the world.

### Python bindings

1. Added a free() method to MjrContext.

2. Enums now support arithmetic and bitwise operations with numbers.

### Bug fixes

1. Fixed rendering bug for planes, introduced in 2.1.2. This broke maze environments in dm_control.

## Version 2.1.2 (Mar. 15, 2022)

### New modules

1. Added new Python bindings, which can be installed via pip install mujoco, and imported as import mujoco.

2. Added new Unity plug-in.

3. Added a new introspect module, which provides reflection-like capability for MuJoCo’s public API, currently describing functions and enums. While implemented in Python, this module is expected to be generally useful for automatic code generation targeting multiple languages. (This is not shipped as part of the mujoco Python bindings package.)

### API changes

1. Moved definition of mjtNum floating point type into a new header mjtnum.h.

2. Renamed header mujoco_export.h to mjexport.h.

3. Added mj_printFormattedData, which accepts a format string for floating point numbers, for example to increase precision.

### General

1. MuJoCo can load OBJ mesh files.

1. Meshes containing polygons with more than 4 vertices are not supported.

2. In OBJ files containing multiple object groups, any groups after the first one will be ignored.

3. Added (post-release, not included in the 2.1.2 archive) textured mug example model:

2. Added optional frame-of-reference specification to framepos, framequat, framexaxis, frameyaxis, framezaxis, framelinvel, and frameangvel sensors. The frame-of-reference is specified by new reftype and refname attributes.

3. Sizes of user parameters are now automatically inferred.

1. Declarations of user parameters in the top-level size clause (e.g. nuser_body, nuser_jnt, etc.) now accept a value of -1, which is the default. This will automatically set the value to the length of the maximum associated user attribute defined in the model.

2. Setting a value smaller than -1 will lead to a compiler error (previously a segfault).

3. Setting a value to a length smaller than some user attribute defined in the model will lead to an error (previously additional values were ignored).

4. Increased the maximum number of lights in an mjvScene from 8 to 100.

5. Saved XML files only contain explicit inertial elements if the original XML included them. Inertias that were automatically inferred by the compiler’s inertiafromgeom mechanism remain unspecified.

6. User-selected geoms are always rendered as opaque. This is useful in interactive visualizers.

7. Static geoms now respect their geom group for visualisation. Until this change rendering of static geoms could only be toggled using the mjVIS_STATIC visualisation flag . After this change, both the geom group and the visualisation flag need to be enabled for the geom to be rendered.

8. Pointer parameters in function declarations in mujoco.h that are supposed to represent fixed-length arrays are now spelled as arrays with extents, e.g. mjtNum quat[4] rather than mjtNum* quat. From the perspective of C and C++, this is a non-change since array types in function signatures decay to pointer types. However, it allows autogenerated code to be aware of expected input shapes.

9. Experimental stateless fluid interaction model. As described here, fluid forces use sizes computed from body inertia. While sometimes convenient, this is very rarely a good approximation. In the new model forces act on geoms, rather than bodies, and have a several user-settable parameters. The model is activated by setting a new attribute: <geom fluidshape="ellipsoid"/>. The parameters are described succinctly here, but we leave a full description or the model and its parameters to when this feature leaves experimental status.

### Bug fixes

1. mj_loadXML and mj_saveLastXML are now locale-independent. The Unity plugin should now work correctly for users whose system locales use commas as decimal separators.

2. XML assets in VFS no longer need to end in a null character. Instead, the file size is determined by the size parameter of the corresponding VFS entry.

3. Fix a vertex buffer object memory leak in mjrContext when skins are used.

4. Camera quaternions are now normalized during XML compilation.

### Binary build

1. Windows binaries are now built with Clang.

## Version 2.1.1 (Dec. 16, 2021)

### API changes

1. Added mj_printFormattedModel, which accepts a format string for floating point numbers, for example to increase precision.

2. Added mj_versionString, which returns human-readable string that represents the version of the MuJoCo binary.

3. Converted leading underscores to trailing underscores in private instances of API struct definitions, to conform to reserved identifier directive, see C standard: Section 7.1.3.

Attention

This is a minor breaking change. Code which references private instances will break. To fix, replace leading underscores with trailing underscores, e.g. _mjModelmjModel_.

### General

1. Safer string handling: replaced strcat, strcpy, and sprintf with strncat, strncpy, and snprintf respectively.

2. Changed indentation from 4 spaces to 2 spaces, K&R bracing style, added braces to one-line conditionals.

### Bug Fixes

1. Fixed reading from uninitialized memory in PGS solver.

2. Computed capsule inertias are now exact. Until this change, capsule masses and inertias computed by the compiler’s inertiafromgeom mechanism were approximated by a cylinder, formed by the capsule’s cylindrical middle section, extended on both ends by half the capsule radius. Capsule inertias are now computed with the Parallel Axis theorem, applied to the two hemispherical end-caps.

Attention

This is a minor breaking change. Simulation of a model with automatically-computed capsule inertias will be numerically different, leading to, for example, breakage of golden-value tests.

3. Fixed bug related to force and torque sensors. Until this change, forces and torques reported by F/T sensors ignored out-of-tree constraint wrenches except those produced by contacts. Force and torque sensors now correctly take into account the effects of connect and weld constraints.

Note

Forces generated by spatial tendons which are outside the kinematic tree (i.e., between bodies which have no ancestral relationship) are still not taken into account by force and torque sensors. This remains a future work item.

### Code samples

1. testspeed: Added injection of pseudo-random control noise, turned on by default. This is to avoid settling into some fixed contact configuration and providing an unrealistic timing measure.

2. simulate:

1. Added slower-than-real-time functionality, which is controlled via the ‘+’ and ‘-’ keys.

2. Added sliders for injecting Brownian noise into the controls.

3. Added “Print Camera” button to print an MJCF clause with the pose of the current camera.

4. The camera pose is not reset when reloading the same model file.

### Updated dependencies

1. TinyXML was replaced with TinyXML2 6.2.0.

2. qhull was upgraded to version 8.0.2.

3. libCCD was upgraded to version 1.4.

4. On Linux, libstdc++ was replaced with libc++.

### Binary build

1. MacOS packaging. We now ship Universal binaries that natively support both Apple Silicon and Intel CPUs.

1. MuJoCo library is now packaged as a Framework Bundle, allowing it to be incorporated more easily into Xcode projects (including Swift projects). Developers are encouraged to compile and link against MuJoCo using the -framework mujoco flag, however all header files and the libmujoco.2.1.1.dylib library can still be directly accessed inside the framework.

2. Sample applications are now packaged into an Application Bundle called MuJoCo.app. When launched via GUI, the bundle launches the simulate executable. Other precompiled sample programs are shipped inside that bundle (in MuJoCo.app/Contents/MacOS) and can be launched via command line.

3. Binaries are now signed and the disk image is notarized.

2. Windows binaries and libraries are now signed.

3. Link-time optimization is enabled on Linux and macOS, leading to an average of ~20% speedup when benchmarked on three test models (cloth.xml, humanoid.xml, and humanoid100.xml).

4. Linux binaries are now built with LLVM/Clang instead of GCC.

5. An AArch64 (aka ARM64) Linux build is also provided.

6. Private symbols are no longer stripped from shared libraries on Linux and MacOS.

### Sample models

1. Clean-up of the model/ directory.

1. Rearranged into subdirectories which include all dependencies.

2. Added descriptions in XML comments, cleaned up XMLs.

3. Deleted some composite models: grid1, grid1pin, grid2, softcylinder, softellipsoid.

2. Added descriptive animations in docs/images/models/ :

## Version 2.1.0 (Oct. 18, 2021)

### New features

1. Keyframes now have mocap_pos and mocap_quat fields (mpos and quat attributes in the XML) allowing mocap poses to be stored in keyframes.

2. New utility functions: mju_insertionSortInt (integer insertion sort) and mju_sigmoid (constructing a sigmoid from two half-quadratics).

### General

1. The preallocated sizes in the virtual file system (VFS) increased to 2000 and 1000, to allow for larger projects.

2. The C structs in the mjuiItem union are now named, for compatibility.

3. Fixed: mjcb_contactfilter type is mjfConFilt (was mjfGeneric).

4. Fixed: The array of sensors in mjCModel was not cleared.

5. Cleaned up cross-platform code (internal changes, not visible via the API).

6. Fixed a bug in parsing of XML texcoord data (related to number of vertices).

7. Fixed a bug in simulate.cc related to nkey (the number of keyframes).

8. Accelerated collision detection in the presence of large numbers of non-colliding geoms (with contype==0 and conaffinity==0).

### UI

1. Figure selection type changed from int to float.

2. Figures now show data coordinates, when selection and highlight are enabled.

3. Changed mjMAXUIMULTI to 35, mjMAXUITEXT to 300, mjMAXUIRECT to 25.

4. Added collapsable sub-sections, implemented as separators with state: mjSEPCLOSED collapsed, mjSEPCLOSED+1 expanded.

5. Added mjITEM_RADIOLINE item type.

6. Added function mjui_addToSection to simplify UI section construction.

7. Added subplot titles to mjvFigure.

### Rendering

1. render_gl2 guards against non-finite floating point data in the axis range computation.

2. render_gl2 draws lines from back to front for better visibility.

3. Added function mjr_label (for text labels).

4. mjr_render exits immediately if ngeom==0, to avoid errors from uninitialized scenes (e.g. frustrum==0).

5. Added scissor box in mjr_render, so we don’t clear the entire window at every frame.

1. Removed the entire license manager. The functions mj_activate and mj_deactivate are still there for backward compatibility, but now they do nothing and it is no longer necessary to call them.
2. Removed the remote license certificate functions mj_certXXX.