(refactor) restore remote_keys

This commit is contained in:
Martino Russi
2026-07-30 15:22:38 +02:00
parent 44edbd704f
commit b6a283193c
+10 -5
View File
@@ -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