This commit is contained in:
fcl
2026-04-11 17:08:56 +08:00
parent a4b8d0db84
commit e17504c024
3 changed files with 12 additions and 12 deletions

View File

@@ -15,7 +15,7 @@ static Subscriber_t *gimbal_sub; // cmd控制消息订阅者
static Gimbal_Upload_Data_s gimbal_feedback_data; // 回传给cmd的云台状态信息
static Gimbal_Ctrl_Cmd_s gimbal_cmd_recv; // 来自cmd的控制信息
static float last_yaw_angle = 0.0f; // 保护模式前的yaw角度
static float last_pitch_angle = 0.0f; // 保护模式前的pitch角度
// static float last_pitch_angle = 0.0f; // 保护模式前的pitch角度
uint8_t in_protection_mode = 0; // 是否在保护模式
void GimbalInit()
{
@@ -85,9 +85,9 @@ void GimbalInit()
// },
.controller_param_init_config = {
.angle_PID = {
.Kp = 1, //0.90
.Kp = 0.75, //0.55
.Ki = 0.05,//0.05
.Kd = 0.03,//0.02
.Kd = 0.02,//0.02
.CoefA =0.5,//0.5
.CoefB = 0.6,//0.6
.Output_LPF_RC = 0.01,
@@ -98,8 +98,8 @@ void GimbalInit()
.MaxOut = 600,
},
.speed_PID = {
.Kp = 800,//22000
.Ki = 0.05,//
.Kp = 500,//22000
.Ki = 0,//
.Kd =0.0005,
// .CoefA = 0.8,
// .CoefB = 0.1,
@@ -148,7 +148,7 @@ void GimbalTask()
// 进入保护模式时记录当前角度
if (!in_protection_mode) {
last_yaw_angle = gimba_IMU_data->YawTotalAngle;
last_pitch_angle = gimba_IMU_data->Pitch;
// last_pitch_angle = gimba_IMU_data->Pitch;
in_protection_mode = 1;
}
DJIMotorStop(yaw_motor);