Skip to content

Commit 4c07d9c

Browse files
authored
Merge pull request #96 from davidhozic/develop
Merge changes for 2.1.0
2 parents 1d5be77 + 72aa18a commit 4c07d9c

File tree

18 files changed

+1284
-137
lines changed

18 files changed

+1284
-137
lines changed

Cargo.toml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
[package]
22
name = "mujoco-rs"
3-
version = "2.0.1+mj-3.3.7"
3+
version = "2.1.0+mj-3.3.7"
44
edition = "2024"
55
license = "MIT OR Apache-2.0"
6-
description = "A Rust wrapper around the MuJoCo C library, with a native simple viewer (re-)written in Rust."
6+
description = "A high-level Rust wrapper around the MuJoCo C library, with a native viewer (re-)written in Rust."
77
readme = "README.md"
88
repository = "https://github.com/davidhozic/mujoco-rs"
99
keywords = ["MuJoCo", "Viewer", "Bindings", "Wrapper"]
1010
categories = ["simulation", "science::robotics", "api-bindings"]
1111
homepage = "https://crates.io/crates/mujoco-rs"
1212
documentation = "https://docs.rs/mujoco-rs/"
1313

14-
exclude = ["src/cpp/*", ".gitignore", ".gitmodules", "mujoco/*"]
14+
exclude = ["src/cpp/*", ".gitignore", ".gitmodules", "mujoco/*", "docs/"]
1515

1616
[package.metadata.docs.rs]
1717
all-features = true
1818

1919

2020
[features]
2121
viewer = ["dep:bitflags", "dep:glutin", "dep:winit", "dep:glutin-winit"]
22+
viewer-ui = ["viewer", "dep:egui-winit", "dep:egui_glow", "dep:egui"]
2223
renderer = ["dep:bitflags", "dep:glutin", "dep:winit", "dep:glutin-winit", "dep:png"]
2324
cpp-viewer = []
2425

2526
ffi-regenerate = ["dep:regex", "dep:bindgen"] # Generate the ffi bindings. Only used for updating the committed ``mujoco_c`` module.
26-
default = ["viewer", "renderer"]
27+
28+
auto-download-mujoco = ["dep:ureq", "dep:flate2", "dep:tar", "dep:zip", "dep:sha2"]
29+
use-rpath = []
30+
31+
default = ["viewer", "viewer-ui", "renderer"]
2732

2833
[dependencies]
2934
bitflags = {version = "2.9.4", optional = true}
@@ -34,10 +39,28 @@ paste = "1.0.15"
3439
glutin = {version = "0.32.3", optional = true}
3540
winit = {version = "0.30.12", optional = true}
3641
glutin-winit = {version = "0.5.0", optional = true}
42+
# Viewer's user interface dependencies
43+
egui-winit = {version = "0.33.0", default-features = false, features = ["wayland", "x11"], optional = true}
44+
egui_glow = {version = "0.33.0", features = ["x11", "winit", "wayland", "egui-winit"], optional = true}
45+
egui = {version = "0.33.0", optional = true}
3746

3847
[build-dependencies]
3948
bindgen = {version = "0.71.1", optional = true}
4049
regex = {version = "1.11.2", optional = true}
4150

51+
# Automatic download dependencies
52+
ureq = {version = "3.1.4", optional = true}
53+
sha2 = {version = "0.10.9", optional = true}
54+
55+
[target.'cfg(target_os = "linux")'.build-dependencies]
56+
flate2 = {version = "1.1.5", optional = true}
57+
tar = {version = "0.4.44", optional = true}
58+
59+
[target.'cfg(target_os = "windows")'.build-dependencies]
60+
zip = {version = "6.0.0", default-features = false, features = ["deflate"], optional = true}
61+
62+
[target.'cfg(unix)'.build-dependencies]
63+
pkg-config = "0.3"
64+
4265
[dev-dependencies]
4366
rand = "0.9.2"

README.md

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
[![Guide](https://img.shields.io/badge/Documentation-green)](https://mujoco-rs.readthedocs.io/en/stable/)
66

7-
8-
MuJoCo bindings and wrappers for the Rust programming language. Includes a Rust-native viewer and also
7+
MuJoCo bindings and high-level wrappers for the Rust programming language. Includes a Rust-native viewer and also
98
bindings to a modified C++ one.
109

1110
[MuJoCo](https://mujoco.org/) is a general purpose physics simulator.
@@ -19,9 +18,6 @@ More detailed documentation is available at the:
1918
## MuJoCo version
2019
This library uses FFI bindings to MuJoCo **3.3.7**.
2120

22-
You can download it from [official MuJoCo releases](https://github.com/google-deepmind/mujoco/releases/tag/3.3.7).
23-
24-
2521
## Installation
2622
For installation, see the [**guide book**](https://mujoco-rs.readthedocs.io/en/stable/installation.html).
2723

@@ -34,6 +30,7 @@ The main features on top of MuJoCo include
3430
- Automatic allocation and cleanup.
3531
- Lifetime guarantees.
3632

33+
- Automatic download and setup of MuJoCo.
3734
- Methods as function wrappers.
3835
- Easy manipulation of simulation data via attribute views.
3936
- High-level model editing.
@@ -43,37 +40,36 @@ The main features on top of MuJoCo include
4340
- Viewer: onscreen visualization of the 3D simulation.
4441

4542

46-
4743
## Rust-native viewer
4844
Screenshot of the built-in Rust viewer. Showing scene from [MuJoCo's menagerie](https://github.com/google-deepmind/mujoco_menagerie/tree/main/boston_dynamics_spot).
4945
![](docs/img_common/viewer_spot.png)
5046

5147

5248
## Optional Cargo features
5349
Optional Cargo features can be enabled:
54-
- ``viewer``: enables the Rust-native MuJoCo viewer. This can currently
55-
display everything and respond to mouse/keyboard. No side-panels (the user menu) currently exists.
56-
- ``cpp-viewer``: enables the Rust wrapper around the C++ MuJoCo viewer. This is only available if you build the MuJoCo yourself using the steps above (yes, you need to use the forked repository).
57-
- ``renderer``: enables the offscreen rendering code for reading RGB and depth data to memory or file.
50+
51+
- ``auto-download-mujoco``: MuJoCo dependency will be automatically downloaded and configured.
5852

59-
By default, ``viewer`` and ``renderer`` are enabled.
53+
- This is only available on Linux and Windows.
6054

61-
## Missing libraries
62-
MuJoCo-rs should on Windows work without problems after the MuJoCo library
63-
is provided. On Linux (and potentially MacOS, which we don't test) you may need
64-
additional build-time dependencies, such as CMake. This depends
65-
on your Linux distro and whether you want visualization/rendering support. See the [installation guide](https://mujoco-rs.readthedocs.io/en/stable/installation.html#build-dependencies-visualization-rendering-only) for more information.
55+
- ``use-rpath``: On Linux and MacOS, when dynamically linking, set the RPATH of the final binary.
56+
- ``viewer``: enables the Rust-native MuJoCo viewer.
57+
58+
- ``viewer-ui``: enables the (additional) user UI within the viewer.
59+
60+
- ``cpp-viewer``: enables the Rust wrapper around the C++ MuJoCo viewer.
61+
This requires static linking to a modified fork of MuJoCo, as described in :ref:`installation`.
62+
- ``renderer``: enables offscreen rendering for writing RGB and
63+
depth data to memory or file.
64+
65+
By default, ``viewer``, ``viewer-ui`` and ``renderer`` are enabled.
6666

67-
## NOTE
68-
This project is WIP but functional. I accept pull requests about bug fixes
69-
and feature requests. If you have any questions, please open a **discussion**.
7067

7168
## Example
7269
This example shows how to launch the viewer and print the coordinates
7370
of a moving ball to the terminal.
7471
Other examples can be found under the ``examples/`` directory.
7572

76-
7773
```rust
7874
//! Example of using views.
7975
//! The example shows how to obtain a [`MjJointInfo`] struct that can be used

0 commit comments

Comments
 (0)