This commit is contained in:
parent
d91c07afde
commit
4d7f7e9bd1
|
@ -120,6 +120,8 @@ int main(void)
|
|||
MX_CRC_Init();
|
||||
MX_DAC_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
HAL_Delay(1500); //delay 一段时间 等待关节电机驱动初始化
|
||||
RobotInit(); // 唯一的初始化函数
|
||||
LOGINFO("[main] SystemInit() and RobotInit() done");
|
||||
/* USER CODE END 2 */
|
||||
|
|
|
@ -437,18 +437,18 @@ void RobotCMDTask() {
|
|||
// 设置视觉发送数据,还需增加加速度和角速度数据
|
||||
// VisionSetFlag(chassis_fetch_data.enemy_color,,chassis_fetch_data.bullet_speed)
|
||||
|
||||
//sentry_state = sentry_behave();
|
||||
sentry_state = sentry_behave();
|
||||
|
||||
if (referee_data->GameState.game_progress == 4) {
|
||||
if (referee_data->GameState.stage_remain_time >= (300 - 60))
|
||||
sentry_state = 1;//前一分钟
|
||||
else if (referee_data->GameState.stage_remain_time <= 60)
|
||||
sentry_state = 3;//后一分钟
|
||||
else
|
||||
sentry_state = 2;//中间阶段
|
||||
}
|
||||
|
||||
gimbal_cmd_send.game_state = sentry_state;
|
||||
// if (referee_data->GameState.game_progress == 4) {
|
||||
// if (referee_data->GameState.stage_remain_time >= (300 - 60))
|
||||
// sentry_state = 1;//前一分钟
|
||||
// else if (referee_data->GameState.stage_remain_time <= 60)
|
||||
// sentry_state = 3;//后一分钟
|
||||
// else
|
||||
// sentry_state = 2;//中间阶段
|
||||
// }
|
||||
//
|
||||
// gimbal_cmd_send.game_state = sentry_state;
|
||||
|
||||
VisionSetFlag(!referee_data->referee_id.Robot_Color, sentry_state, referee_data->GameRobotState.current_HP);
|
||||
// 推送消息,双板通信,视觉通信等
|
||||
|
@ -471,10 +471,11 @@ uint8_t sentry_behave() {
|
|||
static uint8_t last_behave_flag = 0;
|
||||
static uint8_t recover_cnt = 0;
|
||||
// 比赛阶段 0准备阶段 1前1分钟 2中间阶段 3后一分钟 4比赛结束 9补给区回血 10保留(无响应)
|
||||
// 0 未开始 1 进攻点1 2 进攻点2 3 不动 4 回初始点 9补血
|
||||
if (referee_data->GameState.game_progress < 4)
|
||||
behave_flag = 0;
|
||||
else if (referee_data->GameState.game_progress == 4) {
|
||||
if (referee_data->GameState.stage_remain_time >= (300 - 60))
|
||||
if (referee_data->GameState.stage_remain_time >= (420 - 60))
|
||||
behave_flag = 1;//前一分钟
|
||||
else if (referee_data->GameState.stage_remain_time <= 60)
|
||||
behave_flag = 3;//后一分钟
|
||||
|
|
|
@ -28,8 +28,8 @@ static DaemonInstance *vision_daemon_instance;
|
|||
void VisionSetFlag(Enemy_Color_e enemy_color,uint8_t game_progress,uint16_t outpost_hp)
|
||||
{
|
||||
send_data.detect_color = enemy_color;
|
||||
// send_data.game_progress = game_progress;
|
||||
// send_data.outpost_hp = outpost_hp;
|
||||
send_data.game_progress = game_progress;
|
||||
send_data.outpost_hp = outpost_hp;
|
||||
send_data.reserved = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue