How hello-robot/stretch_mujoco works
Project Type and Purpose
• This is a Python-based simulation library (“Stretch Mujoco”) for the Hello Robot Stretch robot, built on top of the MuJoCo physics engine.
• It provides an API (StretchMujocoSimulator) plus helper scripts (launch_sim, robocasa_gen) to start multi-process simulations, control robot joints/base, stream sensors (RGB, depth, lidar), and integrate with Robocasa environments and ROS2.
File Structure Analysis
• Top-level:
• config files (.flake8, pyproject.toml, mkdocs.yml, etc.) and docs/examples/tests.
• stretch_mujoco/ package containing:
– config.py, utils.py
– datamodels/ & enums/ (data abstractions for joint and sensor status)
– models/ (XML world definitions + 3D asset files)
– mujoco_server*.py (different server processes: active, passive, sensor, camera manager, managed server)
– launch_sim.py (entrypoint that parses args, configures and spawns processes)
– stretch_mujoco_simulator.py (core API class wrapping mjModel/mjData, starting the sim, RPC to servers)
– robocasa_gen.py (kitchen scene model generator)
• Submodules:
• third_party/robocasa and third_party/robosuite (environment generators and macros).
README Insights
• Describes features: multi-process viewer vs headless mode, joint position/velocity control, camera + lidar streaming, Robocasa kitchen spawning, ROS2 bridge.
• Example usage: uv run launch_sim, Python API snippets, integration steps.