From 3cafa82e16ba022e83742151005a6954bca22077 Mon Sep 17 00:00:00 2001 From: FallenSigh Date: Fri, 19 Jun 2026 10:20:18 +0800 Subject: [PATCH] fix(arm): also negate motor direction for reversed J1 motor Previous +290 fix handled static position mapping but motion direction was still reversed. Correct formula: motor = -height - 290. This handles both: position endpoints (height -290/-0 maps correctly) AND motion direction (increasing height now moves arm up instead of down). Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- ros2/src/udp_teleop/udp_teleop/arm_control.py | 2 +- ros2/src/udp_teleop/udp_teleop/keyboard_control.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ros2/src/udp_teleop/udp_teleop/arm_control.py b/ros2/src/udp_teleop/udp_teleop/arm_control.py index 89884a3..6b4e7b6 100644 --- a/ros2/src/udp_teleop/udp_teleop/arm_control.py +++ b/ros2/src/udp_teleop/udp_teleop/arm_control.py @@ -128,7 +128,7 @@ class ArmJointState: def to_udp_message(self) -> bytes: """转换为 UDP 消息""" return ( - f"JXB:{self.height + 290}:{self.j2}:{self.j3}:{self.j4}:" + f"JXB:{-self.height - 290}:{self.j2}:{self.j3}:{self.j4}:" f"{self.j5}:{self.j6}:0:0:EZHY\n" ).encode("utf-8") diff --git a/ros2/src/udp_teleop/udp_teleop/keyboard_control.py b/ros2/src/udp_teleop/udp_teleop/keyboard_control.py index a2c12c8..bcefe96 100644 --- a/ros2/src/udp_teleop/udp_teleop/keyboard_control.py +++ b/ros2/src/udp_teleop/udp_teleop/keyboard_control.py @@ -310,7 +310,7 @@ class KeyboardUdpControlNode(Node): def build_arm_cmd(self): joints = self.arm_joints return ( - f"JXB:{self.arm_height + 290}:" + f"JXB:{-self.arm_height - 290}:" f"{joints[0]}:{joints[1]}:{joints[2]}:" f"{joints[3]}:{joints[4]}:0:0:EZHY\n" ).encode()