2025-01-14 10:35:04 +08:00
|
|
|
|
/*
|
|
|
|
|
视觉与电控通信协议
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-02-11 19:46:41 +08:00
|
|
|
|
#define AI_NOTICE_FIRE (1 << 0)
|
|
|
|
|
#define AI_NOTICE_TRACKING (1 << 1)
|
|
|
|
|
|
|
|
|
|
#define AI_NOTICE_AUTOAIM (1 << 2)
|
|
|
|
|
#define AI_NOTICE_HITBUFF (1 << 3)
|
|
|
|
|
#define AI_NOTICE_AUTOMATIC (1 << 4)
|
2025-01-14 10:35:04 +08:00
|
|
|
|
|
|
|
|
|
#define AI_ID_MCU (0xC4)
|
2025-02-11 19:46:41 +08:00
|
|
|
|
#define AI_ID_MCU2 (0xD4)
|
2025-01-14 10:35:04 +08:00
|
|
|
|
#define AI_ID_REF (0xA8)
|
|
|
|
|
|
|
|
|
|
#define AI_TEAM_RED (0x01)
|
|
|
|
|
#define AI_TEAM_BLUE (0x02)
|
|
|
|
|
|
2025-01-14 20:01:02 +08:00
|
|
|
|
|
2025-01-14 10:35:04 +08:00
|
|
|
|
typedef uint8_t Protocol_ID_t;
|
|
|
|
|
|
|
|
|
|
/* 电控 -> 视觉 MCU数据结构体*/
|
|
|
|
|
typedef struct __attribute__((packed)) {
|
|
|
|
|
struct __attribute__((packed)) {
|
|
|
|
|
float q0;
|
|
|
|
|
float q1;
|
|
|
|
|
float q2;
|
|
|
|
|
float q3;
|
|
|
|
|
} quat; /* 四元数 */
|
|
|
|
|
|
2025-02-11 19:46:41 +08:00
|
|
|
|
// float chassis_speed; /* 底盘速度(哨兵) */
|
2025-01-14 10:35:04 +08:00
|
|
|
|
struct __attribute__((packed)) {
|
2025-02-11 19:46:41 +08:00
|
|
|
|
float yaw; /* 偏航角(Yaw angle) */
|
|
|
|
|
float pit; /* 俯仰角(Pitch angle) */
|
|
|
|
|
float rol; /* 翻滚角(Roll angle) */
|
|
|
|
|
} gimbal; /* 欧拉角 */
|
|
|
|
|
|
|
|
|
|
uint8_t notice; /* 控制命令 */
|
2025-01-14 10:35:04 +08:00
|
|
|
|
|
|
|
|
|
} Protocol_UpDataMCU_t;
|
|
|
|
|
|
|
|
|
|
/* 电控 -> 视觉 裁判系统数据结构体*/
|
|
|
|
|
typedef struct __attribute__((packed)) {
|
|
|
|
|
uint16_t team; /* 本身队伍 */
|
|
|
|
|
uint16_t time; /* 比赛开始时间 */
|
|
|
|
|
} Protocol_UpDataReferee_t;
|
|
|
|
|
|
|
|
|
|
/* 视觉 -> 电控 数据结构体*/
|
|
|
|
|
typedef struct __attribute__((packed)) {
|
2025-01-17 00:22:21 +08:00
|
|
|
|
|
2025-01-14 10:35:04 +08:00
|
|
|
|
struct __attribute__((packed)) {
|
|
|
|
|
float yaw; /* 偏航角(Yaw angle) */
|
|
|
|
|
float pit; /* 俯仰角(Pitch angle) */
|
|
|
|
|
float rol; /* 翻滚角(Roll angle) */
|
|
|
|
|
} gimbal; /* 欧拉角 */
|
2025-01-17 00:22:21 +08:00
|
|
|
|
|
2025-01-14 10:35:04 +08:00
|
|
|
|
|
|
|
|
|
struct __attribute__((packed)) {
|
|
|
|
|
float vx; /* x轴移动速度 */
|
|
|
|
|
float vy; /* y轴移动速度 */
|
|
|
|
|
float wz; /* z轴转动速度 */
|
|
|
|
|
} chassis_move_vec; /* 底盘移动向量 */
|
2025-02-24 14:15:46 +08:00
|
|
|
|
uint8_t notice; /* 控制命令 */
|
|
|
|
|
|
2025-01-14 10:35:04 +08:00
|
|
|
|
} Protocol_DownData_t;
|
|
|
|
|
|
|
|
|
|
typedef struct __attribute__((packed)) {
|
|
|
|
|
Protocol_UpDataMCU_t data;
|
|
|
|
|
uint16_t crc16;
|
|
|
|
|
} Protocol_UpPackageMCU_t;
|
|
|
|
|
|
|
|
|
|
typedef struct __attribute__((packed)) {
|
|
|
|
|
Protocol_UpDataReferee_t data;
|
|
|
|
|
uint16_t crc16;
|
|
|
|
|
} Protocol_UpPackageReferee_t;
|
|
|
|
|
|
|
|
|
|
typedef struct __attribute__((packed)) {
|
|
|
|
|
Protocol_DownData_t data;
|
|
|
|
|
uint16_t crc16;
|
|
|
|
|
} Protocol_DownPackage_t;
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|