Use disable_torque_on_disconnect

This commit is contained in:
glannuzel
2025-08-28 17:55:30 +02:00
parent 67843db756
commit 5264feecef
3 changed files with 9 additions and 4 deletions
@@ -33,7 +33,7 @@ class Reachy2RobotConfig(RobotConfig):
ip_address: str | None = "localhost"
# If True, turn_off_smoothly() will be sent to the robot before disconnecting.
disable_torque_on_disconnect: bool = True
disable_torque_on_disconnect: bool = False
# Tag for external commands control
# Set to True if you use an external commands system to control the robot,
+2 -1
View File
@@ -211,5 +211,6 @@ class Reachy2Robot(Robot):
if self.reachy is not None:
for cam in self.cameras.values():
cam.disconnect()
self.reachy.turn_off_smoothly()
if self.config.disable_torque_on_disconnect:
self.reachy.turn_off_smoothly()
self.reachy.disconnect()
+6 -2
View File
@@ -60,11 +60,12 @@ PARAMS = [
{"with_mobile_base": False},
{"with_mobile_base": False, "with_l_arm": False, "with_antennas": False},
{"with_r_arm": False, "with_neck": False, "with_antennas": False},
{"use_external_commands": True},
{"use_external_commands": True, "disable_torque_on_disconnect": True},
{"use_external_commands": True, "with_mobile_base": False, "with_neck": False},
{"with_right_teleop_camera": False},
{"with_left_teleop_camera": False, "with_right_teleop_camera": False},
{"with_left_teleop_camera": False, "with_torso_camera": True},
{"disable_torque_on_disconnect": False},
]
@@ -191,7 +192,10 @@ def test_connect_disconnect(reachy2):
reachy2.disconnect()
assert not reachy2.is_connected
reachy2.reachy.turn_off_smoothly.assert_called_once()
if reachy2.config.disable_torque_on_disconnect:
reachy2.reachy.turn_off_smoothly.assert_called_once()
else:
reachy2.reachy.turn_off_smoothly.assert_not_called()
reachy2.reachy.disconnect.assert_called_once()