mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-27 19:56:09 +00:00
fix(record): connect teleoperator before robot to avoid watchdog jump (#4166)
* fix(record): connect teleoperator before robot to avoid watchdog jump lerobot-record connected the robot before the teleoperator. A robot's connect()/reset() can leave it holding a default pose under a firmware watchdog (e.g. Unitree G1); if teleop.connect() (model loading, IK init, network setup) then takes longer than that watchdog, the joints drop to damping and the first send_action() makes the robot jump. Swap the order so the teleoperator connects first, matching the ordering already used in lerobot_teleoperate.py. Pure ordering fix, no API change. Fixes #3684 * fix(record): trim comment and add connect-order regression test Address review feedback on #3684: - Trim the verbose ordering comment down to two lines. - Add test_record_connects_teleop_before_robot to tests/test_control_robot.py, asserting teleop.connect() runs before robot.connect() in record(). * chore(test): remove test --------- Co-authored-by: Jaimin Patel <jpatel@tuvalabs.com> Co-authored-by: Martino Russi <77496684+nepyope@users.noreply.github.com>
This commit is contained in:
@@ -453,9 +453,11 @@ def record(
|
||||
encoder_queue_maxsize=cfg.dataset.encoder_queue_maxsize,
|
||||
)
|
||||
|
||||
robot.connect()
|
||||
# Connect the teleoperator before the robot so the robot isn't left idle (and possibly
|
||||
# tripping a firmware watchdog) during teleop init. Matches lerobot_teleoperate.py.
|
||||
if teleop is not None:
|
||||
teleop.connect()
|
||||
robot.connect()
|
||||
|
||||
listener, events = init_keyboard_listener()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user