6 changed files with 625 additions and 87 deletions
-
334components/step_motor_ctrl_module/step_motor_ctrl_module.cpp
-
95components/step_motor_ctrl_module/step_motor_ctrl_module.hpp
-
85components/zcancmder/cmd/basic_bean.hpp
-
102components/zcancmder/cmd/c1006_module_cmd.hpp
-
80components/zcancmder/cmd/c1007_module_cmd.hpp
-
16components/zcancmder_module/zcan_xy_robot_module.cpp
@ -0,0 +1,334 @@ |
|||
#include "step_motor_ctrl_module.hpp"
|
|||
|
|||
#include "sdk/components/errorcode/errorcode.hpp"
|
|||
|
|||
using namespace iflytop; |
|||
#define TAG "StepMotorCtrlModule"
|
|||
void StepMotorCtrlModule::initialize(int id, IStepperMotor* stepM, ZGPIO* zero_gpio, ZGPIO* end_gpio) { |
|||
m_id = id; |
|||
m_stepM1 = stepM; |
|||
m_Xgpio = zero_gpio; |
|||
m_end_gpio = end_gpio; |
|||
|
|||
m_lock.init(); |
|||
m_statu_lock.init(); |
|||
m_thread.init("XYRobotCtrlModule", 1024, osPriorityNormal); |
|||
} |
|||
|
|||
int32_t StepMotorCtrlModule::set_acc(int32_t acc) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_acc %d", m_id, acc); |
|||
m_cfg_acc = acc; |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_dec(int32_t dec) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_dec %d", m_id, dec); |
|||
m_cfg_dec = dec; |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_break_dec(int32_t dec) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_break_dec %d", m_id, dec); |
|||
m_cfg_break_dec = dec; |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_speed(int32_t speed) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_speed %d", m_id, speed); |
|||
m_cfg_velocity = speed; |
|||
return 0; |
|||
} |
|||
#if 0
|
|||
int32_t StepMotorCtrlModule::set_zero_robottype(RobotType_t robot_type) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_zero_robottype %d", m_id, robot_type); |
|||
m_robot_type = robot_type; |
|||
return 0; |
|||
} |
|||
#endif
|
|||
int32_t StepMotorCtrlModule::set_shaft(bool shaft) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_shaft %d", m_id, shaft); |
|||
m_x_shaft = shaft; |
|||
m_stepM1->setMotorShaft(shaft); |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_zero_shift(int32_t shift) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_zero_shift %d", m_id, shift); |
|||
m_zero_shift_x = shift; |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_runtozero_max_distance(int32_t distance) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_runtozero_max_distance %d", m_id, distance); |
|||
m_cfg_runtozero_maxX = distance; |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_runtozero_speed(int32_t speed) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_runtozero_speed %d", m_id, speed); |
|||
m_cfg_runtozero_speed = speed; |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_runtozero_dec(int32_t dec) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_runtozero_dec %d", m_id, dec); |
|||
m_cfg_runtozero_dec = dec; |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_runtozero_leave_away_zero_distance(int32_t distance) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_runtozero_leave_away_zero_distance %d", m_id, distance); |
|||
m_cfg_runtozero_leave_away_zero_max_distance = distance; |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_distance_scale(float distance_scale) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_distance_scale %f", m_id, distance_scale); |
|||
m_cfg_distance_scale = distance_scale; |
|||
m_stepM1->setScale(distance_scale); |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_current_pos(int32_t xpos) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_current_pos %d", m_id, xpos); |
|||
int32_t motor_pos = 0; |
|||
forward_kinematics(xpos, motor_pos); |
|||
m_stepM1->setXACTUAL(motor_pos); |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::set_ihold_irun_iholddelay(uint8_t ihold, uint8_t irun, uint16_t iholddelay) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d set_ihold_irun_iholddelay %d %d %d", m_id, ihold, irun, iholddelay); |
|||
m_stepM1->setIHOLD_IRUN(ihold, irun, iholddelay); |
|||
return 0; |
|||
} |
|||
|
|||
void StepMotorCtrlModule::dumpcfg(const char* tag) {} |
|||
|
|||
int32_t StepMotorCtrlModule::enable(bool venable) { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d enable %d", m_id, venable); |
|||
m_stepM1->enable(venable); |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::stop() { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d stop", m_id); |
|||
m_thread.stop(); |
|||
m_stepM1->stop(); |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::brake() { |
|||
zlock_guard l(m_lock); |
|||
ZLOGI(TAG, "m%d brake", m_id); |
|||
m_stepM1->setDeceleration(m_cfg_break_dec); |
|||
m_stepM1->stop(); |
|||
m_thread.stop(); |
|||
m_stepM1->stop(); |
|||
return 0; |
|||
} |
|||
|
|||
/*******************************************************************************
|
|||
* ACTION * |
|||
*******************************************************************************/ |
|||
int32_t StepMotorCtrlModule::move_to(int32_t xnow, function<void(int32_t exec_status, int32_t toxnow)> status_cb) { |
|||
zlock_guard lock(m_lock); |
|||
ZLOGI(TAG, "m%d move_to %d", m_id, xnow); |
|||
m_thread.stop(); |
|||
|
|||
updateStatus(1); |
|||
m_thread.start([this, xnow, status_cb]() { |
|||
_motor_move_to(xnow, m_cfg_velocity, m_cfg_acc, m_cfg_dec); |
|||
while (!_motor_is_reach_target()) { |
|||
if (m_thread.getExitFlag()) break; |
|||
vTaskDelay(10); |
|||
} |
|||
_motor_stop(); |
|||
|
|||
int32_t xnow = 0; |
|||
getnowpos(xnow); |
|||
if (status_cb) status_cb(0, xnow); |
|||
updateStatus(0); |
|||
}); |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::move_by(int32_t dpos, function<void(int32_t exec_status, int32_t topos)> status_cb) { //
|
|||
zlock_guard lock(m_lock); |
|||
ZLOGI(TAG, "m%d move_by %d", m_id, dpos); |
|||
m_thread.stop(); |
|||
|
|||
int32_t xnow = 0; |
|||
getnowpos(xnow); |
|||
|
|||
int32_t toxnow = xnow + dpos; |
|||
move_to(toxnow, status_cb); |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::move_to_zero(function<void(int32_t exec_status, int32_t dpos)> status_cb) { |
|||
zlock_guard lock(m_lock); |
|||
ZLOGI(TAG, "m%d move_to_zero", m_id); |
|||
m_thread.stop(); |
|||
|
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::move_to_zero_with_calibrate(int32_t nowx, function<void(int32_t exec_status, int32_t zero_shift_pos)> status_cb) { |
|||
zlock_guard lock(m_lock); |
|||
ZLOGI(TAG, "move_to_zero_with_calibrate x:%d", nowx); |
|||
m_thread.stop(); |
|||
updateStatus(1); |
|||
|
|||
m_thread.start([this, nowx, status_cb]() { |
|||
int32_t dx; |
|||
int32_t erro = exec_move_to_zero_task(dx); |
|||
if (erro != 0) { |
|||
ZLOGI(TAG, "exec_move_to_zero_task failed:%d", erro); |
|||
_motor_stop(); |
|||
if (status_cb) status_cb(erro, 0); |
|||
updateStatus(0); |
|||
return; |
|||
} |
|||
|
|||
int32_t calibrate_x, calibrate_y; |
|||
calibrate_x = dx + nowx; |
|||
|
|||
m_zero_shift_x = calibrate_x; |
|||
|
|||
m_stepM1->setXACTUAL(0); |
|||
if (status_cb) status_cb(erro, m_zero_shift_x); |
|||
updateStatus(0); |
|||
return; |
|||
}); |
|||
|
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::rotate(uint8_t direction, int32_t velocity, int32_t acc) { return 0; } |
|||
|
|||
/*******************************************************************************
|
|||
* READ * |
|||
*******************************************************************************/ |
|||
|
|||
int32_t StepMotorCtrlModule::read_status(uint8_t* module_statu, int32_t* pos, int32_t* velocity) { |
|||
zlock_guard lock(m_statu_lock); |
|||
*module_statu = m_status; |
|||
getnowpos(*pos); |
|||
*velocity = m_stepM1->getVACTUAL(); |
|||
return 0; |
|||
} |
|||
int32_t StepMotorCtrlModule::get_zero_shift(int32_t* pos) { |
|||
zlock_guard lock(m_lock); |
|||
*pos = m_zero_shift_x; |
|||
return 0; |
|||
} |
|||
|
|||
/*******************************************************************************
|
|||
* PRIVATE * |
|||
*******************************************************************************/ |
|||
void StepMotorCtrlModule::updateStatus(uint8_t status) { |
|||
zlock_guard lock(m_statu_lock); |
|||
m_status = status; |
|||
} |
|||
int32_t StepMotorCtrlModule::exec_move_to_zero_task(int32_t& dx) { |
|||
int32_t xnow; |
|||
getnowpos(xnow); |
|||
|
|||
int32_t ret = exec_move_to_zero_task(); |
|||
|
|||
int32_t xnow2; |
|||
getnowpos(xnow2); |
|||
|
|||
dx = xnow2 - xnow; |
|||
return ret; |
|||
} |
|||
int32_t StepMotorCtrlModule::exec_move_to_zero_task() { |
|||
/*******************************************************************************
|
|||
* 远离X零点 * |
|||
*******************************************************************************/ |
|||
if (m_Xgpio->getState()) { |
|||
/**
|
|||
* @brief 如果设备已经在零点,则反向移动一定距离远离零点 |
|||
*/ |
|||
_motor_move_by(m_cfg_runtozero_leave_away_zero_max_distance, m_cfg_runtozero_speed, m_cfg_acc, m_cfg_runtozero_dec); |
|||
while (!_motor_is_reach_target()) { |
|||
if (m_thread.getExitFlag()) break; |
|||
vTaskDelay(1); |
|||
} |
|||
|
|||
if (m_thread.getExitFlag()) { |
|||
ZLOGI(TAG, "break move to zero thread exit"); |
|||
return 0; |
|||
} |
|||
if (m_Xgpio->getState()) { |
|||
ZLOGE(TAG, "leave away zero failed"); |
|||
return err::kcommon_error_x_leave_away_zero_point_fail; |
|||
} |
|||
} |
|||
/*******************************************************************************
|
|||
* 移动X轴到零点 * |
|||
*******************************************************************************/ |
|||
_motor_move_by(-m_cfg_runtozero_maxX, m_cfg_runtozero_speed, m_cfg_acc, m_cfg_runtozero_dec); |
|||
bool xreach_zero = false; |
|||
while (!m_thread.getExitFlag() && !_motor_is_reach_target()) { |
|||
// ZLOGI(TAG, "xgpio %d %d %d", m_Xgpio->getState(), m_stepM1->isReachTarget(), m_stepM2->isReachTarget());
|
|||
if (m_Xgpio->getState()) { |
|||
xreach_zero = true; |
|||
_motor_stop(-1); |
|||
break; |
|||
} |
|||
vTaskDelay(1); |
|||
} |
|||
|
|||
if (!xreach_zero) { |
|||
// 触发异常回调
|
|||
ZLOGE(TAG, "x reach zero failed"); |
|||
return err::kcommon_error_not_found_x_zero_point; |
|||
} |
|||
|
|||
if (m_thread.getExitFlag()) { |
|||
ZLOGI(TAG, "break move to zero thread exit"); |
|||
return 0; |
|||
} |
|||
|
|||
ZLOGI(TAG, "x reach zero"); |
|||
ZLOGI(TAG, "move_to_zero success"); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
void StepMotorCtrlModule::getnowpos(int32_t& pos) { |
|||
int32_t motor_pos = m_stepM1->getXACTUAL(); |
|||
forward_kinematics(motor_pos, pos); |
|||
} |
|||
void StepMotorCtrlModule::_motor_move_to(int32_t pos, int32_t maxv, int32_t acc, int32_t dec) { |
|||
ZLOGI(TAG, "m%d _motor_move_to %d maxv:%d acc:%d dec:%d", m_id, pos, maxv, acc, dec); |
|||
m_stepM1->setAcceleration(acc); |
|||
m_stepM1->setDeceleration(dec); |
|||
m_stepM1->moveTo(pos, maxv); |
|||
} |
|||
void StepMotorCtrlModule::_motor_move_by(int32_t dpos, int32_t maxv, int32_t acc, int32_t dec) { |
|||
ZLOGI(TAG, "m%d _motor_move_by %d maxv:%d acc:%d dec:%d", m_id, dpos, maxv, acc, dec); |
|||
m_stepM1->setAcceleration(acc); |
|||
m_stepM1->setDeceleration(dec); |
|||
m_stepM1->moveBy(dpos, maxv); |
|||
} |
|||
void StepMotorCtrlModule::_motor_stop(int32_t dec = -1) { |
|||
ZLOGI(TAG, "m%d _motor_stop %d", m_id, dec); |
|||
if (dec > 0) { |
|||
m_stepM1->setDeceleration(dec); |
|||
} |
|||
m_stepM1->stop(); |
|||
} |
|||
bool StepMotorCtrlModule::_motor_is_reach_target() { return m_stepM1->isReachTarget(); } |
|||
void StepMotorCtrlModule::inverse_kinematics(int32_t motor_pos, int32_t& x) { |
|||
// m_zero_shift_x
|
|||
x = motor_pos; |
|||
if (m_x_shaft) x = -x; |
|||
x += m_zero_shift_x; |
|||
} |
|||
void StepMotorCtrlModule::forward_kinematics(int32_t x, int32_t& motor_pos) { |
|||
if (m_x_shaft) x = -x; |
|||
x -= m_zero_shift_x; |
|||
motor_pos = x; |
|||
} |
@ -0,0 +1,95 @@ |
|||
#pragma once
|
|||
//
|
|||
#include "sdk/os/zos.hpp"
|
|||
#include "sdk\components\tmc\basic\tmc_ic_interface.hpp"
|
|||
#include "sdk\components\zcancmder\zcanreceiver.hpp"
|
|||
|
|||
namespace iflytop { |
|||
class StepMotorCtrlModule { |
|||
public: |
|||
private: |
|||
IStepperMotor* m_stepM1; |
|||
int m_id = 0; |
|||
|
|||
ZGPIO* m_Xgpio; |
|||
ZGPIO* m_end_gpio; |
|||
|
|||
ZThread m_thread; |
|||
|
|||
uint8_t m_status = 0; |
|||
|
|||
int32_t m_zero_shift_x = 0; |
|||
|
|||
zmutex m_lock; |
|||
zmutex m_statu_lock; |
|||
|
|||
int32_t m_cfg_acc = 300000; |
|||
int32_t m_cfg_dec = 300000; |
|||
int32_t m_cfg_break_dec = 300000; |
|||
int32_t m_cfg_velocity = 300000; |
|||
|
|||
int32_t m_cfg_runtozero_maxX = 5120000; |
|||
int32_t m_cfg_runtozero_speed = 30000; |
|||
int32_t m_cfg_runtozero_dec = 600000; |
|||
int32_t m_cfg_runtozero_leave_away_zero_max_distance = 51200; |
|||
float m_cfg_distance_scale = 1.0f; |
|||
|
|||
bool m_x_shaft = false; |
|||
|
|||
public: |
|||
void initialize(int id, IStepperMotor* stepM, ZGPIO* zero_gpio, ZGPIO* end_gpio); |
|||
|
|||
int32_t set_current_pos(int32_t pos); |
|||
int32_t set_distance_scale(float distance_scale); |
|||
int32_t set_ihold_irun_iholddelay(uint8_t ihold, uint8_t irun, uint16_t iholddelay); |
|||
int32_t set_acc(int32_t acc); |
|||
int32_t set_dec(int32_t dec); |
|||
int32_t set_speed(int32_t speed); |
|||
int32_t set_shaft(bool shaft); |
|||
int32_t set_runtozero_max_distance(int32_t distance); |
|||
int32_t set_runtozero_speed(int32_t speed); |
|||
int32_t set_runtozero_dec(int32_t dec); |
|||
int32_t set_runtozero_leave_away_zero_distance(int32_t distance); |
|||
int32_t set_zero_shift(int32_t shift); |
|||
int32_t set_break_dec(int32_t dec); |
|||
|
|||
void dumpcfg(const char* tag); |
|||
|
|||
int32_t enable(bool venable); |
|||
int32_t stop(); |
|||
int32_t brake(); |
|||
|
|||
/*******************************************************************************
|
|||
* ACTION * |
|||
*******************************************************************************/ |
|||
int32_t move_to(int32_t pos, function<void(int32_t exec_status, int32_t topos)> status_cb); |
|||
int32_t move_by(int32_t dpos, function<void(int32_t exec_status, int32_t topos)> status_cb); |
|||
int32_t move_to_zero(function<void(int32_t exec_status, int32_t dpos)> status_cb); |
|||
int32_t move_to_zero_with_calibrate(int32_t nowpos, function<void(int32_t exec_status, int32_t zero_shift_pos)> status_cb); |
|||
int32_t rotate(uint8_t direction, int32_t velocity, int32_t acc); |
|||
|
|||
/*******************************************************************************
|
|||
* READ * |
|||
*******************************************************************************/ |
|||
|
|||
int32_t read_status(uint8_t* module_statu, int32_t* pos, int32_t* velocity); |
|||
int32_t read_gpio_status(bool* zeroio, bool* endio); |
|||
int32_t get_zero_shift(int32_t* pos); |
|||
|
|||
private: |
|||
void updateStatus(uint8_t status); |
|||
|
|||
void getnowpos(int32_t& pos); |
|||
|
|||
int32_t exec_move_to_zero_task(int32_t& dx); |
|||
int32_t exec_move_to_zero_task(); |
|||
|
|||
void _motor_move_to(int32_t pos, int32_t maxv, int32_t acc, int32_t dec); |
|||
void _motor_move_by(int32_t dpos, int32_t maxv, int32_t acc, int32_t dec); |
|||
void _motor_stop(int32_t dec = -1); |
|||
bool _motor_is_reach_target(); |
|||
|
|||
void inverse_kinematics(int32_t motor_pos, int32_t& x); |
|||
void forward_kinematics(int32_t x, int32_t& motor_pos); |
|||
}; |
|||
} // namespace iflytop
|
@ -0,0 +1,80 @@ |
|||
#pragma once
|
|||
#include <stdint.h>
|
|||
|
|||
#include "basic_bean.hpp"
|
|||
namespace iflytop { |
|||
namespace zcr { |
|||
|
|||
/*******************************************************************************
|
|||
* 1007 * |
|||
*******************************************************************************/ |
|||
#pragma pack(push, 1)
|
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_enable, /* */ cmd, u8 id; u8 enable;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_stop, /* */ cmd, u8 id;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_to_zero, /* */ cmd, u8 id;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_to_zero_with_calibrate, /* */ cmd, u8 id;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_to, /* */ cmd, u8 id; s32 pos;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_by, /* */ cmd, u8 id; s32 distance;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_rotate, /* */ cmd, u8 id; s32 angle;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_break, /* */ cmd, u8 id;); |
|||
|
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_read_status, /* */ cmd, u8 id;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_read_io, /* */ cmd, u8 id;); |
|||
|
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl___p1, /* */ cmd, u8 id;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_current_pos, /* */ cmd, u8 id; s32 pos;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_distance_scale, /* */ cmd, u8 id; s32 scale;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_ihold_irun_iholddelay, /* */ cmd, u8 id; u8 ihold; u8 irun; u8 iholddelay;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_acc, /* */ cmd, u8 id; s32 acc;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_dec, /* */ cmd, u8 id; s32 dec;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_speed, /* */ cmd, u8 id; s32 speed;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_shaft, /* */ cmd, u8 id; u8 shaft;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_runtozero_max_distance, /* */ cmd, u8 id; s32 max_distance;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_runtozero_speed, /* */ cmd, u8 id; s32 speed;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_runtozero_dec, /* */ cmd, u8 id; s32 dec;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_runtozero_leave_away_zero_distance, /* */ cmd, u8 id; s32 distance;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_zero_shift, /* */ cmd, u8 id; s32 x_shift; s32 y_shift;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_break_dec, /* */ cmd, u8 id; s32 dec;); |
|||
|
|||
/*******************************************************************************
|
|||
* ACK * |
|||
*******************************************************************************/ |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_enable, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_stop, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_to_zero, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_to_zero_with_calibrate, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_to, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_by, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_rotate, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_break, /* */ ack, u8 id; u8 _pad;); |
|||
|
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_read_status, /* */ ack, u8 id; u8 _pad; u8 module_statu; s32 pos; s32 velocity;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_read_io, /* */ ack, u8 id; u8 _pad; u8 zeroio; u8 endio;); |
|||
|
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl___p1, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_current_pos, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_distance_scale, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_ihold_irun_iholddelay, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_acc, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_dec, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_speed, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_shaft, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_runtozero_max_distance, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_runtozero_speed, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_runtozero_dec, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_runtozero_leave_away_zero_distance, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_zero_shift, /* */ ack, u8 id; u8 _pad;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_set_break_dec, /* */ ack, u8 id; u8 _pad;); |
|||
|
|||
/*******************************************************************************
|
|||
* status_report * |
|||
*******************************************************************************/ |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_to_zero, /* */ status_report, u8 id; u8 _pad; s32 exec_status; s32 ddistance;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_to_zero_with_calibrate, /* */ status_report, u8 id; u8 _pad; s32 exec_status; s32 zero_shift;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_to, /* */ status_report, u8 id; u8 _pad; s32 exec_status; s32 npos;); |
|||
ZPACKET_STRUCT(kcmd_step_motor_ctrl_move_by, /* */ status_report, u8 id; u8 _pad; s32 exec_status; s32 ddistance;); |
|||
|
|||
#pragma pack(pop)
|
|||
|
|||
} // namespace zcr
|
|||
} // namespace iflytop
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue