小陀螺后的功率控制

This commit is contained in:
userName 2024-03-03 15:52:51 +08:00
parent 03081a7075
commit e4b8e54574
2 changed files with 10 additions and 6 deletions

View File

@ -66,9 +66,9 @@ void ChassisInit()
.can_init_config.can_handle = &hcan1,
.controller_param_init_config = {
.speed_PID = {
.Kp = 17, // 4.5
.Ki = 3, // 0
.Kd = 0.02f, // 0
.Kp = 17, // 17
.Ki = 3, // 3
.Kd = 0.02f, // 0.02
.IntegralLimit = 3000,
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
.MaxOut = 12000,
@ -87,7 +87,7 @@ void ChassisInit()
.speed_feedback_source = MOTOR_FEED,
.outer_loop_type = SPEED_LOOP,
.close_loop_type = SPEED_LOOP | CURRENT_LOOP,
//功率限制必须要用电流环
.power_limit_flag = NO_POWER_LIMIT,
},
.motor_type = M3508,
@ -255,6 +255,10 @@ void ChassisTask()
break;
case CHASSIS_FOLLOW_GIMBAL_YAW: // 跟随云台,不单独设置pid,以误差角度平方为速度输出
chassis_cmd_recv.wz = 2.0f * chassis_cmd_recv.offset_angle * abs(chassis_cmd_recv.offset_angle);
if(chassis_cmd_recv.wz > 2000)
chassis_cmd_recv.wz = 2000;
if(chassis_cmd_recv.wz < -2000)
chassis_cmd_recv.wz = -2000;
break;
case CHASSIS_ROTATE: // 自旋,同时保持全向机动;当前wz维持定值,后续增加不规则的变速策略
chassis_cmd_recv.wz = 1600;

View File

@ -64,7 +64,7 @@ void ShootInit()
friction_r = DJIMotorInit(&friction_config);
friction_config.can_init_config.tx_id = 6; // 上摩擦轮,改txid和方向就行
friction_config.controller_setting_init_config.motor_reverse_flag = MOTOR_DIRECTION_REVERSE;
friction_config.controller_setting_init_config.motor_reverse_flag = MOTOR_DIRECTION_NORMAL;
friction_z = DJIMotorInit(&friction_config);
@ -83,7 +83,7 @@ void ShootInit()
.MaxOut = 15000,
},
.speed_PID = {
.Kp = 3, // 10
.Kp = 5, // 10
.Ki = 0, // 1
.Kd = 0,
.Improve = PID_Integral_Limit,