修正读取电源管理输出状态

This commit is contained in:
宋家齐 2024-05-17 05:03:02 +08:00
parent 0fd5ef7c8d
commit 7ec9ec3a98
2 changed files with 12 additions and 50 deletions

View File

@ -101,39 +101,8 @@ void RobotCMDInit() {
robot_state = ROBOT_READY; // 启动时机器人进入工作模式,后续加入所有应用初始化完成之后再进入
}
/**
* @brief gimbal app传回的当前电机角度计算和零位的误差
* 0~360,
*
*/
//static void CalcOffsetAngle() {
// // 别名angle提高可读性,不然太长了不好看,虽然基本不会动这个函数
// static float angle;
// angle = gimbal_fetch_data.yaw_motor_single_round_angle; // 从云台获取的当前yaw电机单圈角度
//#if YAW_ECD_GREATER_THAN_4096 // 如果大于180度
// if (angle > YAW_ALIGN_ANGLE && angle <= 180.0f + YAW_ALIGN_ANGLE)
// chassis_cmd_send.offset_angle = angle - YAW_ALIGN_ANGLE;
// else if (angle > 180.0f + YAW_ALIGN_ANGLE)
// chassis_cmd_send.offset_angle = angle - YAW_ALIGN_ANGLE - 360.0f;
// else
// chassis_cmd_send.offset_angle = angle - YAW_ALIGN_ANGLE;
//#else // 小于180度
// if (angle > YAW_ALIGN_ANGLE)
// chassis_cmd_send.offset_angle = angle - YAW_ALIGN_ANGLE;
// else if (angle <= YAW_ALIGN_ANGLE && angle >= YAW_ALIGN_ANGLE - 180.0f)
// chassis_cmd_send.offset_angle = angle - YAW_ALIGN_ANGLE;
// else
// chassis_cmd_send.offset_angle = angle - YAW_ALIGN_ANGLE + 360.0f;
//#endif
//}
static void death_check()
{
if(referee_data->GameRobotState.remain_HP)
{
gimbal_cmd_send.MotorEnableFlag=5;
}
}
/**
* @brief ()
*
@ -428,12 +397,12 @@ void RobotCMDTask() {
EmergencyHandler(); // 处理模块离线和遥控器急停等紧急情况
//裁判系统断电则不使能
if(referee_data->GameRobotState.mains_power_chassis_output == 0)
if(referee_data->GameRobotState.power_management_chassis_output == 0)
{
chassis_cmd_send.chassis_mode = CHASSIS_ZERO_FORCE;
to_stretch_cmd_send.to_stretch_mode = TO_STRETCH_ZERO_FORCE;
}
if(referee_data->GameRobotState.mains_power_gimbal_output == 0)
if(referee_data->GameRobotState.power_management_gimbal_output == 0)
{
gimbal_cmd_send.gimbal_mode = GIMBAL_ZERO_FORCE;
}

View File

@ -95,7 +95,7 @@ typedef enum
LEN_game_robot_HP = 2, // 0x0003
LEN_event_data = 4, // 0x0101
LEN_supply_projectile_action = 4, // 0x0102
LEN_game_robot_state = 27, // 0x0201
LEN_game_robot_state = 13, // 0x0201
LEN_power_heat_data = 14, // 0x0202
LEN_game_robot_pos = 16, // 0x0203
LEN_buff_musk = 1, // 0x0204
@ -162,26 +162,19 @@ typedef struct
uint8_t supply_projectile_num;
} ext_supply_projectile_action_t;
/* ID: 0X0201 Byte: 27 机器人状态数据 */
/* ID: 0X0201 Byte: 13 机器人状态数据 */
typedef struct
{
uint8_t robot_id;
uint8_t robot_level;
uint16_t remain_HP;
uint16_t max_HP;
uint16_t shooter_id1_17mm_cooling_rate;
uint16_t shooter_id1_17mm_cooling_limit;
uint16_t shooter_id1_17mm_speed_limit;
uint16_t shooter_id2_17mm_cooling_rate;
uint16_t shooter_id2_17mm_cooling_limit;
uint16_t shooter_id2_17mm_speed_limit;
uint16_t shooter_id1_42mm_cooling_rate;
uint16_t shooter_id1_42mm_cooling_limit;
uint16_t shooter_id1_42mm_speed_limit;
uint16_t current_HP;
uint16_t maximum_HP;
uint16_t shooter_barrel_cooling_value;
uint16_t shooter_barrel_heat_limit;
uint16_t chassis_power_limit;
uint8_t mains_power_gimbal_output : 1;
uint8_t mains_power_chassis_output : 1;
uint8_t mains_power_shooter_output : 1;
uint8_t power_management_gimbal_output : 1;
uint8_t power_management_chassis_output : 1;
uint8_t power_management_shooter_output : 1;
} ext_game_robot_state_t;
/* ID: 0X0202 Byte: 14 实时功率热量数据 */