|
@ -106,7 +106,17 @@ int32_t MiniServoCtrlModule::mini_servo_move_to(int32_t pos3600) { |
|
|
{ |
|
|
{ |
|
|
int32_t velocity = m_cfg.limit_velocity; |
|
|
int32_t velocity = m_cfg.limit_velocity; |
|
|
|
|
|
|
|
|
m_bus->runInMode0(m_idinbus, m_cfg.limit_torque, m_cfg.limit_velocity, pos3600); |
|
|
|
|
|
|
|
|
bool callsuc = false; |
|
|
|
|
|
for (size_t i = 0; i < 3; i++) { |
|
|
|
|
|
callsuc = m_bus->runInMode0(m_idinbus, m_cfg.limit_torque, m_cfg.limit_velocity, pos3600); |
|
|
|
|
|
if (!callsuc) continue; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!callsuc) { |
|
|
|
|
|
creg.module_errorcode = err::ksubdevice_overtime; |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int32_t moveflag = 0; |
|
|
int32_t moveflag = 0; |
|
|
int32_t nowpos = 0; |
|
|
int32_t nowpos = 0; |
|
@ -125,10 +135,12 @@ int32_t MiniServoCtrlModule::mini_servo_move_to(int32_t pos3600) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
after_motor_move(); |
|
|
|
|
|
ZLOGI(TAG, "move to pos %d", pos3600); |
|
|
ZLOGI(TAG, "move to pos %d", pos3600); |
|
|
}, |
|
|
}, |
|
|
[this]() { inter_mini_servo_stop(0); }); |
|
|
|
|
|
|
|
|
[this]() { |
|
|
|
|
|
after_motor_move(); |
|
|
|
|
|
inter_mini_servo_stop(0); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
@ -174,8 +186,8 @@ int32_t MiniServoCtrlModule::mini_servo_read_io_state(int32_t ioindex, int32_t * |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void MiniServoCtrlModule::befor_motor_move() { |
|
|
void MiniServoCtrlModule::befor_motor_move() { |
|
|
creg.module_status = 1; |
|
|
|
|
|
creg.module_errorcode = 0; |
|
|
|
|
|
|
|
|
creg.module_status = 1; |
|
|
|
|
|
creg.module_errorcode = 0; |
|
|
} |
|
|
} |
|
|
void MiniServoCtrlModule::after_motor_move() { |
|
|
void MiniServoCtrlModule::after_motor_move() { |
|
|
if (creg.module_errorcode != 0) { |
|
|
if (creg.module_errorcode != 0) { |
|
|