Skip to content

feat: Full LeRobot G1 integration via EnvHub (with DDS/SDK layer) #74

@MiaoDX

Description

@MiaoDX

Context

LeRobot's Unitree G1 MuJoCo environment uses a digital twin architecture — even in pure simulation, it communicates via DDS (Data Distribution Service) through unitree_sdk2py. This is by design: controllers written for the real robot work identically in sim.

In #65 we validated the wrapper with a simplified model. The sibling issue covers loading the real 29-DOF model without SDK. This issue tracks full, native LeRobot integration.

The challenge: SDK dependency chain

lerobot/unitree-g1-mujoco (HuggingFace repo)
  └── unitree_sdk2py >= 1.0.0
       └── cyclonedds == 0.10.2  ← hard-pinned, binary wheel availability varies

Key constraints discovered in #65 investigation:

  1. unitree_sdk2py claims python_requires='>=3.8', but cyclonedds==0.10.2 may lack wheels for newer Python versions
  2. LeRobot main repo requires python >= 3.12, yet commented out the SDK from [unitree_g1] extras: # "unitree-sdk2==1.0.1"
  3. LeRobot main code (src/lerobot/robots/unitree_g1/unitree_g1.py) already has conditional imports for the SDK, but the HuggingFace sim repo does unconditional module-level imports throughout simulator_factory.py, base_sim.py, unitree_sdk2py_bridge.py
  4. The sim uses DDS on loopback (INTERFACE: "lo") — ChannelFactoryInitialize(DOMAIN_ID, "lo") — even in pure simulation

Proposal

Full integration with the native LeRobot G1 environment:

  1. Use lerobot.envs.factory.make_env() to create the env the official way:
    from lerobot.envs.factory import make_env
    env = make_env("lerobot/unitree-g1-mujoco", trust_remote_code=True)
  2. Wrap with RobotHarnessWrapper — the returned UnitreeG1Env inherits from gym.Env
  3. Document the full dependency setup (conda env, SDK install, Python version)
  4. Handle the SDK availability gracefully in the example

Known blockers to investigate

  • Does cyclonedds==0.10.2 install on Python 3.11/3.12/3.13? (Our CI tests 3.10-3.13)
  • Can the HuggingFace sim repo be patched to make SDK optional (contribute upstream)?
  • Does make_env() return an env with render_camera() or only render()?
  • Is there a camera configuration for multi-view in the G1 sim config?

Acceptance criteria

  • examples/lerobot_g1_native.py using make_env() from LeRobot
  • Full dependency documentation (install steps, Python version requirements)
  • Works on at least one Python version in CI (likely 3.10 or 3.12)
  • Multi-view checkpoint capture if the env supports it
  • Graceful error if SDK/LeRobot not installed
  • OR: documented list of incompatibilities with upstream fix suggestions

Relationship to other issues

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions