From b6a283193ca042ab71ced83cefc56014978701b1 Mon Sep 17 00:00:00 2001 From: Martino Russi Date: Thu, 30 Jul 2026 15:22:38 +0200 Subject: [PATCH] (refactor) restore remote_keys --- src/lerobot/robots/unitree_g1/unitree_g1.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/lerobot/robots/unitree_g1/unitree_g1.py b/src/lerobot/robots/unitree_g1/unitree_g1.py index cfc3c0dcd..cb3b930ef 100644 --- a/src/lerobot/robots/unitree_g1/unitree_g1.py +++ b/src/lerobot/robots/unitree_g1/unitree_g1.py @@ -34,6 +34,7 @@ from .config_unitree_g1 import UnitreeG1Config from .g1_kinematics import G1_29_ArmIK from .g1_utils import ( REMOTE_AXES, + REMOTE_KEYS, G1_29_JointArmIndex, G1_29_JointIndex, default_remote_input, @@ -589,14 +590,18 @@ class UnitreeG1(Robot): def _update_controller_action(self, action: RobotAction) -> None: """Update controller input state from an incoming teleop action. - Controller-agnostic: every value-carrying key (locomotion ``remote.*`` axes or - SONIC ``motion_token.*`` values) is forwarded verbatim into ``controller_input`` - and each controller extracts only the keys it understands. The robot deliberately - does not enumerate any controller's key schema here. + Locomotion controllers (GR00T / Holosoma) read the ``remote.*`` joystick axes; + the SONIC whole-body controller reads the 64-D ``motion_token.*`` latent. Both are + forwarded into ``controller_input`` for the controller thread to consume. """ + from .controllers.sonic_whole_body import TOKEN_ACTION_PREFIX + with self._controller_action_lock: + for key in REMOTE_KEYS: + if key in action: + self.controller_input[key] = action[key] for key, value in action.items(): - if isinstance(key, str) and value is not None: + if isinstance(key, str) and value is not None and key.startswith(TOKEN_ACTION_PREFIX): self.controller_input[key] = value @property