feat: harden TG3 teleop and add right-B point gesture

This commit is contained in:
LengedZhao
2026-08-08 15:51:21 +08:00
parent eab60273bc
commit 1a79fca36f
17 changed files with 1725 additions and 196 deletions

View File

@@ -79,6 +79,7 @@ class RobotSessionGateTest(unittest.TestCase):
bridge.allow_publish = True
bridge.cfg = {"control": {"auto_home_on_stop": True}}
bridge.hands_enabled = False
bridge.right_point_gesture_enabled = False
bridge.robot_arm_positions = [0.0] * 14
bridge.last_command = None
bridge.last_publish_at = 0.0
@@ -169,6 +170,7 @@ class RobotSessionGateTest(unittest.TestCase):
"hold_seconds": 0.0,
"joystick_deadzone": 0.2,
"joystick_expo": 2.0,
"yaw_joystick_expo": 1.0,
"max_forward_m_s": 1.0,
"max_reverse_m_s": 0.8,
"max_angular_rad_s": 0.8,
@@ -193,15 +195,27 @@ class RobotSessionGateTest(unittest.TestCase):
moving = ArmSnapshot(
{
"button": {"right": [False, False, True]},
"joystick": {"left": [1.0, 0.0]},
"button": {
"left": [False, False, False],
"right": [False, False, True],
},
"joystick": {
"left": [1.0, 0.0],
"right": [0.0, 0.0],
},
},
received_at=1.0,
)
released = ArmSnapshot(
{
"button": {"right": [False, False, False]},
"joystick": {"left": [1.0, 0.0]},
"button": {
"left": [False, False, False],
"right": [False, False, False],
},
"joystick": {
"left": [1.0, 0.0],
"right": [0.0, 0.0],
},
},
received_at=1.1,
)
@@ -212,6 +226,38 @@ class RobotSessionGateTest(unittest.TestCase):
bridge._tick_locomotion(1.2, moving)
self.assertEqual(published[-1], (1.0, -0.0))
turning = ArmSnapshot(
{
"button": {
"left": [False, False, True],
"right": [False, False, False],
},
"joystick": {
"left": [0.0, 0.0],
"right": [0.0, 1.0],
},
},
received_at=1.3,
)
bridge._tick_locomotion(1.3, turning)
self.assertEqual(published[-1], (0.0, -0.8))
old_wrong_binding = ArmSnapshot(
{
"button": {
"left": [False, False, False],
"right": [False, False, True],
},
"joystick": {
"left": [0.0, 1.0],
"right": [0.0, 0.0],
},
},
received_at=1.4,
)
bridge._tick_locomotion(1.4, old_wrong_binding)
self.assertEqual(published[-1], (0.0, 0.0))
if __name__ == "__main__":
unittest.main()