From e9e2d62662e356b1a168948bbdc78003f21da9fe Mon Sep 17 00:00:00 2001 From: xxxxm <2389287465@qq.com> Date: Wed, 18 Mar 2026 01:51:56 +0800 Subject: [PATCH] fix enable --- User/module/arm_oop.hpp | 1 + User/module/config.c | 8 ++++---- User/task/arm_main.cpp | 9 +++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/User/module/arm_oop.hpp b/User/module/arm_oop.hpp index b1e4641..5a74643 100644 --- a/User/module/arm_oop.hpp +++ b/User/module/arm_oop.hpp @@ -212,6 +212,7 @@ public: // 更新每个关节 for (Joint* joint : joints_) { // 遍历关节数组 if (joint) { + joint->Enable(); joint->Update(); } } diff --git a/User/module/config.c b/User/module/config.c index e25d07c..46b987b 100644 --- a/User/module/config.c +++ b/User/module/config.c @@ -23,28 +23,28 @@ Config_RobotParam_t robot_config = { /* DJI3508µç»ú*/ .motor_param = { { - .can = BSP_CAN_2, + .can = BSP_CAN_1, .id = 0x201, .module = MOTOR_M3508, .reverse = false, .gear = true }, { - .can = BSP_CAN_2, + .can = BSP_CAN_1, .id = 0x202, .module = MOTOR_M3508, .reverse = false, .gear = true }, { - .can = BSP_CAN_2, + .can = BSP_CAN_1, .id = 0x203, .module = MOTOR_M3508, .reverse = false, .gear = true }, { - .can = BSP_CAN_2, + .can = BSP_CAN_1, .id = 0x204, .module = MOTOR_M3508, .reverse = false, diff --git a/User/task/arm_main.cpp b/User/task/arm_main.cpp index e59abc8..206d19d 100644 --- a/User/task/arm_main.cpp +++ b/User/task/arm_main.cpp @@ -285,14 +285,11 @@ void Task_arm_main(void* argument) { robot_arm->Update(); osMessageQueueGet(task_runtime.msgq.arm.cmd, &arm_cmd, NULL, 0); - - // 使能状态变化沿处理:仅在变化时下发使能,减少冗余调用 - static bool last_enable = false; - if (arm_cmd.enable != last_enable) { - robot_arm->Enable(arm_cmd.enable); - } + + robot_arm->Enable(arm_cmd.enable); // 使能上升沿自动同步:避免使能时 target_pose 与当前实际位姿不一致导致初始跳变 + static bool last_enable = false; if (arm_cmd.enable && !last_enable) { SyncCommandTargetFromCurrent(); }