diff --git a/api/apibasic/cmdid.hpp b/api/apibasic/cmdid.hpp index 6018ee6..10c691e 100644 --- a/api/apibasic/cmdid.hpp +++ b/api/apibasic/cmdid.hpp @@ -19,80 +19,26 @@ typedef enum { virtual int32_t module_enable(int32_t enable) { return err::koperation_not_support; } virtual int32_t module_start() { return err::koperation_not_support; } #endif - kmodule_ping = CMDID(1, 0), // para:{}, ack:{} - kmodule_stop = CMDID(1, 1), // para:{}, ack:{} - kmodule_break = CMDID(1, 2), // para:{}, ack:{} - kmodule_get_last_exec_status = CMDID(1, 3), // para:{}, ack:{4} - kmodule_get_status = CMDID(1, 4), // para:{}, ack:{4} - kmodule_set_reg = CMDID(1, 5), // para:{4,4}, ack:{} - kmodule_get_reg = CMDID(1, 6), // para:{4}, ack:{4}I - kmodule_readio = CMDID(1, 7), // para:{}, ack:{4} - kmodule_writeio = CMDID(1, 8), // para:{4}, ack:{} - kmodule_read_adc = CMDID(1, 9), // para:{4}, ack:{4} - kmodule_get_error = CMDID(1, 10), // para:{}, ack:{1} - kmodule_clear_error = CMDID(1, 11), // para:{}, ack:{} - kmodule_set_inited_flag = CMDID(1, 12), // para:{4}, ack:{} - kmodule_get_inited_flag = CMDID(1, 13), // para:{}, ack:{4} - kmodule_factory_reset = CMDID(1, 14), // para:{}, ack:{} - kmodule_flush_cfg = CMDID(1, 15), // para:{}, ack:{} - kmodule_active_cfg = CMDID(1, 16), // para:{}, ack:{} - kmodule_read_raw = CMDID(1, 19), // para:{4,4}, ack:{4} - kmodule_enable = CMDID(1, 20), // para:{4}, ack:{} - kmodule_start = CMDID(1, 21), // para:{4}, ack:{} - -#if 0 - virtual int32_t motor_enable(int32_t enable) { return err::koperation_not_support; } - virtual int32_t motor_rotate(int32_t direction, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; } - virtual int32_t motor_move_by(int32_t distance, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; } - virtual int32_t motor_move_to(int32_t position, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; } - - virtual int32_t motor_rotate_acctime(int32_t direction, int32_t motor_velocity, int32_t acctime) { return err::koperation_not_support; } - virtual int32_t motor_move_by_acctime(int32_t distance, int32_t motor_velocity, int32_t acctime) { return err::koperation_not_support; } - virtual int32_t motor_move_to_acctime(int32_t position, int32_t motor_velocity, int32_t acctime) { return err::koperation_not_support; } - - virtual int32_t motor_rotate_with_torque(int32_t direction, int32_t torque) { return err::koperation_not_support; } - virtual int32_t motor_move_to_torque(int32_t pos, int32_t torque, int32_t overtime) { return err::koperation_not_support; } - - virtual int32_t motor_move_to_zero_forward(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { return err::koperation_not_support; } - virtual int32_t motor_move_to_zero_backward(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { return err::koperation_not_support; } - - virtual int32_t motor_move_to_zero_forward_and_calculated_shift(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { return err::koperation_not_support; } - virtual int32_t motor_move_to_zero_backward_and_calculated_shift(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { return err::koperation_not_support; } - - virtual int32_t motor_read_pos(int32_t* pos) { return err::koperation_not_support; } - virtual int32_t motor_set_current_pos_by_change_shift(int32_t pos) { return err::koperation_not_support; } // 一般用于舵机 - - virtual int32_t motor_easy_rotate(int32_t direction) { return err::koperation_not_support; }; - virtual int32_t motor_easy_move_by(int32_t distance) { return err::koperation_not_support; }; - virtual int32_t motor_easy_move_to(int32_t position) { return err::koperation_not_support; }; - virtual int32_t motor_easy_move_to_zero(int32_t direction) { return err::koperation_not_support; }; - virtual int32_t motor_easy_move_to_io(int32_t ioindex, int32_t direction) { return err::koperation_not_support; }; - -#endif - - kmotor_enable = CMDID(2, 1), // para:{1}, ack:{} - kmotor_rotate = CMDID(2, 2), // para:{1,4}, ack:{} - kmotor_move_by = CMDID(2, 3), // para:{4,4}, ack:{} - kmotor_move_to = CMDID(2, 4), // para:{4,4}, ack:{} - kmotor_rotate_acctime = CMDID(2, 5), // para:{4,4}, ack:{} - kmotor_move_by_acctime = CMDID(2, 6), // para:{4,4}, ack:{} - kmotor_move_to_acctime = CMDID(2, 7), // para:{4,4}, ack:{} - kmotor_rotate_with_torque = CMDID(2, 8), // para:{4,4}, ack:{} - kmotor_move_to_zero_forward = CMDID(2, 9), // para:{4,4,4,4}, ack:{} //int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime - kmotor_move_to_zero_backward = CMDID(2, 10), // para:{4,4,4,4}, ack:{} //int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime - kmotor_read_pos = CMDID(2, 11), // para:{}, ack:{4} - kmotor_set_current_pos_by_change_shift = CMDID(2, 12), // para:{4}, ack:{} - kmotor_motor_move_to_zero_forward_and_calculated_shift = CMDID(2, 13), // para:{4,4,4,4}, ack:{} //int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime - kmotor_motor_move_to_zero_backward_and_calculated_shift = CMDID(2, 14), // para:{4,4,4,4}, ack:{} //int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime - kmotor_move_to_torque = CMDID(2, 15), // para:{4,4,4}, ack:{} - kmotor_calculated_pos_by_move_to_zero = CMDID(2, 16), // para:{}, ack:{} - - kmotor_easy_rotate = CMDID(2, 17), // para:{4}, ack:{} - kmotor_easy_move_by = CMDID(2, 18), // para:{4}, ack:{} - kmotor_easy_move_to = CMDID(2, 19), // para:{4}, ack:{} - kmotor_easy_move_to_zero = CMDID(2, 20), // para:{1}, ack:{} - kmotor_easy_set_current_pos = CMDID(2, 21), // para:{4}, ack:{} - kmotor_easy_move_to_io = CMDID(2, 22), // para:{4,4}, ack:{} + kmodule_ping = CMDID(1, 0), // para:{}, ack:{} + kmodule_stop = CMDID(1, 1), // para:{}, ack:{} + kmodule_break = CMDID(1, 2), // para:{}, ack:{} + // kmodule_get_last_exec_status = CMDID(1, 3), // para:{}, ack:{4} + kmodule_get_status = CMDID(1, 4), // para:{}, ack:{4} + kmodule_set_reg = CMDID(1, 5), // para:{4,4}, ack:{} + kmodule_get_reg = CMDID(1, 6), // para:{4}, ack:{4}I + // kmodule_readio = CMDID(1, 7), // para:{}, ack:{4} + // kmodule_writeio = CMDID(1, 8), // para:{4}, ack:{} + // kmodule_read_adc = CMDID(1, 9), // para:{4}, ack:{4} + kmodule_get_error = CMDID(1, 10), // para:{}, ack:{1} + kmodule_clear_error = CMDID(1, 11), // para:{}, ack:{} + // kmodule_set_inited_flag = CMDID(1, 12), // para:{4}, ack:{} + // kmodule_get_inited_flag = CMDID(1, 13), // para:{}, ack:{4} + // kmodule_factory_reset = CMDID(1, 14), // para:{}, ack:{} + // kmodule_flush_cfg = CMDID(1, 15), // para:{}, ack:{} + // kmodule_active_cfg = CMDID(1, 16), // para:{}, ack:{} + kmodule_read_raw = CMDID(1, 19), // para:{4,4}, ack:{4} + kmodule_enable = CMDID(1, 20), // para:{4}, ack:{} +// kmodule_start = CMDID(1, 21), // para:{4}, ack:{} #if 0 virtual ~ZIXYMotor() {} @@ -151,6 +97,21 @@ typedef enum { ka8000_optical_read_laster_adc_val = CMDID(6, 6), // para:{4}, ack:{4} ka8000_optical_scan_current_point_amp_adc_val = CMDID(6, 7), // para:{4,4,4,4}, ack:{4,4} + /*********************************************************************************************************************** + * STEP_MOTOR * + ***********************************************************************************************************************/ + + kstep_motor_enable = CMDID(2, 1), // para:{1}, ack:{} + kstep_motor_read_pos = CMDID(2, 11), // para:{}, ack:{4} + kstep_motor_easy_rotate = CMDID(2, 17), // para:{4}, ack:{} + kstep_motor_easy_move_by = CMDID(2, 18), // para:{4}, ack:{} + kstep_motor_easy_move_to = CMDID(2, 19), // para:{4}, ack:{} + kstep_motor_easy_move_to_zero = CMDID(2, 20), // para:{1}, ack:{} + kstep_motor_easy_set_current_pos = CMDID(2, 21), // para:{4}, ack:{} + kstep_motor_easy_move_to_io = CMDID(2, 22), // para:{4,4}, ack:{} + kstep_motor_active_cfg = CMDID(2, 23), // para:{4,4}, ack:{} + kstep_motor_stop = CMDID(2, 24), // para:{4}, ack:{} + } cmdid_t; } // namespace zcr diff --git a/api/apibasic/module_type_index.hpp b/api/apibasic/module_type_index.hpp index 83df188..02e1e52 100644 --- a/api/apibasic/module_type_index.hpp +++ b/api/apibasic/module_type_index.hpp @@ -13,5 +13,8 @@ typedef enum { kpipette_ctrl_module = 7, // 移液体枪控制 ka8000_optical_module = 8, // a8000光学模组 klaster_scaner_module = 9, // a8000光学模组 + + ktmc_step_motor = 10, + } module_type_t; } \ No newline at end of file diff --git a/api/apibasic/reg_index.hpp b/api/apibasic/reg_index.hpp index 69b6be4..952245e 100644 --- a/api/apibasic/reg_index.hpp +++ b/api/apibasic/reg_index.hpp @@ -9,15 +9,10 @@ typedef enum { /******************************************************************************* * 模块通用配置和状态 * *******************************************************************************/ - kreg_module_version = REG_INDEX(0, 0, 0), // 模块版本 - kreg_module_type = REG_INDEX(0, 0, 1), // 模块类型 - kreg_module_status = REG_INDEX(0, 0, 2), // 0idle,1busy,2error - kreg_module_errorcode = REG_INDEX(0, 0, 3), // inited_flag - // kreg_module_initflag = REG_INDEX(0, 0, 4), // inited_flag - // kreg_module_enableflag = REG_INDEX(0, 0, 5), // 0idle,1busy,2error - // kreg_module_errorbitflag0 = REG_INDEX(0, 0, 6), // 模块异常标志,bit,每个模块自定义 - // kreg_module_input_state = REG_INDEX(0, 0, 8), // - // kreg_module_output_state = REG_INDEX(0, 0, 9), // + kreg_module_version = REG_INDEX(0, 0, 0), // 模块版本 + kreg_module_type = REG_INDEX(0, 0, 1), // 模块类型 + kreg_module_status = REG_INDEX(0, 0, 2), // 0idle,1busy,2error + kreg_module_errorcode = REG_INDEX(0, 0, 3), // inited_flag kreg_module_raw_sector_size = REG_INDEX(0, 0, 10), // sector_size kreg_module_raw_sector_num = REG_INDEX(0, 0, 11), // @@ -34,33 +29,6 @@ typedef enum { *******************************************************************************/ /******************************************************************************* - * MOTOR_DEFAULT * - *******************************************************************************/ - kreg_step_motor_pos = REG_INDEX(10, 0, 1), // 机器人x坐标 - kreg_step_motor_io_state = REG_INDEX(10, 0, 2), // IO状态 - kreg_step_motor_shift = REG_INDEX(10, 50, 0), // x偏移 - kreg_step_motor_shaft = REG_INDEX(10, 50, 1), // x轴是否反转 - kreg_step_motor_one_circle_pulse = REG_INDEX(10, 50, 2), // x轴一圈脉冲数 - kreg_step_motor_one_circle_pulse_denominator = REG_INDEX(10, 50, 3), // 设置一圈脉冲数的分母 - kreg_step_motor_default_velocity = REG_INDEX(10, 50, 4), // 默认速度 - kreg_step_motor_default_acc = REG_INDEX(10, 50, 5), // 默认加速度 - kreg_step_motor_default_dec = REG_INDEX(10, 50, 6), // 默认减速度 - kreg_step_motor_default_break_dec = REG_INDEX(10, 50, 7), // 默认减速度 - kreg_step_motor_ihold = REG_INDEX(10, 50, 8), // 步进电机电流配置 - kreg_step_motor_irun = REG_INDEX(10, 50, 9), // 步进电机电流配置 - kreg_step_motor_iholddelay = REG_INDEX(10, 50, 10), // 步进电机电流配置 - kreg_step_motor_iglobalscaler = REG_INDEX(10, 50, 11), // 步进电机电流配置 - kreg_step_motor_run_to_zero_max_d = REG_INDEX(10, 50, 21), // x轴回零最大距离 - kreg_step_motor_look_zero_edge_max_d = REG_INDEX(10, 50, 22), // x轴找零边缘最大距离 - kreg_step_motor_run_to_zero_speed = REG_INDEX(10, 50, 23), // 回零速度 - kreg_step_motor_run_to_zero_dec = REG_INDEX(10, 50, 24), // 回零减速度 - kreg_step_motor_look_zero_edge_speed = REG_INDEX(10, 50, 25), // 找零边缘速度 - kreg_step_motor_look_zero_edge_dec = REG_INDEX(10, 50, 26), // 找零边缘减速度 - kreg_step_motor_default_torque = REG_INDEX(10, 50, 27), // 默认扭矩 - kreg_step_motor_max_d = REG_INDEX(10, 50, 28), // 最大限制距离 - kreg_step_motor_min_d = REG_INDEX(10, 50, 29), // 最小限制距离 - - /******************************************************************************* * MOTOR_X * *******************************************************************************/ @@ -154,6 +122,36 @@ typedef enum { kreg_laster_scaner_adc_result_overflow = REG_INDEX(43, 0, 13), kreg_laster_scaner_laster_intensity = REG_INDEX(43, 0, 14), + /******************************************************************************* + * MOTOR_DEFAULT * + *******************************************************************************/ + kreg_step_motor_pos = REG_INDEX(10, 0, 1), // 机器人x坐标 + kreg_step_motor_io_state = REG_INDEX(10, 0, 2), // IO状态 + kreg_step_motor_shift = REG_INDEX(10, 50, 0), // x偏移 + kreg_step_motor_shaft = REG_INDEX(10, 50, 1), // x轴是否反转 + kreg_step_motor_one_circle_pulse = REG_INDEX(10, 50, 2), // x轴一圈脉冲数 + kreg_step_motor_one_circle_pulse_denominator = REG_INDEX(10, 50, 3), // 设置一圈脉冲数的分母 + kreg_step_motor_default_velocity = REG_INDEX(10, 50, 4), // 默认速度 + kreg_step_motor_default_acc = REG_INDEX(10, 50, 5), // 默认加速度 + kreg_step_motor_default_dec = REG_INDEX(10, 50, 6), // 默认减速度 + kreg_step_motor_default_break_dec = REG_INDEX(10, 50, 7), // 默认减速度 + kreg_step_motor_ihold = REG_INDEX(10, 50, 8), // 步进电机电流配置 + kreg_step_motor_irun = REG_INDEX(10, 50, 9), // 步进电机电流配置 + kreg_step_motor_iholddelay = REG_INDEX(10, 50, 10), // 步进电机电流配置 + kreg_step_motor_iglobalscaler = REG_INDEX(10, 50, 11), // 步进电机电流配置 + kreg_step_motor_run_to_zero_max_d = REG_INDEX(10, 50, 21), // x轴回零最大距离 + kreg_step_motor_look_zero_edge_max_d = REG_INDEX(10, 50, 22), // x轴找零边缘最大距离 + kreg_step_motor_run_to_zero_speed = REG_INDEX(10, 50, 23), // 回零速度 + kreg_step_motor_run_to_zero_dec = REG_INDEX(10, 50, 24), // 回零减速度 + kreg_step_motor_look_zero_edge_speed = REG_INDEX(10, 50, 25), // 找零边缘速度 + kreg_step_motor_look_zero_edge_dec = REG_INDEX(10, 50, 26), // 找零边缘减速度 + kreg_step_motor_default_torque = REG_INDEX(10, 50, 27), // 默认扭矩 + kreg_step_motor_max_d = REG_INDEX(10, 50, 28), // 最大限制距离 + kreg_step_motor_min_d = REG_INDEX(10, 50, 29), // 最小限制距离 + + + + /*********************************************************************************************************************** * XYROBOT * ***********************************************************************************************************************/ diff --git a/api/zi_module.hpp b/api/zi_module.hpp index ef76156..6fea657 100644 --- a/api/zi_module.hpp +++ b/api/zi_module.hpp @@ -5,7 +5,6 @@ #include "apibasic/basic.hpp" - namespace iflytop { using namespace std; @@ -30,11 +29,11 @@ using namespace std; int32_t module_version = version; \ int32_t module_type = type; -#define MODULE_COMMON_PROCESS_REG_CB() \ - PROCESS_REG(kreg_module_version, /* */ REG_GET(module_version), ACTION_NONE); \ - PROCESS_REG(kreg_module_type, /* */ REG_GET(module_type), ACTION_NONE); \ - PROCESS_REG(kreg_module_status, /* */ module_get_status(&val), ACTION_NONE); \ - PROCESS_REG(kreg_module_errorcode, /* */ REG_GET(m_com_reg.module_errorcode), ACTION_NONE); \ +#define MODULE_COMMON_PROCESS_REG_CB() \ + PROCESS_REG(kreg_module_version, /* */ REG_GET(module_version), ACTION_NONE); \ + PROCESS_REG(kreg_module_type, /* */ REG_GET(module_type), ACTION_NONE); \ + PROCESS_REG(kreg_module_status, /* */ module_get_status(&val), ACTION_NONE); \ + PROCESS_REG(kreg_module_errorcode, /* */ REG_GET(creg.module_errorcode), ACTION_NONE); typedef struct { int32_t module_errorcode; @@ -42,27 +41,11 @@ typedef struct { int32_t module_enable; } module_common_reg_t; -class ModuleCMDExecStatus { - public: - int32_t exec_status = 0; - int32_t exec_val[6] = {0}; - - void set_exec_status(int32_t status, int32_t val0 = 0, int32_t val1 = 0, int32_t val2 = 0, int32_t val3 = 0, int32_t val4 = 0, int32_t val5 = 0) { - exec_status = status; - exec_val[0] = val0; - exec_val[1] = val1; - exec_val[2] = val2; - exec_val[3] = val3; - exec_val[4] = val4; - exec_val[5] = val5; - } -}; - class ZIModule { int32_t m_inited_flag = 0; protected: - module_common_reg_t m_com_reg; + module_common_reg_t creg; public: virtual ~ZIModule() {} @@ -76,54 +59,8 @@ class ZIModule { virtual int32_t module_ping() { return 0; }; - virtual int32_t module_stop() { return err::koperation_not_support; } - virtual int32_t module_break() { return module_stop(); } - virtual int32_t module_start() { return err::koperation_not_support; } - - virtual int32_t module_get_last_exec_status(int32_t *status) { return err::koperation_not_support; } - virtual int32_t module_get_status(int32_t *status) = 0; - virtual int32_t module_get_error(int32_t *iserror) { - *iserror = m_com_reg.module_errorcode; - return 0; - } - virtual int32_t module_clear_error() { - m_com_reg.module_errorcode = 0; - m_com_reg.module_errorbitflag0 = 0; - return 0; - } - - virtual int32_t module_enable(int32_t enable) { return err::koperation_not_support; } - - virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t &val) { return err::koperation_not_support; } - virtual int32_t module_set_reg(int32_t param_id, int32_t param_value) { return module_xxx_reg(param_id, false, param_value); } virtual int32_t module_get_reg(int32_t param_id, int32_t *param_value) { return module_xxx_reg(param_id, true, *param_value); } - - virtual int32_t module_readio(int32_t *io) { return err::koperation_not_support; } - virtual int32_t module_writeio(int32_t idindex, int32_t io) { return err::koperation_not_support; } - - virtual int32_t module_read_adc(int32_t adcindex, int32_t *adc) { return err::koperation_not_support; } - - virtual int32_t module_read_raw(int32_t index, uint8_t *data, int32_t *len) { return err::koperation_not_support; } - - virtual int32_t module_set_inited_flag(int32_t flag) { - m_inited_flag = flag; - return 0; - } - virtual int32_t module_get_inited_flag(int32_t *flag) { - *flag = m_inited_flag; - return 0; - } - - virtual int32_t module_get_inited_flag() { return m_inited_flag; } - // kmodule_factory_reset = CMDID(1, 14), // para:{}, ack:{} - // kmodule_flush_cfg = CMDID(1, 15), // para:{}, ack:{} - // kmodule_active_cfg = CMDID(1, 16), // para:{}, ack:{} - - virtual int32_t module_factory_reset() { return err::koperation_not_support; } - virtual int32_t module_flush_cfg() { return err::ksucc; } - virtual int32_t module_active_cfg() { return err::ksucc; } - virtual int32_t _module_set_reg(int32_t regoff, int32_t *regval, int32_t val, int32_t min = INT32_MIN, int32_t max = INT32_MAX) { if (val < min || val > max) { return err::kparam_out_of_range; @@ -135,7 +72,6 @@ class ZIModule { val = regval; return 0; } - virtual int32_t _module_set_reg_float(int32_t regoff, float *regval, int32_t val, float precision, int32_t min = INT32_MIN, int32_t max = INT32_MAX) { if (val < min || val > max) { return err::kparam_out_of_range; @@ -148,6 +84,28 @@ class ZIModule { return 0; } + virtual int32_t module_get_error(int32_t *iserror) { + *iserror = creg.module_errorcode; + return 0; + } + virtual int32_t module_clear_error() { + creg.module_errorcode = 0; + creg.module_errorbitflag0 = 0; + return 0; + } + + public: + /*********************************************************************************************************************** + * 用户实现 * + ***********************************************************************************************************************/ + virtual int32_t module_get_status(int32_t *status) = 0; + virtual int32_t module_stop() { return err::koperation_not_support; } + virtual int32_t module_break() { return module_stop(); } + // virtual int32_t module_start() { return err::koperation_not_support; } + virtual int32_t module_enable(int32_t enable) { return err::koperation_not_support; } + virtual int32_t module_xxx_reg(int32_t param_id, bool read, int32_t &val) { return err::koperation_not_support; } + virtual int32_t module_read_raw(int32_t index, uint8_t *data, int32_t *len) { return err::koperation_not_support; } + public: }; } // namespace iflytop diff --git a/api/zi_motor.hpp b/api/zi_motor.hpp index 5a9ff4d..134892c 100644 --- a/api/zi_motor.hpp +++ b/api/zi_motor.hpp @@ -5,46 +5,20 @@ #include "apibasic/basic.hpp" - - namespace iflytop { using namespace std; -class ZIMotor { +class ZIStepMotor { public: - virtual ~ZIMotor() {} - virtual int32_t motor_enable(int32_t enable) { return err::koperation_not_support; } - - virtual int32_t motor_rotate(int32_t direction, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; } - virtual int32_t motor_move_by(int32_t distance, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; } - virtual int32_t motor_move_to(int32_t position, int32_t motor_velocity, int32_t acc) { return err::koperation_not_support; } - - virtual int32_t motor_rotate_acctime(int32_t direction, int32_t motor_velocity, int32_t acctime) { return err::koperation_not_support; } - virtual int32_t motor_move_by_acctime(int32_t distance, int32_t motor_velocity, int32_t acctime) { return err::koperation_not_support; } - virtual int32_t motor_move_to_acctime(int32_t position, int32_t motor_velocity, int32_t acctime) { return err::koperation_not_support; } - - virtual int32_t motor_rotate_with_torque(int32_t direction, int32_t torque) { return err::koperation_not_support; } - virtual int32_t motor_move_to_torque(int32_t pos, int32_t torque, int32_t overtime) { return err::koperation_not_support; } - - virtual int32_t motor_move_to_zero_forward(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { return err::koperation_not_support; } - virtual int32_t motor_move_to_zero_backward(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { return err::koperation_not_support; } - - virtual int32_t motor_move_to_zero_forward_and_calculated_shift(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { return err::koperation_not_support; } - virtual int32_t motor_move_to_zero_backward_and_calculated_shift(int32_t findzerospeed, int32_t findzeroedge_speed, int32_t acc, int32_t overtime) { return err::koperation_not_support; } - - virtual int32_t motor_calculated_pos_by_move_to_zero() { return err::koperation_not_support; } - - virtual int32_t motor_read_pos(int32_t* pos) { return err::koperation_not_support; } - virtual int32_t motor_set_current_pos_by_change_shift(int32_t pos) { return err::koperation_not_support; } // 一般用于舵机 - - virtual int32_t motor_easy_rotate(int32_t direction) { return err::koperation_not_support; }; - virtual int32_t motor_easy_move_by(int32_t distance) { return err::koperation_not_support; }; - virtual int32_t motor_easy_move_to(int32_t position) { return err::koperation_not_support; }; - virtual int32_t motor_easy_move_to_zero(int32_t direction) { return err::koperation_not_support; }; - virtual int32_t motor_easy_set_current_pos(int32_t pos) { return err::koperation_not_support; }; - virtual int32_t motor_easy_move_to_io(int32_t ioindex, int32_t direction) { return err::koperation_not_support; }; - - // virtual int32_t motor_set_shaft(); - - // s32 pos, s32 speed, s32 torque, + virtual ~ZIStepMotor() {} + virtual int32_t step_motor_enable(int32_t enable) = 0; + virtual int32_t step_motor_stop(int32_t breakstop) = 0; + virtual int32_t step_motor_read_pos(int32_t* pos) = 0; + virtual int32_t step_motor_easy_rotate(int32_t direction) = 0; + virtual int32_t step_motor_easy_move_by(int32_t distance) = 0; + virtual int32_t step_motor_easy_move_to(int32_t position) = 0; + virtual int32_t step_motor_easy_move_to_zero() = 0; + virtual int32_t step_motor_easy_set_current_pos(int32_t pos) = 0; + virtual int32_t step_motor_easy_move_to_io(int32_t ioindex, int32_t direction) = 0; + virtual int32_t step_motor_active_cfg() = 0; }; } // namespace iflytop \ No newline at end of file