|
|
@ -20,9 +20,10 @@ void MiniServoCtrlModule::initialize(uint16_t module_id, FeiTeServoMotor *bus, u |
|
|
|
mini_servo_enable(1); |
|
|
|
} |
|
|
|
void MiniServoCtrlModule::create_default_config(config_t &cfg) { |
|
|
|
cfg.limit_velocity = 10000; |
|
|
|
cfg.limit_torque = 300; |
|
|
|
cfg.protective_torque = 800; |
|
|
|
cfg.limit_velocity = 10000; |
|
|
|
cfg.limit_torque = 300; |
|
|
|
cfg.protective_torque = 800; |
|
|
|
cfg.target_pos_tolerance = 15; |
|
|
|
} |
|
|
|
|
|
|
|
int32_t MiniServoCtrlModule::getid(int32_t *id) { |
|
|
@ -36,6 +37,7 @@ int32_t MiniServoCtrlModule::module_xxx_reg(int32_t param_id, bool read, int32_t |
|
|
|
PROCESS_REG(kreg_mini_servo_limit_velocity, REG_GET(m_cfg.limit_velocity), REG_SET(m_cfg.limit_velocity)); |
|
|
|
PROCESS_REG(kreg_mini_servo_limit_torque, REG_GET(m_cfg.limit_torque), REG_SET(m_cfg.limit_torque)); |
|
|
|
PROCESS_REG(kreg_mini_servo_protective_torque, REG_GET(m_cfg.protective_torque), REG_SET(m_cfg.protective_torque)); |
|
|
|
PROCESS_REG(kreg_mini_servo_target_pos_tolerance, REG_GET(m_cfg.target_pos_tolerance), REG_SET(m_cfg.target_pos_tolerance)); |
|
|
|
PROCESS_REG(kreg_mini_servo_is_move, mini_servo_is_move(&val), ACTION_NONE); |
|
|
|
|
|
|
|
PROCESS_REG(kreg_mini_servo_status, mini_servo_read_reg(kreg_mini_servo_status, &val), ACTION_NONE); |
|
|
@ -174,12 +176,11 @@ int32_t MiniServoCtrlModule::mini_servo_move_to(int32_t pos3600) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
while (true) { |
|
|
|
if (m_thread.getExitFlag()) break; |
|
|
|
if (!check_when_run(&status)) break; |
|
|
|
|
|
|
|
if (poseq(status.pos, pos3600, 10) && status.isMove == 0) break; |
|
|
|
if (poseq(status.pos, pos3600, m_cfg.target_pos_tolerance) && status.isMove == 0) break; |
|
|
|
|
|
|
|
vTaskDelay(5); |
|
|
|
} |
|
|
|