diff --git a/Src/main.c b/Src/main.c index 5367de8..51a6588 100644 --- a/Src/main.c +++ b/Src/main.c @@ -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 */ diff --git a/application/cmd/robot_cmd.c b/application/cmd/robot_cmd.c index e4bf2c5..0deeca3 100644 --- a/application/cmd/robot_cmd.c +++ b/application/cmd/robot_cmd.c @@ -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;//后一分钟 diff --git a/modules/master_machine/master_process.c b/modules/master_machine/master_process.c index aadf3f0..6305842 100644 --- a/modules/master_machine/master_process.c +++ b/modules/master_machine/master_process.c @@ -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; }