From ab0f770723bbc4a49d4b026f99918d1abfc7fbac Mon Sep 17 00:00:00 2001 From: fcl <2136892861@qq.com> Date: Thu, 19 Mar 2026 18:27:03 +0800 Subject: [PATCH] fricok butcant stop instantly.loader failure --- application/cmd/robot_cmd.c | 11 ++++++++--- application/shoot/shoot.c | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/application/cmd/robot_cmd.c b/application/cmd/robot_cmd.c index 94e1188..9d3f418 100644 --- a/application/cmd/robot_cmd.c +++ b/application/cmd/robot_cmd.c @@ -373,15 +373,20 @@ void RobotCMDTask() { // 根据遥控器左侧开关,确定当前使用的控制模式为遥控器调试还是键鼠 if (switch_is_down(rc_data[TEMP].rc.switch_left)){ // 遥控器左侧开关状态为[下],遥控器控制 RemoteControlSet(); - shoot_cmd_send.shoot_mode =SHOOT_OFF; -} + shoot_cmd_send.shoot_mode =SHOOT_OFF; + shoot_cmd_send.friction_mode = FRICTION_OFF; + } else if (switch_is_up(rc_data[TEMP].rc.switch_left)) { // 遥控器左侧开关状态为[上],键盘控制 MouseKeySet(); shoot_cmd_send.shoot_mode =SHOOT_OFF; } - else if (switch_is_mid( rc_data[TEMP].rc.switch_left)) { + else if (switch_is_mid(rc_data[TEMP].rc.switch_left)) { + // 遥控器左侧开关状态为[中],视觉模式,使用遥控器控制底盘和云台,同时开启发射系统 + RemoteControlSet(); shoot_cmd_send.shoot_mode =SHOOT_ON; + shoot_cmd_send.bullet_speed = 30; + shoot_cmd_send.friction_mode = FRICTION_ON; } EmergencyHandler(); // 处理模块离线和遥控器急停等紧急情况 diff --git a/application/shoot/shoot.c b/application/shoot/shoot.c index cf52c92..33d8f8e 100644 --- a/application/shoot/shoot.c +++ b/application/shoot/shoot.c @@ -28,15 +28,15 @@ void ShootInit() .controller_param_init_config = { .speed_PID = { .Kp = 20, // 20 - .Ki = 0, // 1 + .Ki = 1, // 1 .Kd = 0, .Improve = PID_Integral_Limit, .IntegralLimit = 10000, .MaxOut = 15000, }, .current_PID = { - .Kp = 0, // 0.7 - .Ki = 0, // 0.1 + .Kp = 0.7, // 0.7 + .Ki = 0.1, // 0.1 .Kd = 0, .Improve = PID_Integral_Limit, .IntegralLimit = 10000, @@ -52,13 +52,13 @@ void ShootInit() .motor_reverse_flag = MOTOR_DIRECTION_NORMAL, }, .motor_type = M3508}; - friction_config.can_init_config.tx_id = 8, - friction_l = DJIMotorInit(&friction_config); - - friction_config.can_init_config.tx_id = 5; // 右摩擦轮,改txid和方向就行 - friction_config.controller_setting_init_config.motor_reverse_flag = MOTOR_DIRECTION_REVERSE; + friction_config.can_init_config.tx_id = 5, friction_r = DJIMotorInit(&friction_config); + friction_config.can_init_config.tx_id = 8; // 左摩擦轮,改txid和方向就行 + friction_config.controller_setting_init_config.motor_reverse_flag = MOTOR_DIRECTION_REVERSE; + friction_l = DJIMotorInit(&friction_config); + // 拨盘电机 Motor_Init_Config_s loader_config = { .can_init_config = { @@ -74,8 +74,8 @@ void ShootInit() .MaxOut = 200, }, .speed_PID = { - .Kp = 0, // 10 - .Ki = 0, // 1 + .Kp = 10, // 10 + .Ki = 1, // 1 .Kd = 0, .Improve = PID_Integral_Limit, .IntegralLimit = 5000, @@ -175,16 +175,16 @@ void ShootTask() switch (shoot_cmd_recv.bullet_speed) { case SMALL_AMU_15: - DJIMotorSetRef(friction_l, 0); - DJIMotorSetRef(friction_r, 0); + DJIMotorSetRef(friction_l, 30000); + DJIMotorSetRef(friction_r, 30000); break; case SMALL_AMU_18: - DJIMotorSetRef(friction_l, 0); - DJIMotorSetRef(friction_r, 0); + DJIMotorSetRef(friction_l, 30000); + DJIMotorSetRef(friction_r, 30000); break; case SMALL_AMU_30: - DJIMotorSetRef(friction_l, 0); - DJIMotorSetRef(friction_r, 0); + DJIMotorSetRef(friction_l, 50000); + DJIMotorSetRef(friction_r, 50000); break; default: // 当前为了调试设定的默认值4000,因为还没有加入裁判系统无法读取弹速. DJIMotorSetRef(friction_l, 30000);