diff --git a/conf/settings/control/ctl_energy.xml b/conf/settings/control/ctl_energy.xml index 4c2e865c52..3c884df80a 100644 --- a/conf/settings/control/ctl_energy.xml +++ b/conf/settings/control/ctl_energy.xml @@ -27,8 +27,8 @@ - - + + @@ -46,10 +46,10 @@ - - - - + + + + diff --git a/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.c b/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.c index b3b68b6375..1a8a1619d5 100644 --- a/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.c +++ b/sw/airborne/firmwares/fixedwing/guidance/energy_ctrl.c @@ -170,7 +170,12 @@ void v_ctl_init( void ) { /* outer loop */ v_ctl_altitude_setpoint = 0.; + +#ifdef V_CTL_ALTITUDE_PGAIN v_ctl_altitude_pgain = V_CTL_ALTITUDE_PGAIN; + v_ctl_airspeed_pgain = V_CTL_AIRSPEED_PGAIN; +#endif + v_ctl_auto_airspeed_setpoint = NOMINAL_AIRSPEED; /* inner loops */ @@ -178,8 +183,23 @@ void v_ctl_init( void ) { /* "auto throttle" inner loop parameters */ v_ctl_auto_throttle_nominal_cruise_throttle = V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE; + +#ifdef V_CTL_AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT v_ctl_auto_throttle_climb_throttle_increment = V_CTL_AUTO_THROTTLE_CLIMB_THROTTLE_INCREMENT; v_ctl_auto_throttle_pitch_of_vz_pgain = V_CTL_AUTO_THROTTLE_PITCH_OF_VZ_PGAIN; +#endif + +#ifdef V_CTL_AUTO_THROTTLE_OF_AIRSPEED_PGAIN + v_ctl_auto_throttle_of_airspeed_pgain = V_CTL_AUTO_THROTTLE_OF_AIRSPEED_PGAIN; + v_ctl_auto_throttle_of_airspeed_igain = V_CTL_AUTO_THROTTLE_OF_AIRSPEED_IGAIN; +#endif + +#ifdef V_CTL_ENERGY_TOT_PGAIN + v_ctl_energy_total_pgain = V_CTL_ENERGY_TOT_PGAIN; + v_ctl_energy_total_igain = V_CTL_ENERGY_TOT_IGAIN; + v_ctl_energy_diff_pgain = V_CTL_ENERGY_DIFF_PGAIN; + v_ctl_energy_diff_igain = V_CTL_ENERGY_DIFF_IGAIN; +#endif v_ctl_throttle_setpoint = 0; }