|
@ -430,7 +430,7 @@ bool StepMotorCtrlModule::exec_move_to_io_task(int32_t ioindex, int32_t directio |
|
|
// 如果设备已经在零点,则反向移动一定距离远离零点
|
|
|
// 如果设备已经在零点,则反向移动一定距离远离零点
|
|
|
if (gpio->getState()) { |
|
|
if (gpio->getState()) { |
|
|
ZLOGI(TAG, "---------STEP2-------- find edge"); |
|
|
ZLOGI(TAG, "---------STEP2-------- find edge"); |
|
|
_rotate(-direction * lookPointVelocity, lookPointDec); |
|
|
|
|
|
|
|
|
_rotate(-direction * lookPointVelocity, lookPointDec); |
|
|
bool reach_edge = false; |
|
|
bool reach_edge = false; |
|
|
|
|
|
|
|
|
while (!m_thread.getExitFlag()) { |
|
|
while (!m_thread.getExitFlag()) { |
|
@ -495,8 +495,11 @@ bool StepMotorCtrlModule::exec_move_to_io_task(int32_t ioindex, int32_t directio |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void StepMotorCtrlModule::_rotate(int32_t velocity, int32_t acc) { |
|
|
void StepMotorCtrlModule::_rotate(int32_t velocity, int32_t acc) { |
|
|
m_stepM1->set_amax(acc); |
|
|
|
|
|
m_stepM1->rotate(velocity); |
|
|
|
|
|
|
|
|
if (velocity > 0) { |
|
|
|
|
|
m_stepM1->moveToEnd(1, abs(velocity)); |
|
|
|
|
|
} else { |
|
|
|
|
|
m_stepM1->moveToEnd(-1, abs(velocity)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
/***********************************************************************************************************************
|
|
@ -625,7 +628,6 @@ int32_t StepMotorCtrlModule::do_step_motor_easy_move_to(int32_t tox) { |
|
|
befor_motor_move(); |
|
|
befor_motor_move(); |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
m_stepM1->setAcceleration(m_cfg.motor_amax); |
|
|
|
|
|
int32_t motor_pos = 0; |
|
|
int32_t motor_pos = 0; |
|
|
inter_forward_kinematics(tox, motor_pos); |
|
|
inter_forward_kinematics(tox, motor_pos); |
|
|
m_stepM1->moveTo(motor_pos, m_cfg.motor_default_velocity); |
|
|
m_stepM1->moveTo(motor_pos, m_cfg.motor_default_velocity); |
|
|