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.
128 lines
3.5 KiB
128 lines
3.5 KiB
#pragma once
|
|
#include <stdint.h>
|
|
|
|
#include <functional>
|
|
|
|
#include "basic_type.hpp"
|
|
//
|
|
|
|
namespace iflytop {
|
|
using namespace std;
|
|
class I_XYRobotCtrlModule {
|
|
public:
|
|
typedef enum { hbot, corexy } RobotType_t;
|
|
typedef enum { kNormalStop, kBreakStop } StopType_t;
|
|
|
|
/*******************************************************************************
|
|
* ACTION *
|
|
*******************************************************************************/
|
|
#pragma pack(1)
|
|
/*******************************************************************************
|
|
* READ *
|
|
*******************************************************************************/
|
|
typedef struct {
|
|
int32_t version;
|
|
} version_t;
|
|
|
|
typedef struct {
|
|
uint8_t status;
|
|
u8 iostate; // x_zero_io y_zero_io
|
|
int32_t x;
|
|
int32_t y;
|
|
} status_t;
|
|
|
|
typedef struct {
|
|
uint8_t status;
|
|
int32_t x;
|
|
int32_t y;
|
|
u8 iostate; // x_zero_io y_zero_io
|
|
} detailed_status_t;
|
|
|
|
/*******************************************************************************
|
|
* CFG *
|
|
*******************************************************************************/
|
|
|
|
typedef struct {
|
|
s32 robot_type;
|
|
s32 x_shaft;
|
|
s32 y_shaft;
|
|
s32 ihold;
|
|
s32 irun;
|
|
s32 iholddelay;
|
|
s32 distance_scale; // 0.001
|
|
s32 shift_x;
|
|
s32 shift_y;
|
|
|
|
// limit
|
|
s32 acc;
|
|
s32 dec;
|
|
s32 breakdec;
|
|
s32 maxspeed;
|
|
s32 min_x;
|
|
s32 max_x;
|
|
s32 min_y;
|
|
s32 max_y;
|
|
|
|
s32 run_to_zero_max_d;
|
|
s32 leave_from_zero_max_d;
|
|
s32 run_to_zero_speed;
|
|
s32 run_to_zero_dec;
|
|
} base_param_t;
|
|
|
|
typedef struct {
|
|
uint8_t pad;
|
|
} warning_limit_param_t;
|
|
|
|
typedef struct {
|
|
s32 robot_type;
|
|
s32 x_shaft;
|
|
s32 y_shaft;
|
|
s32 ihold;
|
|
s32 irun;
|
|
s32 iholddelay;
|
|
s32 distance_scale; // 0.001
|
|
s32 shift_x;
|
|
s32 shift_y;
|
|
|
|
// limit
|
|
s32 acc;
|
|
s32 dec;
|
|
s32 breakdec;
|
|
s32 maxspeed;
|
|
s32 min_x;
|
|
s32 max_x;
|
|
s32 min_y;
|
|
s32 max_y;
|
|
|
|
s32 run_to_zero_max_d;
|
|
s32 leave_from_zero_max_d;
|
|
s32 run_to_zero_speed;
|
|
s32 run_to_zero_dec;
|
|
} flash_config_t;
|
|
|
|
#pragma pack()
|
|
|
|
public:
|
|
virtual int32_t move_to(int32_t x, int32_t y, int speed, action_cb_status_t status_cb) = 0;
|
|
virtual int32_t move_by(int32_t dx, int32_t dy, int speed, action_cb_status_t status_cb) = 0;
|
|
virtual int32_t move_by_no_limit(int32_t dx, int32_t dy, int speed, action_cb_status_t status_cb) = 0;
|
|
virtual int32_t move_to_zero(action_cb_status_t status_cb) = 0;
|
|
virtual int32_t move_to_zero_with_calibrate(int32_t nowx, int32_t nowxy, action_cb_status_t 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, int32_t y) = 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_base_param(const base_param_t& param) = 0;
|
|
virtual int32_t get_base_param(base_param_t& ack) = 0;
|
|
|
|
virtual int32_t flush() = 0;
|
|
virtual int32_t factory_reset() = 0;
|
|
|
|
virtual ~I_XYRobotCtrlModule() {}
|
|
};
|
|
} // namespace iflytop
|