MuJoCo-rs¶
MuJoCo bindings and wrappers for the Rust programming language. Includes a Rust-native 3D viewer and also bindings to a modified C++ one.
MuJoCo is a general purpose physics simulator.
MuJoCo version¶
MuJoCo-rs uses FFI bindings to MuJoCo 3.8.0.
Main features¶
MuJoCo-rs tries to stay close to MuJoCo’s C API, with a few additional features for ease of use. The main features on top of MuJoCo include:
Safe wrappers around structs:
Automatic allocation and cleanup.
Lifetime checks.
Methods as function wrappers.
Easy manipulation of simulation data via Attribute views (named access).
High-level Model editing.
-
3D renderer: offscreen rendering to array or file (enabled by the
rendererfeature).3D viewer: onscreen visualization (enabled by the
viewerandviewer-uifeatures).
Installation¶
For installation, see Installation.
Optional Cargo features¶
Optional Cargo features can be enabled:
viewer: enables the Rust-native MuJoCo viewer.viewer-ui: enables the (additional) user UI within the viewer. This also allows users to add custom egui widgets to the viewer.
cpp-viewer: enables the Rust wrapper around the C++ MuJoCo viewer. This requires static linking to a modified fork of MuJoCo, as described in Installation.renderer: enables offscreen rendering for writing RGB and depth data to memory or file.renderer-winit-fallback: enables the invisible window fallback (based on winit) when offscreen rendering fails to initialize. Note that true offscreen rendering is only available on Linux platforms when the video driver supports it. On Windows and macOS, this feature must always be enabled when therendererfeature is enabled.
auto-download-mujoco: MuJoCo dependency will be automatically downloaded to the specified path.This is only available on Linux and Windows.
The environment variable
MUJOCO_DOWNLOAD_DIRmust be set to the absolute path of the download location.Downloaded MuJoCo library is still a shared library; see MuJoCo for complete configuration details.
By default, no optional features are enabled. Enable the features you need explicitly
(e.g. cargo add mujoco-rs --features "viewer-ui renderer-winit-fallback").
Table of contents¶
- Installation
- Programming
- API
- WebAssembly (Emscripten)
- Changelog
- Versioning
- 4.0.1 (MuJoCo 3.8.0)
- 4.0.0 (MuJoCo 3.8.0)
- 3.0.1 (MuJoCo 3.6.0)
- 3.0.0 (MuJoCo 3.6.0)
- 2.3.5 (MuJoCo 3.3.7)
- 2.3.4 (MuJoCo 3.3.7)
- 2.3.3 (MuJoCo 3.3.7)
- 2.3.2 (MuJoCo 3.3.7)
- 2.3.1 (MuJoCo 3.3.7)
- 2.3.0 (MuJoCo 3.3.7)
- 2.2.2 (MuJoCo 3.3.7)
- 2.2.1 (MuJoCo 3.3.7)
- 2.2.0 (MuJoCo 3.3.7)
- 2.1.0 / 2.1.1 (MuJoCo 3.3.7)
- 2.0.1 (MuJoCo 3.3.7)
- 2.0.0 (MuJoCo 3.3.7)
- 1.5.0 (MuJoCo 3.3.5)
- 1.4.2 (MuJoCo 3.3.5)
- 1.4.1 (MuJoCo 3.3.5)
- 1.4.0 (MuJoCo 3.3.5)
- 1.3.0 (MuJoCo 3.3.5)
- 1.2.0 (MuJoCo 3.3.5)
- 1.1.0 (MuJoCo 3.3.5)
- 1.0.1 (MuJoCo 3.3.5)
- 1.0.0 (MuJoCo 3.3.5)
- 0.4.3 (MuJoCo 3.3.5)
- 0.4.2 (MuJoCo 3.3.5)
- 0.4.1 (MuJoCo 3.3.5)
- 0.4.0 (MuJoCo 3.3.5)
- 0.3.0 (MuJoCo 3.3.5)
- Migration guide