diff --git a/ros2/src/udp_teleop/udp_teleop/vision_grasp.py b/ros2/src/udp_teleop/udp_teleop/vision_grasp.py index 6651209..2026943 100644 --- a/ros2/src/udp_teleop/udp_teleop/vision_grasp.py +++ b/ros2/src/udp_teleop/udp_teleop/vision_grasp.py @@ -71,10 +71,14 @@ def tcp_to_base( """TCP 坐标系 → 机械臂基坐标系(水平相机版本)""" phi = math.radians(tcp_phi_deg) + # 旋转矩阵:TCP → 基坐标系 + # TCP X → 基坐标 -Y + # TCP Y → 基坐标 -Z + # TCP Z → 基坐标 X R_tcp_to_base = np.array([ - [-math.sin(phi), 0, math.cos(phi)], - [ math.cos(phi), 0, math.sin(phi)], - [0, -1, 0] + [-math.sin(phi), 0, math.cos(phi)], # X_base + [-math.cos(phi), 0, -math.sin(phi)], # Y_base (修正:添加负号) + [0, -1, 0] # Z_base ]) P_tcp = np.array([xt, yt, zt])