#ifndef _CMD_H #define _CMD_H #include "struct_typedef.h" #include "device.h" #define MID (0x09) #define PICK (0x06) typedef enum{ UP_RCcontrol,//遥控器控制,左按键上,控制上层 MID_NAVI,//雷达导航 PICK_t, RELAXED,//异常模式 }CMD_CtrlType_t; typedef enum{ Normal, //无模式 Dribble , //运球 Pitch , //投篮 }CMD_UP_mode_t; typedef struct { uint8_t status_fromnuc; uint8_t ctrl_status; //取其中每一个二进制位用作通信 struct { fp32 vx; fp32 vy; fp32 wz; }navi; struct { fp32 posx; fp32 posy; fp32 posw; }pick; struct { fp32 angle; }sick_cali; } CMD_NUC_t; /* 拨杆位置 */ typedef enum { CMD_SW_ERR = 0, CMD_SW_UP = 1, CMD_SW_MID = 3, CMD_SW_DOWN = 2, } CMD_SwitchPos_t; /*遥控器值,使用CMD_RcLogic函数传入CMD_t结构体*/ typedef struct { float ch_l_x; /* 遥控器左侧摇杆横轴值,上为正 */ float ch_l_y; /* 遥控器左侧摇杆纵轴值,右为正 */ float ch_r_x; /* 遥控器右侧摇杆横轴值,上为正 */ float ch_r_y; /* 遥控器右侧摇杆纵轴值,右为正 */ float ch_res; /* 第五通道值 */ CMD_SwitchPos_t sw_r; /* 右侧拨杆位置 */ CMD_SwitchPos_t sw_l; /* 左侧拨杆位置 */ uint16_t key; /* 按键值 */ uint16_t res; /* 保留,未启用 */ } __attribute__((packed))CMD_RC_t; typedef struct { fp32 key_ctrl_l; fp32 key_ctrl_r; /*视觉*/ struct { uint8_t cmd_status; uint8_t raw_status; uint8_t status[7]; struct { fp32 posx; fp32 posy; fp32 posw; }pick; }NAVI_t; CMD_UP_mode_t CMD_UP_mode; CMD_CtrlType_t CMD_CtrlType; } CMD_t; /*nuc数据统一到cmd*/ int8_t CMD_ParseNuc(CMD_t *cmd,CMD_NUC_t *n); int8_t CMD_ParseRC(CMD_t *cmd,const CMD_RC_t *rc) ; #endif