You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#pragma once
#include <stdint.h>
#include <functional>
#include "basic_type.hpp"
//
namespace iflytop { using namespace std; class I_StepMotorCtrlModule { public: typedef enum { hbot, corexy } RobotType_t; typedef enum { kNormalStop, kBreakStop } StopType_t;
/*******************************************************************************
* ACTION * *******************************************************************************/ #pragma pack(1)
typedef struct { int32_t exec_status; int32_t tox; } move_to_cb_status_t;
typedef struct { int32_t exec_status; int32_t dx; } move_by_cb_status_t;
typedef struct { int32_t exec_status; } move_to_zero_cb_status_t;
typedef struct { int32_t exec_status; int32_t zero_shift_x; } move_to_zero_with_calibrate_cb_status_t;
typedef struct { int32_t exec_status; int32_t lastforms; } rotate_cb_status_t;
/*******************************************************************************
* READ * *******************************************************************************/ typedef struct { int32_t version; } version_t;
typedef struct { uint8_t status; uint8_t io_state; // x_zero_io x_end_io
int32_t x; } status_t;
typedef struct { uint8_t status; uint8_t io_state; // x_zero_io x_end_io
int32_t x; } detailed_status_t;
/*******************************************************************************
* CFG * *******************************************************************************/
typedef struct { u8 x_shaft; u8 ihold; u8 irun; u16 iholddelay; s32 distance_scale; // 0.001
s32 shift_x; s32 acc; s32 dec; s32 maxspeed; s32 min_x; s32 max_x; } run_param_t;
typedef struct { uint8_t pad; } warning_limit_param_t;
typedef struct { u32 move_to_zero_max_d; u32 leave_from_zero_max_d; u32 speed; u32 dec; } run_to_zero_param_t; #pragma pack()
public: virtual bool isbusy() = 0;
virtual int32_t move_to(int32_t x, function<void(move_to_cb_status_t& status)> status_cb) = 0; virtual int32_t move_by(int32_t dx, function<void(move_by_cb_status_t& status)> status_cb) = 0; virtual int32_t move_to_zero(function<void(move_to_zero_cb_status_t& status)> status_cb) = 0; virtual int32_t move_to_zero_with_calibrate(int32_t x, function<void(move_to_zero_with_calibrate_cb_status_t& status)> status_cb) = 0; virtual int32_t enable(bool venable) = 0; virtual int32_t stop(uint8_t stopType) = 0; virtual int32_t force_change_current_pos(int32_t x) = 0; virtual int32_t rotate(int32_t speed, int32_t lastforms, function<void(rotate_cb_status_t& status)> status_cb) = 0;
virtual int32_t read_version(version_t& version) = 0; virtual int32_t read_status(status_t& status) = 0; virtual int32_t read_detailed_status(detailed_status_t& debug_info) = 0;
virtual int32_t set_run_param(uint8_t operation, const run_param_t& param, run_param_t& ack) = 0; virtual int32_t set_run_to_zero_param(uint8_t operation, const run_to_zero_param_t& param, run_to_zero_param_t& ack) = 0; virtual int32_t set_warning_limit_param(uint8_t operation, const warning_limit_param_t& param, warning_limit_param_t& ack) = 0; }; } // namespace iflytop
|