Skip to content

Add Unitree G1 Sonic robot model#813

Open
Xucxname wants to merge 1 commit into
ARISE-Initiative:robosuite-sonicfrom
Xucxname:unitree-robotics
Open

Add Unitree G1 Sonic robot model#813
Xucxname wants to merge 1 commit into
ARISE-Initiative:robosuite-sonicfrom
Xucxname:unitree-robotics

Conversation

@Xucxname

Copy link
Copy Markdown

What this does

Adds the Unitree G1 Sonic robot model with Dex-3 hands, G1Sonic model class, and robosuite registry wiring.

Label: (✨ Feature)

How it was tested

python -m pytest

Result:

448 passed, 88 skipped

Also verified G1Sonic can be imported and instantiated through create_robot.

Copilot AI review requested due to automatic review settings June 12, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a robosuite-native integration for the Unitree G1 “SONIC” stack, including a new SonicG1/SonicG1Fixed robot with Dex3 grippers, a SONIC_WBC composite controller that routes streamed per-joint PD commands through robosuite controllers, and supporting tooling for recording/replay/testing.

Changes:

  • Introduces SONIC command-source + torque engine utilities (robosuite.utils.sonic.*) and a new SONIC_WBC composite controller.
  • Adds SonicG1 robot model + Dex3 grippers, committed MJCF assets, and a script to (re)build assets from upstream model_data.
  • Adds an end-to-end test suite and documentation / demo collection script for live DDS + deterministic replay.

Reviewed changes

Copilot reviewed 24 out of 139 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_robots/test_sonic_g1.py End-to-end tests for registration, assembly, OSC, SONIC_WBC PD dispatch matching, floating-base behavior, and data collection.
robosuite/utils/sonic/sources.py Adds DDS / replay / mock command sources and one-time DDS init helper.
robosuite/utils/sonic/debug.py Adds per-step recorder to generate “golden” trajectories for deterministic replay/tests.
robosuite/utils/sonic/controller.py Adds G1SonicController engine for obs-building + PD torque computation + effort clipping (+ optional hands).
robosuite/utils/sonic/init.py Exposes SONIC utilities as a package.
robosuite/scripts/collect_sonic_g1_demos.py Script to drive SonicG1 in robosuite envs via DDS/replay/mock and record demo.hdf5.
robosuite/scripts/build_sonic_g1_assets.py Script to split upstream integrated MJCF into robosuite-native robot + gripper assets.
robosuite/robots/init.py Registers SonicG1 / SonicG1Fixed in ROBOT_CLASS_MAPPING.
robosuite/models/robots/manipulators/sonic_g1_robot.py New SonicG1 / SonicG1Fixed robot models with base + arm ordering adjustments for robosuite.
robosuite/models/robots/manipulators/g1_sonic_robot.py Existing G1Sonic model file included in manipulator imports / mapping updates.
robosuite/models/robots/manipulators/init.py Exports G1Sonic, SonicG1, SonicG1Fixed.
robosuite/models/grippers/sonic_dex3_gripper.py New Dex3 left/right gripper models and action formatting.
robosuite/models/grippers/init.py Ensures Dex3 grippers import so they self-register.
robosuite/models/assets/robots/sonic_g1/robot.xml Adds committed SonicG1 body asset (split from upstream model).
robosuite/models/assets/robots/g1_sonic/robot.xml Adds/updates integrated G1 Sonic asset (with hands) used by other paths.
robosuite/models/assets/grippers/sonic_dex3_right.xml Adds committed right Dex3 gripper MJCF asset.
robosuite/models/assets/grippers/sonic_dex3_left.xml Adds committed left Dex3 gripper MJCF asset.
robosuite/controllers/parts/generic/joint_pos.py Extends joint position controller to accept streamed PD commands (dq*, tau_ff, optional torque clip).
robosuite/controllers/parts/controller_factory.py Adds JOINT_TORQUE option for gripper/torso/head factories.
robosuite/controllers/config/robots/default_sonic_g1.json Adds default composite config for SONIC_WBC using joint position part controllers.
robosuite/controllers/composite/sonic_whole_body_controller.py Adds SONIC_WBC composite controller: exchange DDS + route PD to part controllers + startup elastic band.
robosuite/controllers/composite/init.py Imports SonicWholeBodyController so it registers.
docs/modules/sonic_g1.rst Adds setup / usage docs for the SonicG1 integration.
docs/index.rst Adds modules/sonic_g1 to documentation toctree.
Comments suppressed due to low confidence (6)

tests/test_robots/test_sonic_g1.py:1

  • Hard-coded, machine-specific absolute paths make these tests non-portable and will cause most environments (including CI) to skip important coverage or fail to find assets. Prefer deriving paths from installed packages (e.g., gear_sonic.__file__), using repository-relative test data, or reading paths from environment variables / pytest options with a clear default + skip reason that includes the resolved path.
    tests/test_robots/test_sonic_g1.py:1
  • Hard-coded, machine-specific absolute paths make these tests non-portable and will cause most environments (including CI) to skip important coverage or fail to find assets. Prefer deriving paths from installed packages (e.g., gear_sonic.__file__), using repository-relative test data, or reading paths from environment variables / pytest options with a clear default + skip reason that includes the resolved path.
    robosuite/scripts/collect_sonic_g1_demos.py:1
  • This script is currently tied to a specific developer filesystem layout via GOLD_DIR and WITH_HAND_XML, which will break for other users. Make these configurable via CLI flags (e.g., --gold-dir, --with-hand-xml) and/or environment variables, and consider defaulting WITH_HAND_XML by locating it relative to the installed gear_sonic package (when present).
    robosuite/scripts/build_sonic_g1_assets.py:1
  • The asset build script is not reusable as-is because it hardcodes an absolute upstream checkout path. Consider accepting --gear-sonic-dir / --src / --meshdir CLI args (with env-var fallbacks) so others can regenerate assets without editing source, and so the script can be used in automated build pipelines.
    robosuite/utils/sonic/controller.py:1
  • If torso_link can’t be found, torso_id becomes -1 and md.xquat[-1] silently reads the last body’s quaternion, producing incorrect IMU observations without any error. This should fail fast (e.g., raise with a clear message) or fall back to a safe default (e.g., zeros) rather than indexing -1.
    robosuite/utils/sonic/controller.py:1
  • If torso_link can’t be found, torso_id becomes -1 and md.xquat[-1] silently reads the last body’s quaternion, producing incorrect IMU observations without any error. This should fail fast (e.g., raise with a clear message) or fall back to a safe default (e.g., zeros) rather than indexing -1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if self.interpolator is not None:
self.interpolator.set_goal(self.goal_qpos)

def set_pd_command(self, qpos, qvel=None, kp=None, kd=None, tau_feedforward=None):
Comment on lines +255 to +263
self.goal_qpos = np.asarray(qpos, dtype=float)
if qvel is not None:
self.desired_vel = np.asarray(qvel, dtype=float)
if kp is not None:
self.kp = np.asarray(kp, dtype=float)
if kd is not None:
self.kd = np.asarray(kd, dtype=float)
if tau_feedforward is not None:
self.torque_feedforward = np.asarray(tau_feedforward, dtype=float)
if self.interpolator is not None:
self.interpolator.set_goal(self.goal_qpos)

def set_pd_command(self, qpos, qvel=None, kp=None, kd=None, tau_feedforward=None):
Comment thread docs/modules/sonic_g1.rst
Comment on lines +11 to +12
routes the per-motor PD command streamed by the C++ stack through robosuite's per-part
``JointPositionController`` s. **robosuite** owns the physics clock; on the SONIC path the
@Xucxname Xucxname requested a review from Copilot June 12, 2026 16:59
@Xucxname Xucxname marked this pull request as draft June 12, 2026 17:00
@Xucxname Xucxname changed the base branch from master to robosuite-sonic June 12, 2026 17:00
@Xucxname Xucxname marked this pull request as ready for review June 12, 2026 17:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 69 changed files in this pull request and generated 3 comments.

Comment on lines 294 to 306
Comment thread docs/modules/sonic_g1.rst
Comment on lines 29 to 30
Comment on lines 171 to 183
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants