This commit is contained in:
guoxy06
2026-04-04 12:00:10 +08:00
parent c471f1b196
commit 0029810204
4 changed files with 34 additions and 33 deletions

View File

@@ -412,11 +412,11 @@ void ChassisTask()
{ {
single_round_offset += 360.0f; single_round_offset += 360.0f;
} }
chassis_cmd_recv.wz = PIDCalculate(&chassis_follow_pid, single_round_offset, 0)/100; chassis_cmd_recv.wz = PIDCalculate(&chassis_follow_pid, single_round_offset, 0)/90;
// chassis_cmd_recv.wz = PIDCalculate(&chassis_follow_pid, chassis_cmd_recv.offset_angle, 0)/100; // chassis_cmd_recv.wz = PIDCalculate(&chassis_follow_pid, chassis_cmd_recv.offset_angle, 0)/100;
break; break;
case CHASSIS_ROTATE: // 自旋,同时保持全向机动;当前wz维持定值,后续增加不规则的变速策略 case CHASSIS_ROTATE: // 自旋,同时保持全向机动;当前wz维持定值,后续增加不规则的变速策略。
chassis_cmd_recv.wz = 0.5; chassis_cmd_recv.wz = 0.75;
break; break;
default: default:
break; break;

View File

@@ -246,7 +246,7 @@ static void RemoteControlSet()
static void MouseKeySet() static void MouseKeySet()
{ {
// // G键控制机器人等级,每次按G键等级+1,最高10级 // // G键控制机器人等级,每次按G键等级+1,最高10级/
// if (rc_data[TEMP].key[KEY_PRESS].g && rc_data[TEMP].key_count[KEY_PRESS][Key_G] > 0) { // if (rc_data[TEMP].key[KEY_PRESS].g && rc_data[TEMP].key_count[KEY_PRESS][Key_G] > 0) {
// robot_level = (robot_level % 10) + 1; // 等级循环增加,1-10 // robot_level = (robot_level % 10) + 1; // 等级循环增加,1-10
// } // }
@@ -264,27 +264,28 @@ static void MouseKeySet()
// 将robot_level传递给底盘控制命令 // 将robot_level传递给底盘控制命令
chassis_cmd_send.robot_level = robot_level; chassis_cmd_send.robot_level = robot_level;
chassis_cmd_send.vx = rc_data[TEMP].key[KEY_PRESS].a * 42 - rc_data[TEMP].key[KEY_PRESS].d * 42; // w向前,s向后
switch (robot_level) chassis_cmd_send.vy = rc_data[TEMP].key[KEY_PRESS].w * 42 - rc_data[TEMP].key[KEY_PRESS].s * 42; // a向左,d向右
{ // switch (robot_level)
case 1: // {
case 2: // case 1:
case 3: // case 2:
chassis_cmd_send.vx = (rc_data[TEMP].key[KEY_PRESS].a * 20 - rc_data[TEMP].key[KEY_PRESS].d * 20); // w向前,s向后 // case 3:
chassis_cmd_send.vy = (rc_data[TEMP].key[KEY_PRESS].w * 20 - rc_data[TEMP].key[KEY_PRESS].s * 20); // a向左,d向右 // chassis_cmd_send.vx = (rc_data[TEMP].key[KEY_PRESS].a * 20 - rc_data[TEMP].key[KEY_PRESS].d * 20); // w向前,s向后
break; // chassis_cmd_send.vy = (rc_data[TEMP].key[KEY_PRESS].w * 20 - rc_data[TEMP].key[KEY_PRESS].s * 20); // a向左,d向右
case 4: // break;
case 5: // case 4:
case 6: // case 5:
case 7: // case 6:
chassis_cmd_send.vx = (rc_data[TEMP].key[KEY_PRESS].a * 30 - rc_data[TEMP].key[KEY_PRESS].d * 30); // w向前,s向后 // case 7:
chassis_cmd_send.vy = (rc_data[TEMP].key[KEY_PRESS].w * 30 - rc_data[TEMP].key[KEY_PRESS].s * 30); // a向左,d向右 // chassis_cmd_send.vx = (rc_data[TEMP].key[KEY_PRESS].a * 30 - rc_data[TEMP].key[KEY_PRESS].d * 30); // w向前,s向后
break; // chassis_cmd_send.vy = (rc_data[TEMP].key[KEY_PRESS].w * 30 - rc_data[TEMP].key[KEY_PRESS].s * 30); // a向左,d向右
default: // break;
chassis_cmd_send.vx = (rc_data[TEMP].key[KEY_PRESS].a * 40 - rc_data[TEMP].key[KEY_PRESS].d * 40); // w向前,s向后 // default:
chassis_cmd_send.vy = (rc_data[TEMP].key[KEY_PRESS].w * 40 - rc_data[TEMP].key[KEY_PRESS].s * 40); // a向左,d向右 // chassis_cmd_send.vx = (rc_data[TEMP].key[KEY_PRESS].a * 40 - rc_data[TEMP].key[KEY_PRESS].d * 40); // w向前,s向后
break; // chassis_cmd_send.vy = (rc_data[TEMP].key[KEY_PRESS].w * 40 - rc_data[TEMP].key[KEY_PRESS].s * 40); // a向左,d向右
} // break;
// }
// 根据等级设置底盘速度 // 根据等级设置底盘速度
// if (robot_level >= 1 && robot_level <= 3) { // if (robot_level >= 1 && robot_level <= 3) {
// chassis_cmd_send.vx = (rc_data[TEMP].key[KEY_PRESS].a * 20 - rc_data[TEMP].key[KEY_PRESS].d * 20); // w向前,s向后 // chassis_cmd_send.vx = (rc_data[TEMP].key[KEY_PRESS].a * 20 - rc_data[TEMP].key[KEY_PRESS].d * 20); // w向前,s向后
@@ -357,7 +358,7 @@ static void MouseKeySet()
// break; // break;
// } // }
if (rc_data[TEMP].mouse.press_l) { if (rc_data[TEMP].mouse.press_l) {
shoot_cmd_send.load_mode = LOAD_1_BULLET; // 左键单发 shoot_cmd_send.load_mode = LOAD_BURSTFIRE; // 左键单发
} else if (rc_data[TEMP].mouse.press_r) { } else if (rc_data[TEMP].mouse.press_r) {
shoot_cmd_send.load_mode = LOAD_3_BULLET; // 右键三连发 shoot_cmd_send.load_mode = LOAD_3_BULLET; // 右键三连发
} else { } else {

View File

@@ -85,9 +85,9 @@ void GimbalInit()
// }, // },
.controller_param_init_config = { .controller_param_init_config = {
.angle_PID = { .angle_PID = {
.Kp = 1.00, //0.90 .Kp = 1, //0.90
.Ki = 0.05,//0.05 .Ki = 0.05,//0.05
.Kd = 0.02,//0.02 .Kd = 0.03,//0.02
.CoefA =0.5,//0.5 .CoefA =0.5,//0.5
.CoefB = 0.6,//0.6 .CoefB = 0.6,//0.6
.Output_LPF_RC = 0.01, .Output_LPF_RC = 0.01,
@@ -98,8 +98,8 @@ void GimbalInit()
.MaxOut = 600, .MaxOut = 600,
}, },
.speed_PID = { .speed_PID = {
.Kp = 500,//22000 .Kp = 800,//22000
.Ki = 0,// .Ki = 0.05,//
.Kd =0.0005, .Kd =0.0005,
// .CoefA = 0.8, // .CoefA = 0.8,
// .CoefB = 0.1, // .CoefB = 0.1,

View File

@@ -66,15 +66,15 @@ void MyUIInit()
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 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[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[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[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, 860, 475, 1060, 475); UILineDraw(&UI_shoot_line[3], "sl3", UI_Graph_ADD, 7, UI_Color_Yellow, 2, 860, 475, 1060, 475);
UILineDraw(&UI_shoot_line[4], "sl4", UI_Graph_ADD, 7, UI_Color_Yellow, 2, 810, shoot_line_location[4], 1110, shoot_line_location[4]); //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]); 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]);
// 绘制车辆状态标志指示 // 绘制车辆状态标志指示