镜像自地址
https://github.com/MINT-SJTU/Evo-RL.git
已同步 2026-11-20 18:17:06 +00:00
fix(piper): decouple connect enable from calibrate flag
这个提交包含在:
@ -102,9 +102,9 @@ class PiperFollower(Robot):
|
|||||||
if should_auto_calibrate:
|
if should_auto_calibrate:
|
||||||
logger.info("No piper-follower calibration file found for '%s'. Running lerobot-calibrate flow.", self.id)
|
logger.info("No piper-follower calibration file found for '%s'. Running lerobot-calibrate flow.", self.id)
|
||||||
self.calibrate()
|
self.calibrate()
|
||||||
# lerobot-calibrate calls connect(calibrate=False) before running calibrate().
|
# Enable behavior should be controlled by enable_on_connect, independent from calibrate flag.
|
||||||
# Keep the arm in drag mode for that path, but re-enable after connect-time calibration.
|
# This keeps connect(calibrate=False) commandable for callers that only want to skip interactive calibration.
|
||||||
should_enable = self.config.enable_on_connect and calibrate
|
should_enable = self.config.enable_on_connect
|
||||||
if should_enable and not self._wait_enable(self.config.enable_timeout_s):
|
if should_enable and not self._wait_enable(self.config.enable_timeout_s):
|
||||||
logger.warning("Piper follower did not report enabled state before timeout.")
|
logger.warning("Piper follower did not report enabled state before timeout.")
|
||||||
|
|
||||||
|
|||||||
@ -318,3 +318,25 @@ def test_piper_follower_connect_calibrates_then_reenables(monkeypatch, tmp_path)
|
|||||||
assert robot.arm.is_enabled
|
assert robot.arm.is_enabled
|
||||||
finally:
|
finally:
|
||||||
robot.disconnect()
|
robot.disconnect()
|
||||||
|
|
||||||
|
|
||||||
|
def test_piper_follower_connect_without_calibration_still_enables(monkeypatch, tmp_path):
|
||||||
|
patch_fake_sdk(monkeypatch)
|
||||||
|
|
||||||
|
robot = PiperFollower(
|
||||||
|
PiperFollowerConfig(
|
||||||
|
port="can0",
|
||||||
|
id="connect_enable_without_calibration",
|
||||||
|
calibration_dir=tmp_path,
|
||||||
|
calibration_mode="required",
|
||||||
|
enable_on_connect=True,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
robot.connect(calibrate=False)
|
||||||
|
try:
|
||||||
|
assert robot.arm.enable_calls == 1
|
||||||
|
assert robot.arm.is_enabled
|
||||||
|
assert robot.arm.disable_calls == 0
|
||||||
|
finally:
|
||||||
|
robot.disconnect()
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户