fix enable

This commit is contained in:
xxxxm 2026-03-18 01:51:56 +08:00
parent 50d6c0b337
commit e9e2d62662
3 changed files with 8 additions and 10 deletions

View File

@ -212,6 +212,7 @@ public:
// 更新每个关节
for (Joint* joint : joints_) { // 遍历关节数组
if (joint) {
joint->Enable();
joint->Update();
}
}

View File

@ -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,

View File

@ -286,13 +286,10 @@ void Task_arm_main(void* argument) {
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();
}