29 #include "generated/airframe.h"
33 #if STABILIZATION_INDI_ALLOCATION_PSEUDO_INVERSE
34 #error "You need to use WLS control allocation for this module"
37 #ifndef INDI_FUNCTIONS_RC_CHANNEL
38 #error "You need to define an RC channel to switch between simple and advanced scheduling"
41 static float g1g2_forward[INDI_OUTPUTS][INDI_NUM_ACT] = {FWD_G1_ROLL,
42 FWD_G1_PITCH, FWD_G1_YAW, FWD_G1_THRUST
45 static float g1g2_hover[INDI_OUTPUTS][INDI_NUM_ACT] = {STABILIZATION_INDI_G1_ROLL,
46 STABILIZATION_INDI_G1_PITCH, STABILIZATION_INDI_G1_YAW, STABILIZATION_INDI_G1_THRUST
49 static float g2_both[INDI_NUM_ACT] = STABILIZATION_INDI_G2;
57 for (i = 0; i < INDI_OUTPUTS; i++) {
58 for (j = 0; j < INDI_NUM_ACT; j++) {
78 #ifdef INDI_THRUST_ON_PITCH_EFF
101 for (i = 0; i < INDI_OUTPUTS; i++) {
102 for (j = 0; j < INDI_NUM_ACT; j++) {
115 Bound(pitch_interp, -60.0, -30.0);
116 float ratio = (pitch_interp + 30.0)/(-30.);
119 g1g2[1][0] =
g1g2_hover[1][0]*(1-ratio) + -PITCH_EFF_AT_60/1000*ratio;
120 g1g2[1][1] =
g1g2_hover[1][1]*(1-ratio) + PITCH_EFF_AT_60/1000*ratio;
122 g1g2[2][0] =
g1g2_hover[2][0]*(1-ratio) + -YAW_EFF_AT_60/1000*ratio;
123 g1g2[2][1] =
g1g2_hover[2][1]*(1-ratio) + -YAW_EFF_AT_60/1000*ratio;
126 Bound(airspeed, 0.0, 30.0);
127 float airspeed2 = airspeed*airspeed;
129 float pitch_eff = CE_PITCH_A + CE_PITCH_B*airspeed2;
130 g1g2[1][0] = -pitch_eff/1000;
131 g1g2[1][1] = pitch_eff/1000;
133 float yaw_eff = CE_YAW_A + CE_YAW_B*airspeed2;
134 g1g2[2][0] = -yaw_eff/1000;
135 g1g2[2][1] = -yaw_eff/1000;
140 Bound(
g1g2[0][2], -30.0/1000, -2.0/1000);
141 Bound(
g1g2[0][3], 2.0/1000, 30.0/1000);
144 if(airspeed > 12.0) {