2024超级对抗赛版本
This commit is contained in:
parent
63a236d608
commit
954942466a
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
@ -230,7 +230,8 @@ static void EstimateSpeed()
|
|||
// chassis_feedback_data.vx vy wz =
|
||||
// ...
|
||||
}
|
||||
|
||||
static float rotate_v = -3.0f * PI;
|
||||
static chassis_mode_e last_chassis_mode;
|
||||
/* 机器人底盘控制核心任务 */
|
||||
void ChassisTask()
|
||||
{
|
||||
|
@ -270,12 +271,13 @@ void ChassisTask()
|
|||
chassis_cmd_recv.wz = 0.1f * chassis_cmd_recv.offset_angle;
|
||||
break;
|
||||
case CHASSIS_ROTATE: // 自旋,同时保持全向机动;当前wz维持定值,后续增加不规则的变速策略
|
||||
chassis_cmd_recv.wz = -3.0f*PI;
|
||||
if(last_chassis_mode != CHASSIS_ROTATE) rotate_v = -rotate_v;
|
||||
chassis_cmd_recv.wz = rotate_v;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
last_chassis_mode= chassis_cmd_recv.chassis_mode;
|
||||
// 根据云台和底盘的角度offset将控制量映射到底盘坐标系上
|
||||
// 底盘逆时针旋转为角度正方向;云台命令的方向以云台指向的方向为x,采用右手系(x指向正北时y在正)西方
|
||||
static float sin_theta, cos_theta;
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
#define YAW_ALIGN_ANGLE 245.0f //(YAW_CHASSIS_ALIGN_ECD * ECD_ANGLE_COEF_DJI) // 对齐时的角度,0-360
|
||||
#define PTICH_HORIZON_ANGLE (PITCH_HORIZON_ECD * ECD_ANGLE_COEF_DJI) // pitch水平时电机的角度,0-360
|
||||
|
||||
#define PITCH_SCAN -10.0f //扫描阶段PITCH固定角度
|
||||
#define PITCH_SCAN 20.0f //扫描阶段PITCH固定角度 寻找前哨站
|
||||
|
||||
#define SHOOT_RATE 10.0f //射频
|
||||
#define SHOOT_RATE 15.0f //射频
|
||||
#define MIN_SHOOT_RATE 5.0f //热量过高降低射频射频
|
||||
|
||||
/* cmd应用包含的模块实例指针和交互信息存储*/
|
||||
#ifdef GIMBAL_BOARD // 对双板的兼容,条件编译
|
||||
|
@ -179,7 +180,7 @@ static void RemoteControlSet() {
|
|||
//左侧开关状态为[下],视觉模式
|
||||
if (switch_is_down(rc_data[TEMP].rc.switch_left)) {
|
||||
gimbal_cmd_send.control_mode = TEST_CONTROL;
|
||||
trajectory_cal.v0 = 28; //弹速30
|
||||
trajectory_cal.v0 = 25; //弹速30
|
||||
if (vision_recv_data->x == 0 && vision_recv_data->y == 0 && vision_recv_data->z == 0
|
||||
&& vision_recv_data->vx == 0 && vision_recv_data->vy == 0 && vision_recv_data->vz == 0) {
|
||||
aim_select.suggest_fire = 0;
|
||||
|
@ -206,7 +207,7 @@ static void RemoteControlSet() {
|
|||
gimbal_cmd_send.pitch = trajectory_cal.cmd_pitch * 180 / PI;
|
||||
float yaw_err = fabsf(gimbal_cmd_send.yaw - gimbal_fetch_data.gimbal_imu_data.Yaw);
|
||||
|
||||
if (yaw_err <= 5) //3度
|
||||
if (yaw_err <= 3) //3度
|
||||
aim_select.suggest_fire = 1;
|
||||
else
|
||||
aim_select.suggest_fire = 0;
|
||||
|
@ -266,7 +267,23 @@ static void RemoteControlSet() {
|
|||
static uint8_t sentry_state;
|
||||
|
||||
static void AutoControlSet() {
|
||||
chassis_cmd_send.chassis_mode = CHASSIS_ROTATE;
|
||||
uint16_t myOutpost = 0,theirOutpost = 0;
|
||||
|
||||
if(referee_data->referee_id.Robot_Color == Robot_Blue)
|
||||
{
|
||||
myOutpost = referee_data->GameRobotHP.blue_outpost_HP;
|
||||
theirOutpost = referee_data->GameRobotHP.red_outpost_HP;
|
||||
}
|
||||
else if(referee_data->referee_id.Robot_Color == Robot_Red)
|
||||
{
|
||||
myOutpost = referee_data->GameRobotHP.red_outpost_HP;
|
||||
theirOutpost = referee_data->GameRobotHP.blue_outpost_HP;
|
||||
}
|
||||
|
||||
if(myOutpost > 0)
|
||||
chassis_cmd_send.chassis_mode = CHASSIS_FOLLOW_GIMBAL_YAW;
|
||||
else
|
||||
chassis_cmd_send.chassis_mode = CHASSIS_ROTATE;
|
||||
|
||||
chassis_cmd_send.vx = vision_recv_data->nav_vx;
|
||||
chassis_cmd_send.vy = vision_recv_data->nav_vy;
|
||||
|
@ -281,21 +298,22 @@ static void AutoControlSet() {
|
|||
|
||||
//小云台扫描
|
||||
if (gimbal_scan_flag == 1) {
|
||||
|
||||
gimbal_cmd_send.pitch = PITCH_SCAN;
|
||||
|
||||
//if(sentry_state > 1)
|
||||
{
|
||||
// if (yaw_dir == 1) gimbal_cmd_send.yaw += 0.06f;
|
||||
// else gimbal_cmd_send.yaw -= 0.06f;
|
||||
// if (gimbal_fetch_data.mini_yaw_encode_angle <= YAW_MIN_ENCODE_ANGLE + 2.0f) yaw_dir = 1;
|
||||
// if (gimbal_fetch_data.mini_yaw_encode_angle >= YAW_MAX_ENCODE_ANGLE - 2.0f) yaw_dir = -1;
|
||||
if(sentry_state != 1){ //为一时进攻前哨站
|
||||
gimbal_cmd_send.pitch = 0;
|
||||
}else{
|
||||
gimbal_cmd_send.pitch = PITCH_SCAN;
|
||||
}
|
||||
|
||||
|
||||
if (yaw_dir == 1) gimbal_cmd_send.yaw += 0.06f;
|
||||
else gimbal_cmd_send.yaw -= 0.06f;
|
||||
if (gimbal_fetch_data.mini_yaw_encode_angle <= YAW_MIN_ENCODE_ANGLE + 2.0f) yaw_dir = 1;
|
||||
if (gimbal_fetch_data.mini_yaw_encode_angle >= YAW_MAX_ENCODE_ANGLE - 2.0f) yaw_dir = -1;
|
||||
|
||||
shoot_cmd_send.load_mode = LOAD_STOP;
|
||||
}
|
||||
|
||||
trajectory_cal.v0 = 35; //弹速30
|
||||
trajectory_cal.v0 = 28; //弹速30
|
||||
if (vision_recv_data->x == 0 && vision_recv_data->y == 0 && vision_recv_data->z == 0
|
||||
&& vision_recv_data->vx == 0 && vision_recv_data->vy == 0 && vision_recv_data->vz == 0) {
|
||||
aim_select.suggest_fire = 0;
|
||||
|
@ -317,11 +335,19 @@ static void AutoControlSet() {
|
|||
|
||||
VisionSetAim(aim_select.aim_point[0], aim_select.aim_point[1], aim_select.aim_point[2]);
|
||||
|
||||
gimbal_cmd_send.yaw = trajectory_cal.cmd_yaw * 180 / PI;
|
||||
float single_angle_yaw_now = gimbal_fetch_data.gimbal_imu_data.Yaw;
|
||||
float diff_yaw = trajectory_cal.cmd_yaw * 180 / PI - single_angle_yaw_now;
|
||||
float yaw_err = diff_yaw;
|
||||
|
||||
if (diff_yaw > 180)
|
||||
diff_yaw -= 360;
|
||||
else if (diff_yaw < -180)
|
||||
diff_yaw += 360;
|
||||
|
||||
gimbal_cmd_send.yaw = gimbal_fetch_data.gimbal_imu_data.YawTotalAngle + diff_yaw;
|
||||
|
||||
gimbal_cmd_send.pitch = trajectory_cal.cmd_pitch * 180 / PI;
|
||||
|
||||
float yaw_err = fabsf(gimbal_cmd_send.yaw - gimbal_fetch_data.gimbal_imu_data.Yaw);
|
||||
if (yaw_err <= 5) //3度
|
||||
{
|
||||
aim_select.suggest_fire = 1;
|
||||
|
@ -333,8 +359,12 @@ static void AutoControlSet() {
|
|||
//shoot_cmd_send.shoot_mode = SHOOT_OFF;
|
||||
shoot_cmd_send.load_mode = LOAD_STOP;
|
||||
}
|
||||
//摩擦轮始终开启
|
||||
shoot_cmd_send.friction_mode = FRICTION_ON;
|
||||
|
||||
if (gimbal_fetch_data.mini_yaw_encode_angle <= YAW_MIN_ENCODE_ANGLE + 2.0f)
|
||||
gimbal_cmd_send.yaw = gimbal_fetch_data.gimbal_imu_data.YawTotalAngle;
|
||||
if (gimbal_fetch_data.mini_yaw_encode_angle >= YAW_MAX_ENCODE_ANGLE - 2.0f)
|
||||
gimbal_cmd_send.yaw = gimbal_fetch_data.gimbal_imu_data.YawTotalAngle;
|
||||
|
||||
}
|
||||
// 射频控制,固定每秒1发,后续可以根据左侧拨轮的值大小切换射频,
|
||||
//shoot_cmd_send.shoot_rate = 8;
|
||||
|
@ -344,6 +374,7 @@ static void AutoControlSet() {
|
|||
|
||||
if (shoot_fetch_data.stalled_flag == 1)
|
||||
shoot_cmd_send.load_mode = LOAD_REVERSE;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -380,9 +411,10 @@ static void EmergencyHandler() {
|
|||
}
|
||||
|
||||
uint8_t sentry_behave();
|
||||
uint8_t sentry_behave_RMUC();
|
||||
|
||||
/* 机器人核心控制任务,200Hz频率运行(必须高于视觉发送频率) */
|
||||
static uint8_t is_died; //死亡标志位
|
||||
static uint8_t cool_down;
|
||||
|
||||
void RobotCMDTask() {
|
||||
// 从其他应用获取回传数据
|
||||
|
@ -398,31 +430,6 @@ void RobotCMDTask() {
|
|||
// 根据gimbal的反馈值计算云台和底盘正方向的夹角,不需要传参,通过static私有变量完成
|
||||
CalcOffsetAngle();
|
||||
|
||||
//云台离线重新发送电机使能命令
|
||||
// if(referee_data->GameRobotState.power_management_gimbal_output == 0){
|
||||
// is_died = 1;
|
||||
// }
|
||||
// if(is_died == 1 && referee_data->GameRobotState.current_HP > 4 ){
|
||||
// is_died = 0;
|
||||
// DWT_Delay(0.08);
|
||||
// gimbal_cmd_send.enable_motor = 1;
|
||||
// enable_count++;
|
||||
// }
|
||||
// if(enable_count>0 && enable_count <20){
|
||||
// DWT_Delay(0.08);
|
||||
// gimbal_cmd_send.enable_motor = 1;
|
||||
// enable_count++;
|
||||
// }else{
|
||||
// enable_count = 0;
|
||||
// }
|
||||
|
||||
// if(is_died == 1 && referee_data->GameRobotState.power_management_gimbal_output ){
|
||||
// is_died = 0;
|
||||
// gimbal_cmd_send.enable_motor = 00;
|
||||
// }
|
||||
// if(gimbal_cmd_send.enable_motor >0 && referee_data->GameRobotState.power_management_gimbal_output){
|
||||
// gimbal_cmd_send.enable_motor--;
|
||||
// }
|
||||
|
||||
// 根据遥控器左侧开关,确定当前使用的控制模式为遥控器调试还是键鼠
|
||||
static control_mode_e last_gimbal_mode = 0;
|
||||
|
@ -452,6 +459,15 @@ void RobotCMDTask() {
|
|||
if (referee_data->PowerHeatData.shooter_17mm_1_barrel_heat > 350)
|
||||
shoot_cmd_send.load_mode = LOAD_STOP;
|
||||
|
||||
if (referee_data->PowerHeatData.shooter_17mm_1_barrel_heat > 350){
|
||||
cool_down = 1; //进入冷却状态
|
||||
}else if(referee_data->PowerHeatData.shooter_17mm_1_barrel_heat < 100){
|
||||
cool_down = 0; //退出冷却状态
|
||||
}
|
||||
if(cool_down){
|
||||
shoot_cmd_send.shoot_rate = MIN_SHOOT_RATE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// chassis_feedback_data.enemy_color = !referee_data->referee_id.Robot_Color;
|
||||
|
@ -463,7 +479,8 @@ void RobotCMDTask() {
|
|||
// 设置视觉发送数据,还需增加加速度和角速度数据
|
||||
// VisionSetFlag(chassis_fetch_data.enemy_color,,chassis_fetch_data.bullet_speed)
|
||||
|
||||
sentry_state = sentry_behave();
|
||||
|
||||
|
||||
|
||||
// if (referee_data->GameState.game_progress == 4) {
|
||||
// if (referee_data->GameState.stage_remain_time >= (300 - 60))
|
||||
|
@ -475,8 +492,16 @@ void RobotCMDTask() {
|
|||
// }
|
||||
//
|
||||
// gimbal_cmd_send.game_state = sentry_state;
|
||||
|
||||
VisionSetFlag(!referee_data->referee_id.Robot_Color, sentry_state, referee_data->GameRobotState.current_HP);
|
||||
//对抗赛版本决策
|
||||
sentry_state = sentry_behave_RMUC();
|
||||
static float target_x,target_y;
|
||||
if(referee_data->map_command.cmd_keyboard == 'G')
|
||||
{
|
||||
//蓝方启动区中心为原点 28 - 6*2
|
||||
target_x = -(referee_data->map_command.target_position_x - 22.10f); // 参考原点为红方启动区中心 //x正方向为蓝方基地方向
|
||||
target_y = -(referee_data->map_command.target_position_y - 8.10f) + 1.6f; //y正方向为红方飞镖闸门侧 //ros 为右手系
|
||||
}
|
||||
VisionSetFlag(!referee_data->referee_id.Robot_Color, sentry_state, target_x, target_y);
|
||||
// 推送消息,双板通信,视觉通信等
|
||||
// 其他应用所需的控制数据在remotecontrolsetmode和mousekeysetmode中完成设置
|
||||
#ifdef ONE_BOARD
|
||||
|
@ -510,7 +535,7 @@ uint8_t sentry_behave() {
|
|||
} else if (referee_data->GameState.game_progress == 5)
|
||||
behave_flag = 4;
|
||||
|
||||
if (referee_data->GameRobotState.current_HP < 200 && referee_data->GameState.stage_remain_time >= 60 ) {
|
||||
if (referee_data->GameRobotState.current_HP < 200 && referee_data->GameState.stage_remain_time >= 60) {
|
||||
behave_flag = 9;
|
||||
}
|
||||
|
||||
|
@ -532,3 +557,41 @@ uint8_t sentry_behave() {
|
|||
last_behave_flag = behave_flag;
|
||||
return behave_flag;
|
||||
}
|
||||
|
||||
uint8_t sentry_behave_RMUC()
|
||||
{
|
||||
uint8_t behave_flag = 0;
|
||||
uint16_t myOutpost,theirOutpost;
|
||||
if(referee_data->referee_id.Robot_Color == Robot_Blue)
|
||||
{
|
||||
myOutpost = referee_data->GameRobotHP.blue_outpost_HP;
|
||||
theirOutpost = referee_data->GameRobotHP.red_outpost_HP;
|
||||
}
|
||||
else if(referee_data->referee_id.Robot_Color == Robot_Red)
|
||||
{
|
||||
myOutpost = referee_data->GameRobotHP.red_outpost_HP;
|
||||
theirOutpost = referee_data->GameRobotHP.blue_outpost_HP;
|
||||
}
|
||||
uint16_t allowance = referee_data->projectile_allowance.projectile_allowance_17mm;
|
||||
// 准备阶段
|
||||
if (referee_data->GameState.game_progress < 4)
|
||||
behave_flag = 0;
|
||||
|
||||
else if(referee_data->GameState.game_progress == 4)
|
||||
{
|
||||
if( theirOutpost>0 && myOutpost>400)
|
||||
behave_flag = 1; //打前哨站
|
||||
if( theirOutpost<=0 || myOutpost<=400 || allowance <= 0)
|
||||
behave_flag = 2; //回巡逻站
|
||||
// if(referee_data->GameRobotState.current_HP <= 100)
|
||||
// behave_flag = 9; //回补给区
|
||||
}
|
||||
|
||||
// 比赛结束
|
||||
else if (referee_data->GameState.game_progress == 5)
|
||||
behave_flag = 4;
|
||||
|
||||
|
||||
|
||||
return behave_flag;
|
||||
}
|
||||
|
|
|
@ -35,86 +35,85 @@ static Subscriber_t *chassis_sub; // 用于订阅底盘的控
|
|||
static Chassis_Ctrl_Cmd_s chassis_cmd_recv; // 底盘接收到的控制命令
|
||||
|
||||
|
||||
void GimbalInit()
|
||||
{
|
||||
void GimbalInit() {
|
||||
gimba_IMU_data = INS_Init(); // IMU先初始化,获取姿态数据指针赋给yaw电机的其他数据来源
|
||||
// YAW
|
||||
Motor_Init_Config_s yaw_config = {
|
||||
|
||||
.can_init_config = {
|
||||
.can_handle = &hcan1,
|
||||
.tx_id = 1,
|
||||
},
|
||||
.controller_param_init_config = {
|
||||
.angle_PID = {
|
||||
.Kp = 0.5f, // 8
|
||||
.Ki = 0,
|
||||
.Kd = 0,
|
||||
.DeadBand = 0.1,
|
||||
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
|
||||
.IntegralLimit = 100,
|
||||
.can_init_config = {
|
||||
.can_handle = &hcan1,
|
||||
.tx_id = 1,
|
||||
},
|
||||
.controller_param_init_config = {
|
||||
.angle_PID = {
|
||||
.Kp = 0.5f, // 8
|
||||
.Ki = 0,
|
||||
.Kd = 0,
|
||||
.DeadBand = 0.1,
|
||||
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
|
||||
.IntegralLimit = 100,
|
||||
|
||||
.MaxOut = 500,
|
||||
.MaxOut = 500,
|
||||
},
|
||||
.speed_PID = {
|
||||
.Kp = 6000, // 50
|
||||
.Ki = 500,//5000, // 200
|
||||
.Kd = 0,
|
||||
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
|
||||
.IntegralLimit = 5000,
|
||||
.MaxOut = 16000,
|
||||
},
|
||||
.other_angle_feedback_ptr = &gimba_IMU_data->YawTotalAngle,
|
||||
// 还需要增加角速度额外反馈指针,注意方向,ins_task.md中有c板的bodyframe坐标系说明
|
||||
.other_speed_feedback_ptr = &yaw_speed,//&gimba_IMU_data->Gyro[2],
|
||||
},
|
||||
.speed_PID = {
|
||||
.Kp = 6000, // 50
|
||||
.Ki = 500,//5000, // 200
|
||||
.Kd = 0,
|
||||
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
|
||||
.IntegralLimit = 5000,
|
||||
.MaxOut = 16000,
|
||||
.controller_setting_init_config = {
|
||||
.angle_feedback_source = OTHER_FEED,
|
||||
.speed_feedback_source = OTHER_FEED,
|
||||
.outer_loop_type = ANGLE_LOOP,
|
||||
.close_loop_type = SPEED_LOOP | ANGLE_LOOP,
|
||||
.motor_reverse_flag = MOTOR_DIRECTION_NORMAL,
|
||||
},
|
||||
.other_angle_feedback_ptr = &gimba_IMU_data->YawTotalAngle,
|
||||
// 还需要增加角速度额外反馈指针,注意方向,ins_task.md中有c板的bodyframe坐标系说明
|
||||
.other_speed_feedback_ptr = &yaw_speed,//&gimba_IMU_data->Gyro[2],
|
||||
},
|
||||
.controller_setting_init_config = {
|
||||
.angle_feedback_source = OTHER_FEED,
|
||||
.speed_feedback_source = OTHER_FEED,
|
||||
.outer_loop_type = ANGLE_LOOP,
|
||||
.close_loop_type = SPEED_LOOP | ANGLE_LOOP,
|
||||
.motor_reverse_flag = MOTOR_DIRECTION_NORMAL,
|
||||
},
|
||||
.motor_type = GM6020,
|
||||
.motor_control_type = CURRENT_CONTROL
|
||||
.motor_type = GM6020,
|
||||
.motor_control_type = CURRENT_CONTROL
|
||||
};
|
||||
// PITCH
|
||||
Motor_Init_Config_s pitch_config = {
|
||||
.can_init_config = {
|
||||
.can_handle = &hcan1,
|
||||
.tx_id = 2,
|
||||
},
|
||||
.controller_param_init_config = {
|
||||
.angle_PID = {
|
||||
.Kp = -1.8f,//4.0f,//2.0f
|
||||
.Ki = -1.5f,//1,//0
|
||||
.Kd = 0.0f,//0.0f
|
||||
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
|
||||
.IntegralLimit = 100,
|
||||
.MaxOut = 500,
|
||||
.can_init_config = {
|
||||
.can_handle = &hcan1,
|
||||
.tx_id = 2,
|
||||
},
|
||||
.speed_PID = {
|
||||
.Kp = -4000,//-4500,//6000,//800
|
||||
.Ki = -10000, //-600,//500,//100
|
||||
.Kd = 0,//0
|
||||
.Improve = PID_Integral_Limit | PID_Derivative_On_Measurement,
|
||||
.IntegralLimit = 10000,
|
||||
.MaxOut = 30000,
|
||||
},
|
||||
.other_angle_feedback_ptr = &gimba_IMU_data->Roll,//&gimba_IMU_data->Pitch,
|
||||
// 还需要增加角速度额外反馈指针,注意方向,ins_task.md中有c板的bodyframe坐标系说明
|
||||
.other_speed_feedback_ptr = (&gimba_IMU_data->Gyro[1]),//(&gimba_IMU_data->Gyro[0]),
|
||||
.current_feedforward_ptr = ¤t_feedforward,
|
||||
.controller_param_init_config = {
|
||||
.angle_PID = {
|
||||
.Kp = -0.6f,//4.0f,//2.0f
|
||||
.Ki = -0.8f,//1,//0
|
||||
.Kd = 0.0f,//0.0f
|
||||
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
|
||||
.IntegralLimit = 100,
|
||||
.MaxOut = 500,
|
||||
},
|
||||
.speed_PID = {
|
||||
.Kp = -4000,//-4500,//6000,//800
|
||||
.Ki = -6000, //-600,//500,//100
|
||||
.Kd = 0,//0
|
||||
.Improve = PID_Integral_Limit | PID_Derivative_On_Measurement,
|
||||
.IntegralLimit = 10000,
|
||||
.MaxOut = 30000,
|
||||
},
|
||||
.other_angle_feedback_ptr = &gimba_IMU_data->Roll,//&gimba_IMU_data->Pitch,
|
||||
// 还需要增加角速度额外反馈指针,注意方向,ins_task.md中有c板的bodyframe坐标系说明
|
||||
.other_speed_feedback_ptr = (&gimba_IMU_data->Gyro[1]),//(&gimba_IMU_data->Gyro[0]),
|
||||
.current_feedforward_ptr = ¤t_feedforward,
|
||||
|
||||
},
|
||||
.controller_setting_init_config = {
|
||||
.outer_loop_type = ANGLE_LOOP,
|
||||
.close_loop_type = ANGLE_LOOP|SPEED_LOOP|CURRENT_LOOP,
|
||||
.motor_reverse_flag = MOTOR_DIRECTION_NORMAL,
|
||||
.feedforward_flag = CURRENT_FEEDFORWARD,
|
||||
},
|
||||
.motor_type = GM6020,
|
||||
.motor_control_type = CURRENT_CONTROL,//CURRENT_CONTROL
|
||||
},
|
||||
.controller_setting_init_config = {
|
||||
.outer_loop_type = ANGLE_LOOP,
|
||||
.close_loop_type = ANGLE_LOOP | SPEED_LOOP | CURRENT_LOOP,
|
||||
.motor_reverse_flag = MOTOR_DIRECTION_NORMAL,
|
||||
.feedforward_flag = CURRENT_FEEDFORWARD,
|
||||
},
|
||||
.motor_type = GM6020,
|
||||
.motor_control_type = CURRENT_CONTROL,//CURRENT_CONTROL
|
||||
};
|
||||
//大YAW
|
||||
Motor_Init_Config_s big_yaw_config = {
|
||||
|
@ -128,7 +127,7 @@ void GimbalInit()
|
|||
.Kp = 0.15f,
|
||||
.Ki = 0.0f,
|
||||
.Kd = 0.005f,
|
||||
.Improve = PID_Integral_Limit | PID_Derivative_On_Measurement |PID_DerivativeFilter,
|
||||
.Improve = PID_Integral_Limit | PID_Derivative_On_Measurement | PID_DerivativeFilter,
|
||||
.IntegralLimit = 100,
|
||||
.MaxOut = 1000,
|
||||
.DeadBand = 0,
|
||||
|
@ -148,7 +147,7 @@ void GimbalInit()
|
|||
.angle_feedback_source = OTHER_FEED,
|
||||
.speed_feedback_source = OTHER_FEED,
|
||||
.outer_loop_type = ANGLE_LOOP,
|
||||
.close_loop_type = ANGLE_LOOP|SPEED_LOOP|CURRENT_LOOP,
|
||||
.close_loop_type = ANGLE_LOOP | SPEED_LOOP | CURRENT_LOOP,
|
||||
.motor_reverse_flag = MOTOR_DIRECTION_NORMAL,
|
||||
},
|
||||
.motor_type = DM4310,
|
||||
|
@ -170,8 +169,7 @@ void GimbalInit()
|
|||
}
|
||||
|
||||
/* 机器人云台控制核心任务,后续考虑只保留IMU控制,不再需要电机的反馈 */
|
||||
void GimbalTask()
|
||||
{
|
||||
void GimbalTask() {
|
||||
// 获取云台控制数据
|
||||
// 后续增加未收到数据的处理
|
||||
SubGetMessage(gimbal_sub, &gimbal_cmd_recv);
|
||||
|
@ -185,40 +183,39 @@ void GimbalTask()
|
|||
|
||||
// @todo:现在已不再需要电机反馈,实际上可以始终使用IMU的姿态数据来作为云台的反馈,yaw电机的offset只是用来跟随底盘
|
||||
// 根据控制模式进行电机反馈切换和过渡,视觉模式在robot_cmd模块就已经设置好,gimbal只看yaw_ref和pitch_ref
|
||||
switch (gimbal_cmd_recv.gimbal_mode)
|
||||
{
|
||||
// 停止
|
||||
case GIMBAL_ZERO_FORCE:
|
||||
DJIMotorStop(yaw_motor);
|
||||
DJIMotorStop(pitch_motor);
|
||||
DMMotorStop(big_yaw_motor);
|
||||
break;
|
||||
// 使用陀螺仪的反馈,底盘根据yaw电机的offset跟随云台或视觉模式采用
|
||||
case GIMBAL_GYRO_MODE: // 后续只保留此模式
|
||||
DJIMotorEnable(yaw_motor);
|
||||
DJIMotorEnable(pitch_motor);
|
||||
DMMotorEnable(big_yaw_motor);
|
||||
switch (gimbal_cmd_recv.gimbal_mode) {
|
||||
// 停止
|
||||
case GIMBAL_ZERO_FORCE:
|
||||
DJIMotorStop(yaw_motor);
|
||||
DJIMotorStop(pitch_motor);
|
||||
DMMotorStop(big_yaw_motor);
|
||||
break;
|
||||
// 使用陀螺仪的反馈,底盘根据yaw电机的offset跟随云台或视觉模式采用
|
||||
case GIMBAL_GYRO_MODE: // 后续只保留此模式
|
||||
DJIMotorEnable(yaw_motor);
|
||||
DJIMotorEnable(pitch_motor);
|
||||
DMMotorEnable(big_yaw_motor);
|
||||
|
||||
DJIMotorChangeFeed(yaw_motor, ANGLE_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(yaw_motor, SPEED_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(pitch_motor, ANGLE_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(pitch_motor, SPEED_LOOP, OTHER_FEED);
|
||||
DJIMotorSetRef(yaw_motor, gimbal_cmd_recv.yaw); // yaw和pitch会在robot_cmd中处理好多圈和单圈
|
||||
DJIMotorSetRef(pitch_motor, gimbal_cmd_recv.pitch);
|
||||
DJIMotorChangeFeed(yaw_motor, ANGLE_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(yaw_motor, SPEED_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(pitch_motor, ANGLE_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(pitch_motor, SPEED_LOOP, OTHER_FEED);
|
||||
DJIMotorSetRef(yaw_motor, gimbal_cmd_recv.yaw); // yaw和pitch会在robot_cmd中处理好多圈和单圈
|
||||
DJIMotorSetRef(pitch_motor, gimbal_cmd_recv.pitch);
|
||||
|
||||
DMMotorSetRef(big_yaw_motor,gimbal_cmd_recv.big_yaw);
|
||||
break;
|
||||
// 云台自由模式,使用编码器反馈,底盘和云台分离,仅云台旋转,一般用于调整云台姿态(英雄吊射等)/能量机关
|
||||
case GIMBAL_FREE_MODE: // 后续删除,或加入云台追地盘的跟随模式(响应速度更快)
|
||||
DJIMotorEnable(yaw_motor);
|
||||
DJIMotorEnable(pitch_motor);
|
||||
DMMotorEnable(big_yaw_motor);
|
||||
DJIMotorChangeFeed(yaw_motor, ANGLE_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(yaw_motor, SPEED_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(pitch_motor, ANGLE_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(pitch_motor, SPEED_LOOP, OTHER_FEED);
|
||||
DJIMotorSetRef(yaw_motor, gimbal_cmd_recv.yaw); // yaw和pitch会在robot_cmd中处理好多圈和单圈
|
||||
DJIMotorSetRef(pitch_motor, gimbal_cmd_recv.pitch);
|
||||
DMMotorSetRef(big_yaw_motor, gimbal_cmd_recv.big_yaw);
|
||||
break;
|
||||
// 云台自由模式,使用编码器反馈,底盘和云台分离,仅云台旋转,一般用于调整云台姿态(英雄吊射等)/能量机关
|
||||
case GIMBAL_FREE_MODE: // 后续删除,或加入云台追地盘的跟随模式(响应速度更快)
|
||||
DJIMotorEnable(yaw_motor);
|
||||
DJIMotorEnable(pitch_motor);
|
||||
DMMotorEnable(big_yaw_motor);
|
||||
DJIMotorChangeFeed(yaw_motor, ANGLE_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(yaw_motor, SPEED_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(pitch_motor, ANGLE_LOOP, OTHER_FEED);
|
||||
DJIMotorChangeFeed(pitch_motor, SPEED_LOOP, OTHER_FEED);
|
||||
DJIMotorSetRef(yaw_motor, gimbal_cmd_recv.yaw); // yaw和pitch会在robot_cmd中处理好多圈和单圈
|
||||
DJIMotorSetRef(pitch_motor, gimbal_cmd_recv.pitch);
|
||||
// big_yaw_angle = chassis_cmd_recv.offset_angle;
|
||||
// big_yaw_speed = big_yaw_motor->measure.speed_rads;
|
||||
//
|
||||
|
@ -226,10 +223,10 @@ void GimbalTask()
|
|||
// big_yaw_angle = gimba_IMU_data->YawTotalAngle - (yaw_motor->measure.total_angle - 44);
|
||||
// big_yaw_speed = yaw_speed - yaw_motor->measure.speed_aps * DEGREE_2_RAD;
|
||||
|
||||
DMMotorSetRef(big_yaw_motor,gimbal_cmd_recv.big_yaw);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
DMMotorSetRef(big_yaw_motor, gimbal_cmd_recv.big_yaw);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// 在合适的地方添加pitch重力补偿前馈力矩
|
||||
|
@ -239,7 +236,8 @@ void GimbalTask()
|
|||
float input = sin_input_generate(&sinInputGenerate);
|
||||
|
||||
//ANODT_SendF1(input*1000,pitch_motor->measure.speed_aps*1000,0,0);
|
||||
float theta = gimba_IMU_data->Roll/180*PI;//(pitch_motor->measure.angle_single_round - 5505 * ECD_ANGLE_COEF_DJI)/180*PI;
|
||||
float theta = gimba_IMU_data->Roll / 180 * PI;
|
||||
//(pitch_motor->measure.angle_single_round - 5505 * ECD_ANGLE_COEF_DJI)/180*PI;
|
||||
yaw_speed = gimba_IMU_data->Gyro[2] * arm_cos_f32(theta) - gimba_IMU_data->Gyro[0] * arm_sin_f32(theta);
|
||||
//big_yaw_angle = gimba_IMU_data->YawTotalAngle - (yaw_motor->measure.total_angle - 44);
|
||||
//big_yaw_speed = yaw_speed - yaw_motor->measure.speed_aps * DEGREE_2_RAD;
|
||||
|
@ -257,7 +255,7 @@ void GimbalTask()
|
|||
//yaw轴角速度
|
||||
|
||||
//重力补偿力矩
|
||||
current_feedforward = (1500)*arm_cos_f32(theta);
|
||||
current_feedforward = -10000 * arm_cos_f32(theta);
|
||||
//current_feedforward = 0;
|
||||
float vofa_send_data[6];
|
||||
vofa_send_data[0] = pitch_motor->measure.speed_aps;
|
||||
|
@ -267,7 +265,7 @@ void GimbalTask()
|
|||
vofa_send_data[4] = pitch_motor->motor_controller.speed_PID.Measure;
|
||||
vofa_send_data[5] = pitch_motor->measure.angle_single_round;
|
||||
|
||||
vofa_justfloat_output(vofa_send_data,24,&huart1);
|
||||
vofa_justfloat_output(vofa_send_data, 24, &huart1);
|
||||
|
||||
|
||||
|
||||
|
@ -275,16 +273,16 @@ void GimbalTask()
|
|||
gimbal_feedback_data.gimbal_imu_data = *gimba_IMU_data;
|
||||
|
||||
static float big_yaw_relative_angle;
|
||||
|
||||
big_yaw_relative_angle = big_yaw_motor->measure.total_angle ;
|
||||
|
||||
big_yaw_relative_angle = big_yaw_motor->measure.total_angle;
|
||||
|
||||
gimbal_feedback_data.yaw_motor_single_round_angle = big_yaw_motor->measure.angle_single_round;
|
||||
//loop_float_constrain(big_yaw_relative_angle,0,2*PI) * RAD_2_DEGREE;
|
||||
gimbal_feedback_data.mini_yaw_encode_angle = yaw_motor->measure.total_angle;
|
||||
//loop_float_constrain(big_yaw_relative_angle,0,2*PI) * RAD_2_DEGREE;
|
||||
gimbal_feedback_data.mini_yaw_encode_angle = yaw_motor->measure.angle_single_round;
|
||||
gimbal_feedback_data.big_yaw_online = DMMotorIsOnline(big_yaw_motor);
|
||||
gimbal_feedback_data.big_yaw_angle = big_yaw_angle;
|
||||
// 推送消息
|
||||
PubPushMessage(gimbal_pub, (void *)&gimbal_feedback_data);
|
||||
PubPushMessage(gimbal_pub, (void *) &gimbal_feedback_data);
|
||||
}
|
||||
|
||||
//以下代码为测试系统辨识时使用
|
||||
|
@ -302,19 +300,15 @@ void GimbalTask()
|
|||
// }
|
||||
//}
|
||||
|
||||
void sin_input_frequency_init(sin_input_generate_t* InputGenerate)
|
||||
{
|
||||
for(int i=0;i<43;i++)
|
||||
{
|
||||
InputGenerate->frequency[i] = 1.0 + 0.5*i;
|
||||
void sin_input_frequency_init(sin_input_generate_t *InputGenerate) {
|
||||
for (int i = 0; i < 43; i++) {
|
||||
InputGenerate->frequency[i] = 1.0 + 0.5 * i;
|
||||
}
|
||||
for(int i=0;i<9;i++)
|
||||
{
|
||||
InputGenerate->frequency[i+43] = 24.0 + 2.0*i;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
InputGenerate->frequency[i + 43] = 24.0 + 2.0 * i;
|
||||
}
|
||||
for(int i=0;i<8;i++)
|
||||
{
|
||||
InputGenerate->frequency[i+43+9] = 50 + 10*i;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
InputGenerate->frequency[i + 43 + 9] = 50 + 10 * i;
|
||||
}
|
||||
InputGenerate->frequency[60] = 200;
|
||||
InputGenerate->frequency[61] = 250;
|
||||
|
@ -322,38 +316,33 @@ void sin_input_frequency_init(sin_input_generate_t* InputGenerate)
|
|||
InputGenerate->frequency[63] = 500;
|
||||
}
|
||||
|
||||
float sin_input_generate(sin_input_generate_t* InputGenerate)
|
||||
{
|
||||
float sin_input_generate(sin_input_generate_t *InputGenerate) {
|
||||
InputGenerate->DeltaT = DWT_GetDeltaT(&InputGenerate->cnt);
|
||||
InputGenerate->time += InputGenerate->DeltaT;
|
||||
if(InputGenerate->time >= 20*(1/InputGenerate->frequency[InputGenerate->frequency_index]))
|
||||
{
|
||||
if (InputGenerate->time >= 20 * (1 / InputGenerate->frequency[InputGenerate->frequency_index])) {
|
||||
InputGenerate->time = 0;
|
||||
InputGenerate->frequency_index += 1;
|
||||
}
|
||||
if(InputGenerate->frequency_index >= 64)
|
||||
{
|
||||
if (InputGenerate->frequency_index >= 64) {
|
||||
InputGenerate->input = 0;
|
||||
}
|
||||
else
|
||||
InputGenerate->input = arm_sin_f32(2*PI*InputGenerate->frequency[InputGenerate->frequency_index]*InputGenerate->time);
|
||||
} else
|
||||
InputGenerate->input = arm_sin_f32(
|
||||
2 * PI * InputGenerate->frequency[InputGenerate->frequency_index] * InputGenerate->time);
|
||||
//float input = arm_sin_f32(2*PI*frequency*time);
|
||||
InputGenerate->input *= 2000;
|
||||
|
||||
return InputGenerate->input;
|
||||
}
|
||||
|
||||
float step_input_generate(sin_input_generate_t* InputGenerate)
|
||||
{
|
||||
float step_input_generate(sin_input_generate_t *InputGenerate) {
|
||||
static int8_t forward_flag = 1;
|
||||
InputGenerate->DeltaT = DWT_GetDeltaT(&InputGenerate->cnt);
|
||||
InputGenerate->time += InputGenerate->DeltaT;
|
||||
if(InputGenerate->time >= 3)
|
||||
{
|
||||
if(forward_flag ==1) forward_flag = -1;
|
||||
if (InputGenerate->time >= 3) {
|
||||
if (forward_flag == 1) forward_flag = -1;
|
||||
else if (forward_flag == -1) forward_flag = 1;
|
||||
|
||||
InputGenerate->time = 0;
|
||||
}
|
||||
return 60*forward_flag;
|
||||
return 60 * forward_flag;
|
||||
}
|
|
@ -32,8 +32,9 @@
|
|||
#define PITCH_MAX_ANGLE 34 // 云台竖直方向最大角度 (注意反馈如果是陀螺仪,则填写陀螺仪的角度)
|
||||
#define PITCH_MIN_ANGLE -15 // 云台竖直方向最小角度 (注意反馈如果是陀螺仪,则填写陀螺仪的角度)
|
||||
|
||||
#define YAW_MAX_ENCODE_ANGLE -10.0f //小yaw编码器限位
|
||||
#define YAW_MIN_ENCODE_ANGLE -90.0f
|
||||
#define YAW_MAX_ENCODE_ANGLE 340.0f //小yaw编码器限位
|
||||
#define YAW_MIN_ENCODE_ANGLE 245.0f
|
||||
|
||||
// 发射参数
|
||||
#define ONE_BULLET_DELTA_ANGLE 36 // 发射一发弹丸拨盘转动的距离,由机械设计图纸给出
|
||||
#define REDUCTION_RATIO_LOADER 49.0f // 拨盘电机的减速比,英雄需要修改为3508的19.0f
|
||||
|
|
|
@ -91,41 +91,16 @@ int aim_armor_select(Aim_Select_Type_t *aim_sel, Trajectory_Type_t *trajectory_c
|
|||
// } else label_second = 1;
|
||||
// }
|
||||
|
||||
// 选择两块较近的装甲板
|
||||
// 选择较近的装甲板
|
||||
float distance[3];
|
||||
int label = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
distance[i] = powf(aim_sel->armor_pose[i].x, 2) + powf(aim_sel->armor_pose[i].y, 2);
|
||||
if(distance[i]<distance[label])
|
||||
label = i;
|
||||
}
|
||||
|
||||
int label_first = 0;
|
||||
int label_second = 1;
|
||||
|
||||
if(distance[label_first] > distance[label_second])
|
||||
{
|
||||
label_first = 1;
|
||||
label_second = 0;
|
||||
}
|
||||
|
||||
if(distance[2]<distance[label_second])
|
||||
label_second = 2;
|
||||
|
||||
|
||||
//再选择两块装甲板与自身位置连线,同旋转中心自身位置连线,夹角较小的为目标装甲板
|
||||
float center_length = sqrtf(powf(aim_sel->target_state.x, 2) + powf(aim_sel->target_state.y, 2));
|
||||
|
||||
float cos_theta_first = (aim_sel->armor_pose[label_first].x * aim_sel->target_state.x +
|
||||
aim_sel->armor_pose[label_first].y * aim_sel->target_state.y) /
|
||||
(sqrtf(powf(aim_sel->armor_pose[label_first].x, 2) +
|
||||
powf(aim_sel->armor_pose[label_first].y, 2)) * center_length);
|
||||
float cos_theta_second = (aim_sel->armor_pose[label_second].x * aim_sel->target_state.x +
|
||||
aim_sel->armor_pose[label_second].y * aim_sel->target_state.y) /
|
||||
(sqrtf(powf(aim_sel->armor_pose[label_second].x, 2) +
|
||||
powf(aim_sel->armor_pose[label_second].y, 2)) * center_length);
|
||||
|
||||
if (cos_theta_first > cos_theta_second)
|
||||
idx = label_first;
|
||||
else
|
||||
idx = label_second;
|
||||
idx = label;
|
||||
|
||||
} else {
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
@ -270,7 +245,7 @@ void get_cmd_angle(Trajectory_Type_t *trajectory_cal) {
|
|||
}
|
||||
|
||||
int auto_aim(Aim_Select_Type_t *aim_sel, Trajectory_Type_t *trajectory_cal, RecievePacket_t *receive_packet) {
|
||||
trajectory_cal->extra_delay_time = 0.035;//0.025
|
||||
trajectory_cal->extra_delay_time = 0.1;//0.025
|
||||
|
||||
aim_sel->target_state.armor_type = receive_packet->id;
|
||||
aim_sel->target_state.armor_num = receive_packet->armors_num;
|
||||
|
|
|
@ -25,11 +25,12 @@ static DaemonInstance *vision_daemon_instance;
|
|||
// send_data.work_mode = work_mode;
|
||||
// send_data.bullet_speed = bullet_speed;
|
||||
//}
|
||||
void VisionSetFlag(Enemy_Color_e enemy_color,uint8_t game_progress,uint16_t outpost_hp)
|
||||
void VisionSetFlag(Enemy_Color_e enemy_color,uint8_t game_progress,float target_x,float target_y)
|
||||
{
|
||||
send_data.detect_color = enemy_color;
|
||||
send_data.game_progress = game_progress;
|
||||
send_data.outpost_hp = outpost_hp;
|
||||
send_data.target_x = target_x;
|
||||
send_data.target_y = target_y;
|
||||
send_data.reserved = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ void VisionSend();
|
|||
* @param bullet_speed
|
||||
*/
|
||||
//void VisionSetFlag(Enemy_Color_e enemy_color, Work_Mode_e work_mode, Bullet_Speed_e bullet_speed);
|
||||
void VisionSetFlag(Enemy_Color_e enemy_color,uint8_t game_progress,uint16_t outpost_hp);
|
||||
void VisionSetFlag(Enemy_Color_e enemy_color,uint8_t game_progress,float target_x,float target_y);
|
||||
|
||||
/**
|
||||
* @brief 设置发送数据的姿态部分
|
||||
|
|
|
@ -77,6 +77,7 @@ typedef enum {
|
|||
ID_aerial_robot_energy = 0x0205, // 空中机器人能量状态数据
|
||||
ID_robot_hurt = 0x0206, // 伤害状态数据
|
||||
ID_shoot_data = 0x0207, // 实时射击数据
|
||||
ID_projectile_allowance = 0x208, // 允许发弹量数据
|
||||
ID_sentry_info = 0x020D, // 哨兵兑换发弹量、血量信息
|
||||
ID_student_interactive = 0x0301, // 机器人间交互数据
|
||||
ID_custom_robot = 0x302, // 自定义控制器数据(图传链路)
|
||||
|
@ -99,8 +100,10 @@ typedef enum {
|
|||
LEN_aerial_robot_energy = 2, // 0x0205
|
||||
LEN_robot_hurt = 1, // 0x0206
|
||||
LEN_shoot_data = 7, // 0x0207
|
||||
LEN_projectile_allowance = 6, // 0x0208
|
||||
LEN_receive_data = 6 + Communicate_Data_LEN, // 0x0301
|
||||
LEN__custom_robot = 30, // 0x0302
|
||||
LEN_map_command = 12, //0x303
|
||||
LEN_remote_control = 12, // 0x0304
|
||||
|
||||
} JudgeDataLength_e;
|
||||
|
@ -218,12 +221,28 @@ typedef struct {
|
|||
float bullet_speed;
|
||||
} ext_shoot_data_t;
|
||||
|
||||
/* ID: 0x0208 Byte: 6 允许发弹量数据 */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t projectile_allowance_17mm;
|
||||
uint16_t projectile_allowance_42mm;
|
||||
uint16_t remaining_gold_coin;
|
||||
}projectile_allowance_t;
|
||||
|
||||
/* ID: 0x020D Byte: 4 哨兵决策数据 */
|
||||
typedef struct
|
||||
{
|
||||
uint32_t sentry_info;
|
||||
} ext_sentry_info_t;
|
||||
|
||||
/* ID: 0x0303 Byte: 12 云台手命令 */
|
||||
typedef struct
|
||||
{
|
||||
float target_position_x;
|
||||
float target_position_y;
|
||||
uint8_t cmd_keyboard;
|
||||
uint8_t target_robot_id;
|
||||
uint16_t cmd_source;
|
||||
}map_command_t;
|
||||
/****************************图传链路数据****************************/
|
||||
/* ID: 0x0304 Byte: 12 图传链路键鼠遥控数据 */
|
||||
typedef struct {
|
||||
|
|
|
@ -92,9 +92,15 @@ static void JudgeReadData(uint8_t *buff)
|
|||
case ID_shoot_data: // 0x0207
|
||||
memcpy(&referee_info.ShootData, (buff + DATA_Offset), LEN_shoot_data);
|
||||
break;
|
||||
case ID_projectile_allowance: // 0x0208
|
||||
memcpy(&referee_info.projectile_allowance, (buff + DATA_Offset), LEN_projectile_allowance);
|
||||
break;
|
||||
case ID_student_interactive: // 0x0301 syhtodo接收代码未测试
|
||||
memcpy(&referee_info.ReceiveData, (buff + DATA_Offset), LEN_receive_data);
|
||||
break;
|
||||
case ID_map_command: // 0x0303 syhtodo接收代码未测试
|
||||
memcpy(&referee_info.map_command, (buff + DATA_Offset), LEN_map_command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,9 @@ typedef struct
|
|||
aerial_robot_energy_t AerialRobotEnergy; // 0x0205
|
||||
ext_robot_hurt_t RobotHurt; // 0x0206
|
||||
ext_shoot_data_t ShootData; // 0x0207
|
||||
projectile_allowance_t projectile_allowance; // 0x0208
|
||||
|
||||
map_command_t map_command; //0x303
|
||||
// 自定义交互数据的接收
|
||||
Communicate_ReceiveData_t ReceiveData;
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* www.segger.com *
|
||||
**********************************************************************
|
||||
|
||||
File :
|
||||
Created : 27 Jan 2024 16:20
|
||||
Ozone Version : V3.30d
|
||||
File : C:/Users/sph/Desktop/sentry_left5.21/sentry_left.jdebug
|
||||
Created : 22 May 2024 17:45
|
||||
Ozone Version : V3.32a
|
||||
*/
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -22,18 +22,17 @@ void OnProjectLoad (void) {
|
|||
//
|
||||
// Dialog-generated settings
|
||||
//
|
||||
Project.AddPathSubstitute ("C:/Users/sph/Desktop/sentry_left5.21", "$(ProjectDir)");
|
||||
Project.AddPathSubstitute ("c:/users/sph/desktop/sentry_left5.21", "$(ProjectDir)");
|
||||
Project.SetDevice ("STM32F407IG");
|
||||
Project.SetHostIF ("USB", "17935099");
|
||||
Project.SetHostIF ("USB", "");
|
||||
Project.SetTargetIF ("SWD");
|
||||
Project.SetTIFSpeed ("4 MHz");
|
||||
Project.AddPathSubstitute ("D:/CLion/Project/sentry_left", "$(ProjectDir)");
|
||||
Project.AddPathSubstitute ("d:/clion/project/sentry_left", "$(ProjectDir)");
|
||||
Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M4F.svd");
|
||||
Project.AddSvdFile ("$(InstallDir)/Config/Peripherals/STM32F407IG.svd");
|
||||
Project.AddSvdFile ("C:/SEGGER/Ozone/Config/Peripherals/STM32F407IG.svd");
|
||||
//
|
||||
// User settings
|
||||
//
|
||||
Edit.SysVar (VAR_HSS_SPEED, FREQ_200_HZ);
|
||||
File.Open ("$(ProjectDir)/cmake-build-debug/sentry_left.elf");
|
||||
Project.SetOSPlugin ("FreeRTOSPlugin_CM4");
|
||||
}
|
||||
|
|
|
@ -1,30 +1,19 @@
|
|||
|
||||
|
||||
|
||||
OpenDocument="main.c", FilePath="C:/Users/sph/Desktop/sentry_left/Src/main.c", Line=59
|
||||
OpenDocument="robot_cmd.c", FilePath="C:/Users/sph/Desktop/sentry_left/application/cmd/robot_cmd.c", Line=69
|
||||
OpenDocument="dji_motor.c", FilePath="C:/Users/sph/Desktop/sentry_left/modules/motor/DJImotor/dji_motor.c", Line=68
|
||||
OpenDocument="bsp_dwt.c", FilePath="C:/Users/sph/Desktop/sentry_left/bsp/dwt/bsp_dwt.c", Line=30
|
||||
OpenDocument="gimbal.c", FilePath="C:/Users/sph/Desktop/sentry_left/application/gimbal/gimbal.c", Line=87
|
||||
OpenDocument="robot_def.h", FilePath="C:/Users/sph/Desktop/sentry_left/application/robot_def.h", Line=151
|
||||
OpenDocument="main.c", FilePath="C:/Users/sph/Desktop/sentry_left5.21/Src/main.c", Line=0
|
||||
OpenToolbar="Debug", Floating=0, x=0, y=0
|
||||
OpenWindow="Source Files", DockArea=LEFT, x=0, y=0, w=555, h=334, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Break & Tracepoints", DockArea=LEFT, x=0, y=1, w=555, h=302, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VectorCatchIndexMask=254
|
||||
OpenWindow="Memory 1", DockArea=BOTTOM, x=1, y=0, w=485, h=170, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, EditorAddress=0x20008C00
|
||||
OpenWindow="Local Data", DockArea=LEFT, x=0, y=2, w=555, h=401, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Data Sampling", DockArea=RIGHT, x=0, y=1, w=591, h=173, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VisibleTab=0, UniformSampleSpacing=0
|
||||
OpenWindow="Timeline", DockArea=RIGHT, x=0, y=0, w=591, h=184, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=0, CodePaneShown=0, PinCursor="Cursor Movable", TimePerDiv="5 s / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="0;0", DataGraphShowNamesAtCursor=0, PowerGraphDrawAsPoints=0, PowerGraphLegendShown=0, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="577;-69", CodeGraphLegendShown=0, CodeGraphLegendPosition="593;0"
|
||||
OpenWindow="Console", DockArea=BOTTOM, x=0, y=0, w=477, h=170, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Source Files", DockArea=LEFT, x=0, y=1, w=482, h=881, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Break & Tracepoints", DockArea=LEFT, x=0, y=0, w=482, h=185, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VectorCatchIndexMask=254
|
||||
OpenWindow="Memory 1", DockArea=BOTTOM, x=1, y=0, w=135, h=170, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, EditorAddress=0x20008C00
|
||||
OpenWindow="Data Sampling", DockArea=RIGHT, x=0, y=1, w=591, h=153, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VisibleTab=0, UniformSampleSpacing=0
|
||||
OpenWindow="Timeline", DockArea=RIGHT, x=0, y=0, w=591, h=913, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=1, CodePaneShown=1, PinCursor="Cursor Movable", TimePerDiv="1 ns / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="364;0", DataGraphShowNamesAtCursor=0, PowerGraphDrawAsPoints=0, PowerGraphLegendShown=1, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="364;-69", CodeGraphLegendShown=1, CodeGraphLegendPosition="380;0"
|
||||
OpenWindow="Console", DockArea=BOTTOM, x=0, y=0, w=2318, h=170, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
SmartViewPlugin="", Page="", Toolbar="Hidden", Window="SmartView 1"
|
||||
TableHeader="Vector Catches", SortCol="", SortOrder="ASCENDING", VisibleCols=["";"Vector Catch";"Description"], ColWidths=[50;300;500]
|
||||
TableHeader="Break & Tracepoints", SortCol="", SortOrder="ASCENDING", VisibleCols=["";"Type";"Location";"Extras"], ColWidths=[100;100;102;253]
|
||||
TableHeader="Local Data", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Location";"Size";"Type";"Scope"], ColWidths=[100;100;102;100;100;100]
|
||||
TableHeader="Break & Tracepoints", SortCol="", SortOrder="ASCENDING", VisibleCols=["";"Type";"Location";"Extras"], ColWidths=[100;100;102;180]
|
||||
TableHeader="Source Files", SortCol="File", SortOrder="ASCENDING", VisibleCols=["File";"Status";"Size";"#Insts";"Path"], ColWidths=[263;100;100;100;894]
|
||||
TableHeader="Data Sampling Table", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time"], ColWidths=[100;100]
|
||||
TableHeader="Data Sampling Setup", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Type";"Value";"Min";"Max";"Average";"# Changes";"Min. Change";"Max. Change"], ColWidths=[438;144;100;100;100;100;110;126;126]
|
||||
TableHeader="Power Sampling", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time";"Ch 0"], ColWidths=[100;100;100]
|
||||
TableHeader="Task List", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Name";"Run Count";"Priority";"Status";"Timeout";"Stack Info";"ID";"Mutex Count";"Notified Value";"Notify State"], ColWidths=[110;110;110;110;110;110;110;110;110;110]
|
||||
TableHeader="RegisterSelectionDialog", SortCol="None", SortOrder="ASCENDING", VisibleCols=[], ColWidths=[]
|
||||
TableHeader="TargetExceptionDialog", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Address";"Description"], ColWidths=[200;100;100;340]
|
||||
TableHeader="Data Sampling Table", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time"], ColWidths=[100;704]
|
||||
TableHeader="Data Sampling Setup", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Type";"Value";"Min";"Max";"Average";"# Changes";"Min. Change";"Max. Change"], ColWidths=[438;100;100;100;100;100;110;126;126]
|
||||
TableHeader="Source Files", SortCol="File", SortOrder="ASCENDING", VisibleCols=["File";"Status";"Size";"#Insts";"Path"], ColWidths=[263;100;100;100;878]
|
||||
WatchedExpression="chassis_cmd_recv", RefreshRate=2, DisplayFormat=DISPLAY_FORMAT_HEX, Window=Watched Data 1
|
||||
WatchedExpression="pitch_motor", RefreshRate=2, Window=Watched Data 1
|
||||
TableHeader="RegisterSelectionDialog", SortCol="None", SortOrder="ASCENDING", VisibleCols=[], ColWidths=[]
|
Loading…
Reference in New Issue