#define CH6_DECLINATION 38 // compass declination in radians
#define CH6_CIRCLE_RATE 39 // circle turn rate in degrees (hard coded to about 45 degrees in either direction)
#define CH6_SONAR_GAIN 41 // sonar gain
#define CH6_EKF_VERTICAL_POS 42 // EKF's baro vs accel (higher rely on accels more, baro impact is reduced). Range should be 0.2 ~ 4.0? 2.0 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)
TUNING_STABILIZE_ROLL_PITCH_KP,// 1, stabilize roll/pitch angle controller's P term
TUNING_STABILIZE_YAW_KP=3,// 3, stabilize yaw heading controller's P term
TUNING_RATE_ROLL_PITCH_KP,// 4, body frame roll/pitch rate controller's P term
TUNING_RATE_ROLL_PITCH_KI,// 5, body frame roll/pitch rate controller's I term
TUNING_YAW_RATE_KP,// 6, body frame yaw rate controller's P term
TUNING_THROTTLE_RATE_KP,// 7, throttle rate controller's P term (desired rate to acceleration or motor output)
TUNING_WP_SPEED=10,// 10, maximum speed to next way point (0 to 10m/s)
TUNING_LOITER_POSITION_KP=12,// 12, loiter distance controller's P term (position error to speed)
TUNING_HELI_EXTERNAL_GYRO,// 13, TradHeli specific external tail gyro gain
TUNING_ALTITUDE_HOLD_KP,// 14, altitude hold controller's P term (alt error to desired rate)
TUNING_RATE_ROLL_PITCH_KD=21,// 21, body frame roll/pitch rate controller's D term
TUNING_VEL_XY_KP,// 22, loiter rate controller's P term (speed error to tilt angle)
TUNING_ACRO_RP_KP=25,// 25, acro controller's P term. converts pilot input to a desired roll, pitch or yaw rate
TUNING_YAW_RATE_KD,// 26, body frame yaw rate controller's D term
TUNING_VEL_XY_KI=28,// 28, loiter rate controller's I term (speed error to tilt angle)
TUNING_AHRS_YAW_KP=30,// 30, ahrs's compass effect on yaw angle (0 = very low, 1 = very high)
TUNING_AHRS_KP,// 31, accelerometer effect on roll/pitch angle (0=low)
TUNING_ACCEL_Z_KP=34,// 34, accel based throttle controller's P term
TUNING_ACCEL_Z_KI,// 35, accel based throttle controller's I term
TUNING_ACCEL_Z_KD,// 36, accel based throttle controller's D term
TUNING_DECLINATION=38,// 38, compass declination in radians
TUNING_CIRCLE_RATE,// 39, circle turn rate in degrees (hard coded to about 45 degrees in either direction)
TUNING_ACRO_YAW_KP,// 40, acro controller's P term. converts pilot input to a desired roll, pitch or yaw rate
TUNING_SONAR_GAIN,// 41, sonar gain
TUNING_EKF_VERTICAL_POS,// 42, EKF's baro vs accel (higher rely on accels more, baro impact is reduced). Range should be 0.2 ~ 4.0? 2.0 is default
TUNING_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
TUNING_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)
// set waypoint navigation horizontal speed to 0 ~ 1000 cm/s
wp_nav.set_speed_xy(g.rc_6.control_in);
break;
// Acro roll pitch gain
case CH6_ACRO_RP_KP:
case TUNING_ACRO_RP_KP:
g.acro_rp_p = tuning_value;
break;
// Acro yaw gain
case CH6_ACRO_YAW_KP:
case TUNING_ACRO_YAW_KP:
g.acro_yaw_p = tuning_value;
break;
#if FRAME_CONFIG == HELI_FRAME
case CH6_HELI_EXTERNAL_GYRO:
case TUNING_HELI_EXTERNAL_GYRO:
motors.ext_gyro_gain(g.rc_6.control_in);
break;
case CH6_RATE_PITCH_FF:
case TUNING_RATE_PITCH_FF:
g.pid_rate_pitch.ff(tuning_value);
break;
case CH6_RATE_ROLL_FF:
case TUNING_RATE_ROLL_FF:
g.pid_rate_roll.ff(tuning_value);
break;
case CH6_RATE_YAW_FF:
case TUNING_RATE_YAW_FF:
g.pid_rate_yaw.ff(tuning_value);
break;
#endif
case CH6_DECLINATION:
case TUNING_DECLINATION:
// set declination to +-20degrees
compass.set_declination(ToRad((2.0f * g.rc_6.control_in - g.radio_tuning_high)/100.0f), false); // 2nd parameter is false because we do not want to save to eeprom because this would have a performance impact
break;
case CH6_CIRCLE_RATE:
case TUNING_CIRCLE_RATE:
// set circle rate
circle_nav.set_rate(g.rc_6.control_in/25-20); // allow approximately 45 degree turn rate in either direction
break;
case CH6_SONAR_GAIN:
case TUNING_SONAR_GAIN:
// set sonar gain
g.sonar_gain.set(tuning_value);
break;
#if 0
// disabled for now - we need accessor functions
case CH6_EKF_VERTICAL_POS:
case TUNING_EKF_VERTICAL_POS:
// EKF's baro vs accel (higher rely on accels more, baro impact is reduced)