Skip to content
google-deepmindPublic

About

Native MuJoCo environment authoring library built for robots.

Resources

Contributing

Stars

26 stars

Watchers

2 watching

Forks

Repository files navigation

reaf-sim

CI PyPI version Documentation Status Open In Colab License

reaf-sim is a PyTorch simulation framework built by the MuJoCo team on top of MuJoCo and MuJoCo Warp, and using the Robotics Environment Authoring Framework (REAF).

reaf-sim is designed explicitly for sim-to-real robotics workflows. To achieve this, we decouple hardware and sensor I/O from task logic. The hardware layer is called the DeviceLayer, which wraps sim in an interface that is consistent with physical hardware. The task logic is implemented in the TaskLayer, which handles MDP processing of actions, observations, terminations, and rewards. Critically, the TaskLayer has no access to privileged simulation state, which makes sim workflows portable to real hardware.

Note

For a full suite of sim and real robotic examples, check out MuJoCo Playground, which showcases reaf-sim across a variety of tasks, or try the interactive Quickstart Colab!

This project adheres to the GDM Robotics Environment interface.

Installation

Install reaf-sim from PyPI (Python 3.12+):

uv pip install "reaf-sim>=1.0"

Note

On Linux with CUDA 12 drivers, install with --index https://download.pytorch.org/whl/cu129 -f https://github.com/NVIDIA/warp/releases/expanded_assets/v1.18.0 "warp-lang==1.18.0+cu12" "reaf-sim>=1.0".

Cartpole Example

For a quick preview into reaf-sim, let's create an environment controlling a cartpole alongside a camera rendering RGB observations across 16 parallel environments on GPU (impl="warp"). Step the environments with control commands and capture visual rollouts:

import mujoco
from reaf.simulation.torch import ActuatorDevice, CameraDevice, flat_scene
from reaf.simulation.torch.examples.cartpole import CARTPOLE_XML
import torch

spec = mujoco.MjSpec.from_string(CARTPOLE_XML)

# configure the environment
config = flat_scene.Environment(
    base_scene=spec,
    sim=flat_scene.Sim(
        nworld=16,
        xpu_device="cuda:0",
        impl="warp",
        simulation_timestep=0.01,
        control_timestep=0.05,
    ),
    device_layer=flat_scene.DeviceLayer(
        devices={
            "slider": flat_scene.Component(
                ActuatorDevice, targets=["slider"]
            ),
            "camera": flat_scene.Component(
                CameraDevice,
                cam_name="fixed",
                cam_resolution=(160, 120),
                render_rate_hz=20.0,
                output_name_prefix="camera/",
            ),
        }
    ),
    observation_adapter={
        "camera/fixed_rgb": flat_scene.ObsGroup(
            terms={
                "rgb": flat_scene.Obs("camera/fixed_rgb").configure(
                    output_shape=(120, 160, 3), dtype="uint8"
                ),
            }
        ),
    },
)

# build the environment
env = flat_scene.build_env(config)

# step the environment with batched actions and extract camera frames
timestep = env.reset()
for _ in range(100):
  commands = torch.rand((env.nworld, 1), device="cuda:0") * 2.0 - 1.0
  timestep = env.step({"slider/ctrl": commands})
  camera_frames = timestep.observation["camera/fixed_rgb"]  # (16, 120, 160, 3)

For the complete, runnable script that loads the Cartpole model and generates the tiled grid video below, see reaf/simulation/torch/examples/cartpole.py.

16-environment parallel Cartpole rollout on GPU

Documentation & Contributing

Citation

If you use reaf-sim in your work, please cite it as follows (see the GitHub contributors page for the full list of contributors):

@software{reaf_sim_2026,
  author = {{reaf-sim Contributors}},
  title = {{reaf-sim: Robotics Environment Authoring Framework - Simulation}},
  url = {https://github.com/google-deepmind/reaf-sim},
  year = {2026},
}

Acknowledgements

We are grateful to all members of the MuJoCo team for their support in developing reaf-sim. Additionally, we thank the authors of REAF, mjlab, and Isaac Lab for inspiring reaf-sim.

License & Disclaimer

reaf-sim is released under the Apache 2.0 license. See LICENSE for details.

This is not an official Google product.

About

Native MuJoCo environment authoring library built for robots.

Resources

Contributing

Stars

26 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages