Arducopter: Add independent rate roll and pitch P, I, D tuning options. Add rate feedforward tuning options for tradheli.

This commit is contained in:
Robert Lefebvre 2014-05-10 08:22:06 -04:00 committed by Randy Mackay
parent fa9d625e39
commit 1f422c86c1
2 changed files with 45 additions and 0 deletions

View File

@ -1507,6 +1507,18 @@ static void tuning(){
case CH6_HELI_EXTERNAL_GYRO: case CH6_HELI_EXTERNAL_GYRO:
motors.ext_gyro_gain(g.rc_6.control_in); motors.ext_gyro_gain(g.rc_6.control_in);
break; break;
case CH6_RATE_PITCH_FF:
g.pid_rate_pitch.ff(tuning_value);
break;
case CH6_RATE_ROLL_FF:
g.pid_rate_roll.ff(tuning_value);
break;
case CH6_RATE_YAW_FF:
g.pid_rate_yaw.ff(tuning_value);
break;
#endif #endif
case CH6_OPTFLOW_KP: case CH6_OPTFLOW_KP:
@ -1575,6 +1587,30 @@ static void tuning(){
// roll-pitch input smoothing // roll-pitch input smoothing
g.rc_feel_rp = g.rc_6.control_in / 10; g.rc_feel_rp = g.rc_6.control_in / 10;
break; break;
case CH6_RATE_PITCH_KP:
g.pid_rate_pitch.kP(tuning_value);
break;
case CH6_RATE_PITCH_KI:
g.pid_rate_pitch.kI(tuning_value);
break;
case CH6_RATE_PITCH_KD:
g.pid_rate_pitch.kD(tuning_value);
break;
case CH6_RATE_ROLL_KP:
g.pid_rate_roll.kP(tuning_value);
break;
case CH6_RATE_ROLL_KI:
g.pid_rate_roll.kI(tuning_value);
break;
case CH6_RATE_ROLL_KD:
g.pid_rate_roll.kD(tuning_value);
break;
} }
} }

View File

@ -144,6 +144,15 @@
#define CH6_EKF_HORIZONTAL_POS 43 // EKF's gps vs accel (higher rely on accels more, gps impact is reduced). Range should be 1.0 ~ 3.0? 1.5 is default #define CH6_EKF_HORIZONTAL_POS 43 // EKF's gps vs accel (higher rely on accels more, gps impact is reduced). Range should be 1.0 ~ 3.0? 1.5 is default
#define CH6_EKF_ACCEL_NOISE 44 // EKF's accel noise (lower means trust accels more, gps & baro less). Range should be 0.02 ~ 0.5 0.5 is default (but very robust at that level) #define CH6_EKF_ACCEL_NOISE 44 // EKF's accel noise (lower means trust accels more, gps & baro less). Range should be 0.02 ~ 0.5 0.5 is default (but very robust at that level)
#define CH6_RC_FEEL_RP 45 // roll-pitch input smoothing #define CH6_RC_FEEL_RP 45 // roll-pitch input smoothing
#define CH6_RATE_PITCH_KP 46 // body frame pitch rate controller's P term
#define CH6_RATE_PITCH_KI 47 // body frame pitch rate controller's I term
#define CH6_RATE_PITCH_KD 48 // body frame pitch rate controller's D term
#define CH6_RATE_ROLL_KP 49 // body frame roll rate controller's P term
#define CH6_RATE_ROLL_KI 50 // body frame roll rate controller's I term
#define CH6_RATE_ROLL_KD 51 // body frame roll rate controller's D term
#define CH6_RATE_PITCH_FF 52 // body frame pitch rate controller FF term
#define CH6_RATE_ROLL_FF 53 // body frame roll rate controller FF term
#define CH6_RATE_YAW_FF 54 // body frame yaw rate controller FF term
// Acro Trainer types // Acro Trainer types
#define ACRO_TRAINER_DISABLED 0 #define ACRO_TRAINER_DISABLED 0