fricok butcant stop instantly.loader failure

This commit is contained in:
fcl
2026-03-19 18:27:03 +08:00
parent d0faf90d5e
commit ab0f770723
2 changed files with 24 additions and 19 deletions

View File

@@ -373,15 +373,20 @@ void RobotCMDTask() {
// 根据遥控器左侧开关,确定当前使用的控制模式为遥控器调试还是键鼠 // 根据遥控器左侧开关,确定当前使用的控制模式为遥控器调试还是键鼠
if (switch_is_down(rc_data[TEMP].rc.switch_left)){ // 遥控器左侧开关状态为[下],遥控器控制 if (switch_is_down(rc_data[TEMP].rc.switch_left)){ // 遥控器左侧开关状态为[下],遥控器控制
RemoteControlSet(); 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)) { else if (switch_is_up(rc_data[TEMP].rc.switch_left)) {
// 遥控器左侧开关状态为[上],键盘控制 // 遥控器左侧开关状态为[上],键盘控制
MouseKeySet(); MouseKeySet();
shoot_cmd_send.shoot_mode =SHOOT_OFF; 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.shoot_mode =SHOOT_ON;
shoot_cmd_send.bullet_speed = 30;
shoot_cmd_send.friction_mode = FRICTION_ON;
} }
EmergencyHandler(); // 处理模块离线和遥控器急停等紧急情况 EmergencyHandler(); // 处理模块离线和遥控器急停等紧急情况

View File

@@ -28,15 +28,15 @@ void ShootInit()
.controller_param_init_config = { .controller_param_init_config = {
.speed_PID = { .speed_PID = {
.Kp = 20, // 20 .Kp = 20, // 20
.Ki = 0, // 1 .Ki = 1, // 1
.Kd = 0, .Kd = 0,
.Improve = PID_Integral_Limit, .Improve = PID_Integral_Limit,
.IntegralLimit = 10000, .IntegralLimit = 10000,
.MaxOut = 15000, .MaxOut = 15000,
}, },
.current_PID = { .current_PID = {
.Kp = 0, // 0.7 .Kp = 0.7, // 0.7
.Ki = 0, // 0.1 .Ki = 0.1, // 0.1
.Kd = 0, .Kd = 0,
.Improve = PID_Integral_Limit, .Improve = PID_Integral_Limit,
.IntegralLimit = 10000, .IntegralLimit = 10000,
@@ -52,13 +52,13 @@ void ShootInit()
.motor_reverse_flag = MOTOR_DIRECTION_NORMAL, .motor_reverse_flag = MOTOR_DIRECTION_NORMAL,
}, },
.motor_type = M3508}; .motor_type = M3508};
friction_config.can_init_config.tx_id = 8, friction_config.can_init_config.tx_id = 5,
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_r = DJIMotorInit(&friction_config); 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 = { Motor_Init_Config_s loader_config = {
.can_init_config = { .can_init_config = {
@@ -74,8 +74,8 @@ void ShootInit()
.MaxOut = 200, .MaxOut = 200,
}, },
.speed_PID = { .speed_PID = {
.Kp = 0, // 10 .Kp = 10, // 10
.Ki = 0, // 1 .Ki = 1, // 1
.Kd = 0, .Kd = 0,
.Improve = PID_Integral_Limit, .Improve = PID_Integral_Limit,
.IntegralLimit = 5000, .IntegralLimit = 5000,
@@ -175,16 +175,16 @@ void ShootTask()
switch (shoot_cmd_recv.bullet_speed) switch (shoot_cmd_recv.bullet_speed)
{ {
case SMALL_AMU_15: case SMALL_AMU_15:
DJIMotorSetRef(friction_l, 0); DJIMotorSetRef(friction_l, 30000);
DJIMotorSetRef(friction_r, 0); DJIMotorSetRef(friction_r, 30000);
break; break;
case SMALL_AMU_18: case SMALL_AMU_18:
DJIMotorSetRef(friction_l, 0); DJIMotorSetRef(friction_l, 30000);
DJIMotorSetRef(friction_r, 0); DJIMotorSetRef(friction_r, 30000);
break; break;
case SMALL_AMU_30: case SMALL_AMU_30:
DJIMotorSetRef(friction_l, 0); DJIMotorSetRef(friction_l, 50000);
DJIMotorSetRef(friction_r, 0); DJIMotorSetRef(friction_r, 50000);
break; break;
default: // 当前为了调试设定的默认值4000,因为还没有加入裁判系统无法读取弹速. default: // 当前为了调试设定的默认值4000,因为还没有加入裁判系统无法读取弹速.
DJIMotorSetRef(friction_l, 30000); DJIMotorSetRef(friction_l, 30000);