god-yuan-hero/User/module/cmd.h
2025-10-31 18:08:29 +08:00

82 lines
1.8 KiB
C

/*
控制命令
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include "module/chassis.h"
#include "module/gimbal.h"
#include "module/shoot.h"
/* Exported constants ------------------------------------------------------- */
#define CMD_OK (0) /* 运行正常 */
#define CMD_ERR_NULL (-1) /* 运行时发现NULL指针 */
#define CMD_ERR_ERR (-2) /* 运行时发现了其他错误 */
#define CMD_ERR_MODE (-3) /* 运行时配置了错误的Mode */
#define CMD_ERR_MOTOR (-4) /* 运行时配置了不存在的电机类型 */
#define CMD_ERR_MALLOC (-5) /* 内存分配失败 */
/* Exported macro ----------------------------------------------------------- */
/* Exported types ----------------------------------------------------------- */
typedef union rc_u rc_u;
typedef struct {
rc_u *rc;
enum { DR16, AT9S } rc_type;
} CMD_RCInputData_t;
#define CMD_REFEREE_MAX_NUM (3) /* 发送命令限定的最大数量 */
/* 输入源枚举 */
typedef enum {
CMD_SRC_RC, /* 遥控器 */
CMD_SRC_PC, /* 键盘鼠标 */
CMD_SRC_NUC, /* 上位机 */
CMD_SRC_REFEREE, /* 裁判系统 */
CMD_SRC_NUM
} CMD_InputSource_t;
typedef struct {
}CMD_PCInputData_t;
typedef struct {
}CMD_NUCInputData_t;
typedef struct {
}CMD_REFInputData_t;
/* 底盘控制命令 */
typedef struct {
} CMD_cmdForChassisCtrl_t;
/* 云台控制命令 */
typedef struct {
} CMD_cmdForGimbalCtrl_t;
/* 射击控制命令 */
typedef struct {
CMD_InputSource_t src;
Shoot_CMD_t shoot_cmd;
} CMD_Shoot_t;
typedef struct {
bool pc_ctrl; /* 是否使用键鼠控制 */
bool host_overwrite; /* 是否Host控制 */
uint16_t key_last; /* 上次按键键值 */
} CMD_t;
/* Exported functions prototypes -------------------------------------------- */
#ifdef __cplusplus
}
#endif