Browse Source

update

master
zhaohe 1 year ago
parent
commit
6b31abb3eb
  1. 108
      api/i_xyrobot_ctrl_module.hpp

108
api/i_xyrobot_ctrl_module.hpp

@ -1,108 +0,0 @@
#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;
u8 iostate; // x_zero_io y_zero_io
int32_t x;
int32_t y;
} 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 run_to_zero_speed;
s32 run_to_zero_dec;
s32 look_zero_edge_max_d;
s32 look_zero_edge_speed;
s32 look_zero_edge_dec;
} base_param_t;
typedef struct {
uint8_t pad;
} warning_limit_param_t;
typedef struct {
bool configInited;
base_param_t basecfg;
} flash_config_t;
#pragma pack()
public:
virtual int32_t move_to(int32_t x, int32_t y, int32_t speed, action_cb_status_t status_cb) = 0;
virtual int32_t move_by(int32_t dx, int32_t dy, int32_t speed, action_cb_status_t status_cb) = 0;
virtual int32_t move_by_no_limit(int32_t dx, int32_t dy, int32_t 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
Loading…
Cancel
Save