6020pitch driver

This commit is contained in:
Zorua
2026-03-17 19:44:51 +08:00
parent 4ac9cba1d7
commit caec6bb497
6 changed files with 32 additions and 34 deletions

View File

@@ -66,24 +66,20 @@ void GimbalInit()
Motor_Init_Config_s pitch_config = {
.can_init_config = {
.can_handle = &hcan2,
.tx_id = 4,//2
.tx_id = 2,//2
},
.controller_param_init_config = {
.angle_PID = {
.Kp = 10, // 10
.Kp = 40, // 10
.Ki = 0,
.Kd = 0,
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
.IntegralLimit = 100,
.MaxOut = 500,
.MaxOut = 1000,
},
.speed_PID = {
.Kp = 50, // 50
.Ki = 350, // 350
.Kd = 0, // 0
.Improve = PID_Trapezoid_Intergral | PID_Integral_Limit | PID_Derivative_On_Measurement,
.IntegralLimit = 2500,
.MaxOut = 8000,//20000
.Kp = 80, // 50
.Ki = 15, // 350
.Kd = 0.6, // 0
.MaxOut = 30000,//20000
},
.other_angle_feedback_ptr = &gimba_IMU_data->Pitch,
// 还需要增加角速度额外反馈指针,注意方向,ins_task.md中有c板的bodyframe坐标系说明
@@ -94,9 +90,11 @@ void GimbalInit()
.speed_feedback_source = OTHER_FEED,
.outer_loop_type = ANGLE_LOOP,
.close_loop_type = SPEED_LOOP | ANGLE_LOOP,
// .outer_loop_type = SPEED_LOOP,//调试用
// .close_loop_type = SPEED_LOOP,
.motor_reverse_flag = MOTOR_DIRECTION_NORMAL,
},
.motor_type = DM4310,
.motor_type = GM6020,
};
// 电机对total_angle闭环,上电时为零,会保持静止,收到遥控器数据再动
yaw_motor = DJIMotorInit(&yaw_config);