fricok butcant stop instantly.loader failure

This commit is contained in:
fcl
2026-03-19 18:27:03 +08:00
committed by guoxy06
parent a61ed6ff25
commit 43b724d7b7
2 changed files with 24 additions and 19 deletions

View File

@@ -374,6 +374,7 @@ void RobotCMDTask() {
if (switch_is_down(rc_data[TEMP].rc.switch_left)){ // 遥控器左侧开关状态为[下],遥控器控制
RemoteControlSet();
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)) {
// 遥控器左侧开关状态为[上],键盘控制
@@ -381,7 +382,11 @@ void RobotCMDTask() {
shoot_cmd_send.shoot_mode =SHOOT_OFF;
}
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(); // 处理模块离线和遥控器急停等紧急情况

View File

@@ -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);