Expand description
§MuJoCo-rs
A wrapper around the MuJoCo C library with a Rust-native viewer. If you’re familiar with MuJoCo, this should be pretty straightforward to use as the wrappers mainly encapsulate some C structs or just rename them to match the Rust’s PascalCase style.
The main structs are wrappers::mj_model::MjModel and wrappers::mj_data::MjData.
These two structs (and some other) wrap the C structure in order to achieve memory safety.
Their fields aren’t publicly exposed and can instead be manipulated through views
(e.g., MjData::joint and then wrappers::mj_data::MjJointDataInfo::view).
To access the wrapped attributes directly, call the corresponding ffi() methods
(e.g., MjData::ffi)
§MuJoCo version
MuJoCo-rs relies on MuJoCo 3.3.7.
§Documentation
A more guided documentation can be obtained here.
§3D viewer
The Rust-native viewer is available (viewer::MjViewer), as well as the MuJoCo’s original C++
one (cpp_viewer::MjViewerCpp).
The C++ viewer however requires manual compilation of a patched MuJoCo repository,
like described here.
§Model editing
MjModel can be procedurally generated through the model editing module.
The specification representing the model is wrappers::mj_editing::MjSpec
§Features
This crate has the following public features:
viewer, which enables the Rust-native viewer (viewer::MjViewer),cpp-viewer, which enables the MuJoCo’s original viewer (C++ based) (cpp_viewer::MjViewerCpp),renderer, which enables the image renderer (renderer::MjRenderer).
§Functions
Most functions are wrapped under methods at different structs. Some functions
are available under the wrappers::fun module.
If a certain function can’t be found, you can use the raw FFI bindings, available under
the mujoco_c module. Note that to access the lower-level ffi structs inside of wrappers,
ffi() or ffi_mut() must be called (e.g., MjData::ffi and MjModel::ffi).
Modules§
- cpp_
viewer - mujoco_
c - prelude
- Commonly used items.
- renderer
- Module related to implementation of the
MjRenderer. - util
- Utility related data
- viewer
- Module related to implementation of the
MjViewer. For implementation of the C++ wrapper, seecrate::cpp_viewer::MjViewerCpp. - wrappers
- A set of wrappers around the MuJoCo types and functions.
Functions§
- get_
mujoco_ version - Returns the version string of the MuJoCo library.