Skip to content

Commit cbb828c

Browse files
btabakevinzakkaMustafa HaiderbhaisamholtJing Yuan Luo
authored andcommitted
Project import.
Co-authored-by: Kevin Zakka <[email protected]> Co-authored-by: Baruch Tabanpour <[email protected]> Co-authored-by: Mustafa Haiderbhai <[email protected]> Co-authored-by: Samuel Holt <[email protected]> Co-authored-by: Jing Yuan Luo <[email protected]> Co-authored-by: Arthur Allshire <[email protected]> Co-authored-by: Qiayuan Liao <[email protected]> Co-authored-by: Carlo Sferrazza <[email protected]> PiperOrigin-RevId: 715549440 Change-Id: I6296fdb7e6bf9c3b5420e27ee0fd3555268d815a
1 parent a9353b4 commit cbb828c

File tree

222 files changed

+30573
-2407
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+30573
-2407
lines changed

.gitignore

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,28 @@
1-
# Don't commit binaries
2-
*.a
3-
*.asm
4-
*.dll
5-
*.dylib
6-
*.exe
7-
*.lib
8-
*.out
9-
*.o
10-
*.so
11-
*.so.*
12-
13-
# Exclude editor config
14-
.vscode/
15-
.vs/
16-
17-
# Exclude temporary folders
18-
*.egg-info/
19-
build/
20-
build_cmake/
21-
python/dist/
22-
doc/_build
23-
24-
# Exclude macOS folder attributes
251
.DS_Store
26-
27-
# Exclude macOS Info.framework.plist
28-
Info.framework.plist
29-
30-
# Python byte-compiled / optimized / DLL files
31-
__pycache__/
32-
*.py[cod]
33-
*$py.class
34-
35-
# MuJoCo's default log file
2+
__pycache__
3+
*.egg-info
4+
checkpoints/
5+
dog_assets/
6+
videos/
7+
.vscode
8+
*.msh
9+
*.pt
10+
*.pkl
11+
*.mp4
12+
*.gif
13+
*.zip
14+
learning/*.png
15+
# Other.
16+
dog.py
17+
curriculum.ipynb
18+
**runs**/
19+
learning/wandb
3620
MUJOCO_LOG.TXT
37-
38-
# Clang cache
39-
.cache/
21+
learning/*.png
22+
*.tar.gz
23+
**/logs/**
24+
**/wandb/**
25+
**/runs/**
26+
*.onnx
27+
!mujoco_playground/experimental/sim2sim/onnx/*.onnx
28+
**/.ipynb_checkpoints/

.pre-commit-config.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
default_stages: [pre-commit]
2+
exclude: '.*__init__\.py$'
3+
4+
# Install
5+
# 1. pip install -e .
6+
# 2. pre-commit install
7+
# 3. pre-commit run --all-files # make sure all files are clean
8+
repos:
9+
- repo: https://github.com/google/pyink
10+
rev: 24.10.0
11+
hooks:
12+
- id: pyink
13+
name: Pyink (Formatting)
14+
# pyink will automatically read configuration from pyproject.toml
15+
16+
- repo: https://github.com/pycqa/isort
17+
rev: 5.13.2
18+
hooks:
19+
- id: isort
20+
name: Isort (Import Sorting)
21+
# isort will automatically read configuration from pyproject.toml
22+
23+
# - repo: local
24+
# hooks:
25+
# - id: pylint
26+
# name: Pylint (Google Style)
27+
# entry: pylint
28+
# args: ['--rcfile=pylintrc']
29+
# language: system
30+
# types: [python]
31+
32+
# - repo: local # re-using locally installed libraries
33+
# hooks:
34+
# - id: pytype
35+
# name: Pytype (Type Checking)
36+
# entry: pytype
37+
# language: system
38+
# types: [python]
39+
# always_run: true
40+
41+
# - repo: local
42+
# hooks:
43+
# - id: pytest
44+
# name: Run Pytest
45+
# entry: pytest
46+
# language: system
47+
# pass_filenames: false
48+
# always_run: true
49+
# args: ["-n", "auto"] # Execute tests in parallel
50+
# verbose: true

CONTRIBUTING

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,28 @@ information on using pull requests.
2323

2424
This project follows [Google's Open Source Community
2525
Guidelines](https://opensource.google/conduct/).
26+
27+
28+
## Linting and Code Health
29+
30+
Before submitting a PR, please run:
31+
32+
```shell
33+
pip install -e ".[dev]"
34+
pre-commit install
35+
pre-commit run --all-files
36+
```
37+
38+
or you can run manually
39+
40+
```shell
41+
pyink .
42+
43+
isort .
44+
45+
pylint . --rcfile=pylintrc
46+
47+
pytype .
48+
```
49+
50+
And resolve any issues that pop up.

README.md

Lines changed: 75 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,84 @@
11
# MuJoCo Playground
22

3-
MuJoCo Playground contains a suite of classic control and robotic environments built on top of the MuJoCo physics engine. Environments contain recipes for training classic control, locomotion, and manipulation behaviors via RL.
3+
<h1>
4+
<a href="#"><img alt="MuJoCo Playground" src="assets/banner.png" width="100%"></a>
5+
</h1>
6+
7+
A comprehensive suite of environments for robot learning research, accelerated by [MuJoCo MJX](https://github.com/google-deepmind/mujoco/tree/main/mjx).
8+
9+
Features include:
10+
11+
- Classic control environments from `dm_control` reimplemented in MJX
12+
- Quadruped and bipedal locomotion environments
13+
- Non-prehensile and dexterous manipulation environments
14+
- Vision-based support via Madrona
415

516
## Installation
617

718
> [!IMPORTANT]
819
> Requires Python 3.9 or later.
920
1021
1. `pip install -U "jax[cuda12]"`
11-
* `python -c "import jax; print(jax.default_backend())"` should print `gpu`.
12-
2. Clone this repository.
13-
3. `pip install -e ".[all]"`
22+
* Verify GPU backend: `python -c "import jax; print(jax.default_backend())"` should print `gpu`
23+
2. Clone this repository
24+
3. Install submodules: `git submodule update --init --recursive`
25+
4. `pip install -e ".[all]"`
26+
27+
## Common Gotchas
28+
29+
- Version mismatch between mjx and mujoco can cause issues. If encountered:
30+
```bash
31+
pip uninstall mujoco mujoco-mjx
32+
pip install --upgrade mujoco mujoco-mjx
33+
```
34+
35+
## Playground environments
36+
37+
### Locomotion Suite
38+
39+
| Environment | Visualization
40+
|------------|---------------|
41+
| `Env1` | [hopper.gif] |
42+
| `Env2` | [walker.gif] |
43+
| `Env3` | [humanoid.gif]|
44+
45+
### Manipulation Suite
46+
47+
| Environment | Description | Simulation | Real Robot |
48+
|------------|-------------|------------|------------|
49+
| `ReachEnv` | Reaching task with robot arm | [reach.gif] | [real_reach.gif] |
50+
| `PushEnv` | Object pushing with robot arm | [push.gif] | [real_push.gif] |
51+
| `PickPlaceEnv` | Pick and place objects | [pick.gif] | N/A |
52+
53+
### DM Control Suite
54+
55+
| Environment | Description | Simulation |
56+
|------------|-------------|------------|
57+
| `Cartpole` | Classic cartpole balancing | [cartpole.gif] |
58+
| `Pendulum` | Inverted pendulum control | [pendulum.gif] |
59+
| `Cheetah` | 2D cheetah running | [cheetah.gif] |
60+
| `Finger` | Finger spinning task | [finger.gif] |
61+
62+
## Frequently Asked Questions
63+
64+
* Q1
65+
* Q2
66+
* Q3
67+
68+
## How can I contribute?
69+
70+
Install the library and use it! Report bugs in the issue tracker. If you are a developer with some robotics experience looking to hack on open source, check out the [contribution guidelines](CONTRIBUTING).
71+
72+
## Citation
73+
74+
If you use Playground in your scientific works, please cite it as follows:
75+
76+
```bibtex
77+
@misc{mujoco_playground2025,
78+
author = {[Your Name]},
79+
title = {MuJoCo Playground},
80+
year = {2025},
81+
publisher = {GitHub},
82+
url = {https://github.com/google-deepmind/mujoco-playground}
83+
}
84+
```

assets/banner.png

124 KB
Loading

learning/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Learning RL Agents
2+
3+
In this directory, we demonstrate learning RL agents from MuJoCo Playground environments using [Brax](https://github.com/google/brax) and [RSL-RL](https://github.com/leggedrobotics/rsl_rl). We provide two entrypoints from the command line: `python train_jax_ppo.py` and `python train_rsl_rl.py`.
4+
5+
For more detailed tutorials on using MuJoCo Playground for RL, see:
6+
7+
1. Intro. to the Playground with DM Control Suite [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco_playground/blob/main/learning/notebooks/dm_control_suite.ipynb)
8+
2. Locomotion Environments [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco_playground/blob/main/learning/notebooks/locomotion.ipynb)
9+
3. Manipulation Environments [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco_playground/blob/main/learning/notebooks/manipulation.ipynb)
10+
4. Training CartPole from Vision [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco_playground/blob/main/learning/training_vision_1.ipynb)
11+
5. Robotic Manipulation from Vision [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google-deepmind/mujoco_playground/blob/main/learning/training_vision_2.ipynb)
12+
13+
## Training with RSL-RL
14+
15+
To train with RSL-RL, you can use the `train_rsl_rl.py` script. This script uses the RSL-RL algorithm to train an agent on a given environment.
16+
17+
```bash
18+
python train_rsl_rl.py --env_name=LeapCubeReorient
19+
```
20+
21+
to render the behaviour from the resulting policy:
22+
```bash
23+
python learning/train_rsl_rl.py --env_name LeapCubeReorient --play_only --load_run_name <run_name>
24+
```
25+
26+
where `run_name` is the name of the run you want to load (will be printed in the console when the training run is started).
27+
28+
Logs and checkpoints are saved in `logs` directory.

0 commit comments

Comments
 (0)