UI部分更改为裁判系统串口发送复活、买弹指令 待测试
This commit is contained in:
parent
c97996f501
commit
913ce8e829
|
@ -255,6 +255,9 @@ typedef enum
|
||||||
RobotID_BAerial = 106,
|
RobotID_BAerial = 106,
|
||||||
RobotID_BSentry = 107,
|
RobotID_BSentry = 107,
|
||||||
RobotID_BRadar = 109,
|
RobotID_BRadar = 109,
|
||||||
|
|
||||||
|
//裁判系统服务器ID 用于哨兵和雷达自主决策
|
||||||
|
RobotID_Referee = 0x8080,
|
||||||
} Robot_ID_e;
|
} Robot_ID_e;
|
||||||
|
|
||||||
/* 交互数据ID */
|
/* 交互数据ID */
|
||||||
|
@ -269,6 +272,9 @@ typedef enum
|
||||||
|
|
||||||
/* 自定义交互数据部分 */
|
/* 自定义交互数据部分 */
|
||||||
Communicate_Data_ID = 0x0200,
|
Communicate_Data_ID = 0x0200,
|
||||||
|
// 哨兵雷达自主决策部分
|
||||||
|
Sentry_Decision_ID = 0x0120,
|
||||||
|
Radar_Decision_ID = 0x0121,
|
||||||
|
|
||||||
} Interactive_Data_ID_e;
|
} Interactive_Data_ID_e;
|
||||||
/* 交互数据长度 */
|
/* 交互数据长度 */
|
||||||
|
@ -281,6 +287,8 @@ typedef enum
|
||||||
|
|
||||||
/* 自定义交互数据部分 */
|
/* 自定义交互数据部分 */
|
||||||
// Communicate_Data_LEN = 5,
|
// Communicate_Data_LEN = 5,
|
||||||
|
Sentry_Decision_LEN = 4,
|
||||||
|
Radar_Decision_LEN = 1,
|
||||||
|
|
||||||
} Interactive_Data_Length_e;
|
} Interactive_Data_Length_e;
|
||||||
|
|
||||||
|
@ -311,7 +319,20 @@ typedef struct
|
||||||
ext_student_interactive_header_data_t datahead;
|
ext_student_interactive_header_data_t datahead;
|
||||||
robot_interactive_data_t Data; // 数据段
|
robot_interactive_data_t Data; // 数据段
|
||||||
} Communicate_ReceiveData_t;
|
} Communicate_ReceiveData_t;
|
||||||
|
// 哨兵决策数据
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint32_t reborn:1; // 读条确认复活
|
||||||
|
uint32_t reborn_now:1; // 买活
|
||||||
|
uint32_t buy_bullet:11;
|
||||||
|
// 购买弹丸数量 开局为0,修改此值后,哨兵在补血点即可兑换允许发弹量。此值的变化需要单调递增,否则视为不合法。
|
||||||
|
uint32_t remote_bullet:4;
|
||||||
|
//哨兵远程兑换发弹量的请求次数,开局为0,修改此值即可请求远程兑换发弹量。此值的变化需要单调递增且每次仅能增加1,否则视为不合法。
|
||||||
|
uint32_t remote_HP:4;
|
||||||
|
//哨兵远程兑换血量的请求次数,开局为0,修改此值即可请求远程兑换血量。此值的变化需要单调递增且每次仅能增加1,否则视为不合法。
|
||||||
|
uint32_t reserve:11;
|
||||||
|
}Sentry_Decision_Data_t;
|
||||||
|
//在哨兵发送该子命令时,服务器将按照从相对低位到相对高位的原则依次处理这些指令,直至全部成功或不能处理为止。
|
||||||
/****************************UI交互数据****************************/
|
/****************************UI交互数据****************************/
|
||||||
|
|
||||||
/* 图形数据 */
|
/* 图形数据 */
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "referee_UI.h"
|
#include "referee_UI.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "cmsis_os.h"
|
#include "cmsis_os.h"
|
||||||
|
#include "crc_ref.h"
|
||||||
|
|
||||||
static Referee_Interactive_info_t *Interactive_data; // UI绘制需要的机器人状态数据
|
static Referee_Interactive_info_t *Interactive_data; // UI绘制需要的机器人状态数据
|
||||||
static referee_info_t *referee_recv_info; // 接收到的裁判系统数据
|
static referee_info_t *referee_recv_info; // 接收到的裁判系统数据
|
||||||
|
@ -34,10 +35,8 @@ static void DeterminRobotID()
|
||||||
referee_recv_info->referee_id.Cilent_ID = 0x0100 + referee_recv_info->referee_id.Robot_ID; // 计算客户端ID
|
referee_recv_info->referee_id.Cilent_ID = 0x0100 + referee_recv_info->referee_id.Robot_ID; // 计算客户端ID
|
||||||
referee_recv_info->referee_id.Receiver_Robot_ID = 0;
|
referee_recv_info->referee_id.Receiver_Robot_ID = 0;
|
||||||
}
|
}
|
||||||
|
Sentry_Decision_Data_t SentryDecision;
|
||||||
static void MyUIRefresh(referee_info_t *referee_recv_info, Referee_Interactive_info_t *_Interactive_data);
|
static void Sentry_CMD_send(referee_id_t *_id,Sentry_Decision_Data_t Sentry_Decision);
|
||||||
static void UIChangeCheck(Referee_Interactive_info_t *_Interactive_data); // 模式切换检测
|
|
||||||
static void RobotModeTest(Referee_Interactive_info_t *_Interactive_data); // 测试用函数,实现模式自动变化
|
|
||||||
|
|
||||||
referee_info_t *UITaskInit(UART_HandleTypeDef *referee_usart_handle, Referee_Interactive_info_t *UI_data)
|
referee_info_t *UITaskInit(UART_HandleTypeDef *referee_usart_handle, Referee_Interactive_info_t *UI_data)
|
||||||
{
|
{
|
||||||
|
@ -49,251 +48,47 @@ referee_info_t *UITaskInit(UART_HandleTypeDef *referee_usart_handle, Referee_Int
|
||||||
|
|
||||||
void UITask()
|
void UITask()
|
||||||
{
|
{
|
||||||
RobotModeTest(Interactive_data); // 测试用函数,实现模式自动变化,用于检查该任务和裁判系统是否连接正常
|
SentryDecision.reserve = 1; // 确认复活
|
||||||
MyUIRefresh(referee_recv_info, Interactive_data);
|
SentryDecision.buy_bullet = 100; //买100发弹丸
|
||||||
|
Sentry_CMD_send(&referee_recv_info->referee_id,SentryDecision);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Graph_Data_t UI_shoot_line[10]; // 射击准线
|
|
||||||
static Graph_Data_t UI_Energy[3]; // 电容能量条
|
|
||||||
static String_Data_t UI_State_sta[6]; // 机器人状态,静态只需画一次
|
|
||||||
static String_Data_t UI_State_dyn[6]; // 机器人状态,动态先add才能change
|
|
||||||
static uint32_t shoot_line_location[10] = {540, 960, 490, 515, 565};
|
|
||||||
|
|
||||||
void MyUIInit()
|
void MyUIInit()
|
||||||
{
|
{
|
||||||
if (!referee_recv_info->init_flag)
|
// if (!referee_recv_info->init_flag)
|
||||||
vTaskDelete(NULL); // 如果没有初始化裁判系统则直接删除ui任务
|
//vTaskDelete(NULL); // 如果没有初始化裁判系统则直接删除ui任务
|
||||||
while (referee_recv_info->GameRobotState.robot_id == 0)
|
while (referee_recv_info->GameRobotState.robot_id == 0)
|
||||||
|
{
|
||||||
osDelay(100); // 若还未收到裁判系统数据,等待一段时间后再检查
|
osDelay(100); // 若还未收到裁判系统数据,等待一段时间后再检查
|
||||||
|
}
|
||||||
DeterminRobotID(); // 确定ui要发送到的目标客户端
|
DeterminRobotID(); // 确定ui要发送到的目标客户端
|
||||||
UIDelete(&referee_recv_info->referee_id, UI_Data_Del_ALL, 0); // 清空UI
|
|
||||||
|
|
||||||
// 绘制发射基准线
|
|
||||||
UILineDraw(&UI_shoot_line[0], "sl0", UI_Graph_ADD, 7, UI_Color_White, 3, 710, shoot_line_location[0], 1210, shoot_line_location[0]);
|
|
||||||
UILineDraw(&UI_shoot_line[1], "sl1", UI_Graph_ADD, 7, UI_Color_White, 3, shoot_line_location[1], 340, shoot_line_location[1], 740);
|
|
||||||
UILineDraw(&UI_shoot_line[2], "sl2", UI_Graph_ADD, 7, UI_Color_Yellow, 2, 810, shoot_line_location[2], 1110, shoot_line_location[2]);
|
|
||||||
UILineDraw(&UI_shoot_line[3], "sl3", UI_Graph_ADD, 7, UI_Color_Yellow, 2, 810, shoot_line_location[3], 1110, shoot_line_location[3]);
|
|
||||||
UILineDraw(&UI_shoot_line[4], "sl4", UI_Graph_ADD, 7, UI_Color_Yellow, 2, 810, shoot_line_location[4], 1110, shoot_line_location[4]);
|
|
||||||
UIGraphRefresh(&referee_recv_info->referee_id, 5, UI_shoot_line[0], UI_shoot_line[1], UI_shoot_line[2], UI_shoot_line[3], UI_shoot_line[4]);
|
|
||||||
|
|
||||||
// 绘制车辆状态标志指示
|
|
||||||
UICharDraw(&UI_State_sta[0], "ss0", UI_Graph_ADD, 8, UI_Color_Main, 15, 2, 150, 750, "chassis:");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_sta[0]);
|
|
||||||
UICharDraw(&UI_State_sta[1], "ss1", UI_Graph_ADD, 8, UI_Color_Yellow, 15, 2, 150, 700, "gimbal:");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_sta[1]);
|
|
||||||
UICharDraw(&UI_State_sta[2], "ss2", UI_Graph_ADD, 8, UI_Color_Orange, 15, 2, 150, 650, "shoot:");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_sta[2]);
|
|
||||||
UICharDraw(&UI_State_sta[3], "ss3", UI_Graph_ADD, 8, UI_Color_Pink, 15, 2, 150, 600, "frict:");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_sta[3]);
|
|
||||||
UICharDraw(&UI_State_sta[4], "ss4", UI_Graph_ADD, 8, UI_Color_Pink, 15, 2, 150, 550, "lid:");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_sta[4]);
|
|
||||||
|
|
||||||
// 绘制车辆状态标志,动态
|
|
||||||
// 由于初始化时xxx_last_mode默认为0,所以此处对应UI也应该设为0时对应的UI,防止模式不变的情况下无法置位flag,导致UI无法刷新
|
|
||||||
UICharDraw(&UI_State_dyn[0], "sd0", UI_Graph_ADD, 8, UI_Color_Main, 15, 2, 270, 750, "zeroforce");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[0]);
|
|
||||||
UICharDraw(&UI_State_dyn[1], "sd1", UI_Graph_ADD, 8, UI_Color_Yellow, 15, 2, 270, 700, "zeroforce");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[1]);
|
|
||||||
UICharDraw(&UI_State_dyn[2], "sd2", UI_Graph_ADD, 8, UI_Color_Orange, 15, 2, 270, 650, "off");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[2]);
|
|
||||||
UICharDraw(&UI_State_dyn[3], "sd3", UI_Graph_ADD, 8, UI_Color_Pink, 15, 2, 270, 600, "off");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[3]);
|
|
||||||
UICharDraw(&UI_State_dyn[4], "sd4", UI_Graph_ADD, 8, UI_Color_Pink, 15, 2, 270, 550, "open ");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[4]);
|
|
||||||
|
|
||||||
// 底盘功率显示,静态
|
|
||||||
UICharDraw(&UI_State_sta[5], "ss5", UI_Graph_ADD, 7, UI_Color_Green, 18, 2, 620, 230, "Power:");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_sta[5]);
|
|
||||||
// 能量条框
|
|
||||||
UIRectangleDraw(&UI_Energy[0], "ss6", UI_Graph_ADD, 7, UI_Color_Green, 2, 720, 140, 1220, 180);
|
|
||||||
UIGraphRefresh(&referee_recv_info->referee_id, 1, UI_Energy[0]);
|
|
||||||
|
|
||||||
// 底盘功率显示,动态
|
|
||||||
UIFloatDraw(&UI_Energy[1], "sd5", UI_Graph_ADD, 8, UI_Color_Green, 18, 2, 2, 750, 230, 24000);
|
|
||||||
// 能量条初始状态
|
|
||||||
UILineDraw(&UI_Energy[2], "sd6", UI_Graph_ADD, 8, UI_Color_Pink, 30, 720, 160, 1020, 160);
|
|
||||||
UIGraphRefresh(&referee_recv_info->referee_id, 2, UI_Energy[1], UI_Energy[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 测试用函数,实现模式自动变化,用于检查该任务和裁判系统是否连接正常
|
|
||||||
static uint8_t count = 0;
|
|
||||||
static uint16_t count1 = 0;
|
void Sentry_CMD_send(referee_id_t *_id,Sentry_Decision_Data_t Sentry_Decision)
|
||||||
static void RobotModeTest(Referee_Interactive_info_t *_Interactive_data) // 测试用函数,实现模式自动变化
|
|
||||||
{
|
{
|
||||||
count++;
|
static Sentry_CMD_t sentryCmd;
|
||||||
if (count >= 50)
|
|
||||||
{
|
uint8_t temp_datalength = Interactive_Data_LEN_Head + Sentry_Decision_LEN; // 计算交互数据长度
|
||||||
count = 0;
|
|
||||||
count1++;
|
sentryCmd.FrameHeader.SOF = REFEREE_SOF;
|
||||||
}
|
sentryCmd.FrameHeader.DataLength = temp_datalength;
|
||||||
switch (count1 % 4)
|
sentryCmd.FrameHeader.Seq = UI_Seq;
|
||||||
{
|
sentryCmd.FrameHeader.CRC8 = Get_CRC8_Check_Sum((uint8_t *)&sentryCmd, LEN_CRC8, 0xFF);
|
||||||
case 0:
|
|
||||||
{
|
sentryCmd.CmdID = ID_student_interactive;
|
||||||
_Interactive_data->chassis_mode = CHASSIS_ZERO_FORCE;
|
|
||||||
_Interactive_data->gimbal_mode = GIMBAL_ZERO_FORCE;
|
sentryCmd.datahead.data_cmd_id = Sentry_Decision_ID;
|
||||||
_Interactive_data->shoot_mode = SHOOT_ON;
|
|
||||||
_Interactive_data->friction_mode = FRICTION_ON;
|
sentryCmd.datahead.receiver_ID = RobotID_Referee;
|
||||||
_Interactive_data->lid_mode = LID_OPEN;
|
sentryCmd.datahead.sender_ID = _id->Robot_ID;
|
||||||
_Interactive_data->Chassis_Power_Data.chassis_power_mx += 3.5;
|
|
||||||
if (_Interactive_data->Chassis_Power_Data.chassis_power_mx >= 18)
|
sentryCmd.SentryDecision = Sentry_Decision;
|
||||||
_Interactive_data->Chassis_Power_Data.chassis_power_mx = 0;
|
|
||||||
break;
|
sentryCmd.frametail = Get_CRC16_Check_Sum((uint8_t *)&sentryCmd, LEN_HEADER + LEN_CMDID + temp_datalength, 0xFFFF);
|
||||||
}
|
|
||||||
case 1:
|
RefereeSend((uint8_t *)&sentryCmd, LEN_HEADER + LEN_CMDID + temp_datalength + LEN_TAIL); // 发送
|
||||||
{
|
|
||||||
_Interactive_data->chassis_mode = CHASSIS_ROTATE;
|
UI_Seq++; // 包序号+1
|
||||||
_Interactive_data->gimbal_mode = GIMBAL_FREE_MODE;
|
|
||||||
_Interactive_data->shoot_mode = SHOOT_OFF;
|
|
||||||
_Interactive_data->friction_mode = FRICTION_OFF;
|
|
||||||
_Interactive_data->lid_mode = LID_CLOSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 2:
|
|
||||||
{
|
|
||||||
_Interactive_data->chassis_mode = CHASSIS_NO_FOLLOW;
|
|
||||||
_Interactive_data->gimbal_mode = GIMBAL_GYRO_MODE;
|
|
||||||
_Interactive_data->shoot_mode = SHOOT_ON;
|
|
||||||
_Interactive_data->friction_mode = FRICTION_ON;
|
|
||||||
_Interactive_data->lid_mode = LID_OPEN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 3:
|
|
||||||
{
|
|
||||||
_Interactive_data->chassis_mode = CHASSIS_FOLLOW_GIMBAL_YAW;
|
|
||||||
_Interactive_data->gimbal_mode = GIMBAL_ZERO_FORCE;
|
|
||||||
_Interactive_data->shoot_mode = SHOOT_OFF;
|
|
||||||
_Interactive_data->friction_mode = FRICTION_OFF;
|
|
||||||
_Interactive_data->lid_mode = LID_CLOSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MyUIRefresh(referee_info_t *referee_recv_info, Referee_Interactive_info_t *_Interactive_data)
|
|
||||||
{
|
|
||||||
UIChangeCheck(_Interactive_data);
|
|
||||||
// chassis
|
|
||||||
if (_Interactive_data->Referee_Interactive_Flag.chassis_flag == 1)
|
|
||||||
{
|
|
||||||
switch (_Interactive_data->chassis_mode)
|
|
||||||
{
|
|
||||||
case CHASSIS_ZERO_FORCE:
|
|
||||||
UICharDraw(&UI_State_dyn[0], "sd0", UI_Graph_Change, 8, UI_Color_Main, 15, 2, 270, 750, "zeroforce");
|
|
||||||
break;
|
|
||||||
case CHASSIS_ROTATE:
|
|
||||||
UICharDraw(&UI_State_dyn[0], "sd0", UI_Graph_Change, 8, UI_Color_Main, 15, 2, 270, 750, "rotate ");
|
|
||||||
// 此处注意字数对齐问题,字数相同才能覆盖掉
|
|
||||||
break;
|
|
||||||
case CHASSIS_NO_FOLLOW:
|
|
||||||
UICharDraw(&UI_State_dyn[0], "sd0", UI_Graph_Change, 8, UI_Color_Main, 15, 2, 270, 750, "nofollow ");
|
|
||||||
break;
|
|
||||||
case CHASSIS_FOLLOW_GIMBAL_YAW:
|
|
||||||
UICharDraw(&UI_State_dyn[0], "sd0", UI_Graph_Change, 8, UI_Color_Main, 15, 2, 270, 750, "follow ");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[0]);
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.chassis_flag = 0;
|
|
||||||
}
|
|
||||||
// gimbal
|
|
||||||
if (_Interactive_data->Referee_Interactive_Flag.gimbal_flag == 1)
|
|
||||||
{
|
|
||||||
switch (_Interactive_data->gimbal_mode)
|
|
||||||
{
|
|
||||||
case GIMBAL_ZERO_FORCE:
|
|
||||||
{
|
|
||||||
UICharDraw(&UI_State_dyn[1], "sd1", UI_Graph_Change, 8, UI_Color_Yellow, 15, 2, 270, 700, "zeroforce");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GIMBAL_FREE_MODE:
|
|
||||||
{
|
|
||||||
UICharDraw(&UI_State_dyn[1], "sd1", UI_Graph_Change, 8, UI_Color_Yellow, 15, 2, 270, 700, "free ");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GIMBAL_GYRO_MODE:
|
|
||||||
{
|
|
||||||
UICharDraw(&UI_State_dyn[1], "sd1", UI_Graph_Change, 8, UI_Color_Yellow, 15, 2, 270, 700, "gyro ");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[1]);
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.gimbal_flag = 0;
|
|
||||||
}
|
|
||||||
// shoot
|
|
||||||
if (_Interactive_data->Referee_Interactive_Flag.shoot_flag == 1)
|
|
||||||
{
|
|
||||||
UICharDraw(&UI_State_dyn[2], "sd2", UI_Graph_Change, 8, UI_Color_Pink, 15, 2, 270, 650, _Interactive_data->shoot_mode == SHOOT_ON ? "on " : "off");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[2]);
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.shoot_flag = 0;
|
|
||||||
}
|
|
||||||
// friction
|
|
||||||
if (_Interactive_data->Referee_Interactive_Flag.friction_flag == 1)
|
|
||||||
{
|
|
||||||
UICharDraw(&UI_State_dyn[3], "sd3", UI_Graph_Change, 8, UI_Color_Pink, 15, 2, 270, 600, _Interactive_data->friction_mode == FRICTION_ON ? "on " : "off");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[3]);
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.friction_flag = 0;
|
|
||||||
}
|
|
||||||
// lid
|
|
||||||
if (_Interactive_data->Referee_Interactive_Flag.lid_flag == 1)
|
|
||||||
{
|
|
||||||
UICharDraw(&UI_State_dyn[4], "sd4", UI_Graph_Change, 8, UI_Color_Pink, 15, 2, 270, 550, _Interactive_data->lid_mode == LID_OPEN ? "open " : "close");
|
|
||||||
UICharRefresh(&referee_recv_info->referee_id, UI_State_dyn[4]);
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.lid_flag = 0;
|
|
||||||
}
|
|
||||||
// power
|
|
||||||
if (_Interactive_data->Referee_Interactive_Flag.Power_flag == 1)
|
|
||||||
{
|
|
||||||
UIFloatDraw(&UI_Energy[1], "sd5", UI_Graph_Change, 8, UI_Color_Green, 18, 2, 2, 750, 230, _Interactive_data->Chassis_Power_Data.chassis_power_mx * 1000);
|
|
||||||
UILineDraw(&UI_Energy[2], "sd6", UI_Graph_Change, 8, UI_Color_Pink, 30, 720, 160, (uint32_t)750 + _Interactive_data->Chassis_Power_Data.chassis_power_mx * 30, 160);
|
|
||||||
UIGraphRefresh(&referee_recv_info->referee_id, 2, UI_Energy[1], UI_Energy[2]);
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.Power_flag = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief 模式切换检测,模式发生切换时,对flag置位
|
|
||||||
* @param Referee_Interactive_info_t *_Interactive_data
|
|
||||||
* @retval none
|
|
||||||
* @attention
|
|
||||||
*/
|
|
||||||
static void UIChangeCheck(Referee_Interactive_info_t *_Interactive_data)
|
|
||||||
{
|
|
||||||
if (_Interactive_data->chassis_mode != _Interactive_data->chassis_last_mode)
|
|
||||||
{
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.chassis_flag = 1;
|
|
||||||
_Interactive_data->chassis_last_mode = _Interactive_data->chassis_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_Interactive_data->gimbal_mode != _Interactive_data->gimbal_last_mode)
|
|
||||||
{
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.gimbal_flag = 1;
|
|
||||||
_Interactive_data->gimbal_last_mode = _Interactive_data->gimbal_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_Interactive_data->shoot_mode != _Interactive_data->shoot_last_mode)
|
|
||||||
{
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.shoot_flag = 1;
|
|
||||||
_Interactive_data->shoot_last_mode = _Interactive_data->shoot_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_Interactive_data->friction_mode != _Interactive_data->friction_last_mode)
|
|
||||||
{
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.friction_flag = 1;
|
|
||||||
_Interactive_data->friction_last_mode = _Interactive_data->friction_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_Interactive_data->lid_mode != _Interactive_data->lid_last_mode)
|
|
||||||
{
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.lid_flag = 1;
|
|
||||||
_Interactive_data->lid_last_mode = _Interactive_data->lid_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_Interactive_data->Chassis_Power_Data.chassis_power_mx != _Interactive_data->Chassis_last_Power_Data.chassis_power_mx)
|
|
||||||
{
|
|
||||||
_Interactive_data->Referee_Interactive_Flag.Power_flag = 1;
|
|
||||||
_Interactive_data->Chassis_last_Power_Data.chassis_power_mx = _Interactive_data->Chassis_Power_Data.chassis_power_mx;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,15 @@
|
||||||
#include "rm_referee.h"
|
#include "rm_referee.h"
|
||||||
#include "robot_def.h"
|
#include "robot_def.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
xFrameHeader FrameHeader;
|
||||||
|
uint16_t CmdID;
|
||||||
|
ext_student_interactive_header_data_t datahead;
|
||||||
|
Sentry_Decision_Data_t SentryDecision;
|
||||||
|
uint16_t frametail;
|
||||||
|
} Sentry_CMD_t; // 打印字符串数据
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 初始化裁判系统交互任务(UI和多机通信)
|
* @brief 初始化裁判系统交互任务(UI和多机通信)
|
||||||
*
|
*
|
||||||
|
|
|
@ -9,7 +9,7 @@ OpenToolbar="Debug", Floating=0, x=0, y=0
|
||||||
OpenWindow="Memory 1", DockArea=BOTTOM, x=2, y=0, w=341, h=302, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, EditorAddress=0x20009694
|
OpenWindow="Memory 1", DockArea=BOTTOM, x=2, y=0, w=341, h=302, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, EditorAddress=0x20009694
|
||||||
OpenWindow="Watched Data 1", DockArea=LEFT, x=0, y=0, w=567, h=622, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
OpenWindow="Watched Data 1", DockArea=LEFT, x=0, y=0, w=567, h=622, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||||
OpenWindow="Data Sampling", DockArea=BOTTOM, x=0, y=0, w=544, h=302, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VisibleTab=0, UniformSampleSpacing=0
|
OpenWindow="Data Sampling", DockArea=BOTTOM, x=0, y=0, w=544, h=302, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VisibleTab=0, UniformSampleSpacing=0
|
||||||
OpenWindow="Timeline", DockArea=RIGHT, x=0, y=0, w=980, h=622, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=0, CodePaneShown=0, PinCursor="Cursor Movable", TimePerDiv="2 s / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="479;0", DataGraphShowNamesAtCursor=0, PowerGraphDrawAsPoints=0, PowerGraphLegendShown=0, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="778;0", CodeGraphLegendShown=0, CodeGraphLegendPosition="737;0"
|
OpenWindow="Timeline", DockArea=RIGHT, x=0, y=0, w=855, h=622, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=0, CodePaneShown=0, PinCursor="Cursor Movable", TimePerDiv="2 s / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="354;0", DataGraphShowNamesAtCursor=0, PowerGraphDrawAsPoints=0, PowerGraphLegendShown=0, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="676;0", CodeGraphLegendShown=0, CodeGraphLegendPosition="690;0"
|
||||||
OpenWindow="Console", DockArea=BOTTOM, x=1, y=0, w=1033, h=302, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
OpenWindow="Console", DockArea=BOTTOM, x=1, y=0, w=1033, h=302, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||||
SmartViewPlugin="", Page="", Toolbar="Hidden", Window="SmartView 1"
|
SmartViewPlugin="", Page="", Toolbar="Hidden", Window="SmartView 1"
|
||||||
TableHeader="Data Sampling Table", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time"], ColWidths=[100;100]
|
TableHeader="Data Sampling Table", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time"], ColWidths=[100;100]
|
||||||
|
|
Loading…
Reference in New Issue