67 #include "generated/airframe.h"
80 #error "Energy Controller can not accept Loiter Trim"
129 #define V_CTL_AUTO_GROUNDSPEED_MAX_SUM_ERR 100
142 #ifndef V_CTL_ALTITUDE_MAX_CLIMB
143 #define V_CTL_ALTITUDE_MAX_CLIMB 2;
144 INFO(
"V_CTL_ALTITUDE_MAX_CLIMB not defined - default is 2 , indicating 2 m/s")
146 #ifndef STALL_AIRSPEED
147 INFO(
"No STALL_AIRSPEED defined. Using NOMINAL_AIRSPEED")
148 #define STALL_AIRSPEED NOMINAL_AIRSPEED
150 #ifndef V_CTL_GLIDE_RATIO
151 #define V_CTL_GLIDE_RATIO 8.
152 INFO(
"V_CTL_GLIDE_RATIO not defined - default is 8.")
154 #ifndef AIRSPEED_SETPOINT_SLEW
155 #define AIRSPEED_SETPOINT_SLEW 1
157 #ifndef V_CTL_MAX_ACCELERATION
158 #define V_CTL_MAX_ACCELERATION 0.5
161 #ifndef V_CTL_ENERGY_IMU_ID
162 #define V_CTL_ENERGY_IMU_ID ABI_BROADCAST
179 *last_v = (((*last_v) * (((float)count) - 1.0f)) + new_v) / ((
float) count);
182 static void ac_char_update(
float throttle,
float pitch,
float climb,
float accelerate)
184 if ((accelerate > -0.02) && (accelerate < 0.02)) {
185 if (throttle >= 1.0f) {
189 }
else if (throttle <= 0.0f) {
193 }
else if ((climb > -0.125) && (climb < 0.125)) {
202 uint32_t stamp __attribute__((unused)),
219 #ifdef V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_PITCH
246 #ifdef V_CTL_ENERGY_TOT_PGAIN
256 #warning "V_CTL_ENERGY_TOT GAINS are not defined and set to 0"
259 #ifdef V_CTL_ALTITUDE_MAX_CLIMB
263 #warning "V_CTL_ALTITUDE_MAX_CLIMB not defined - default is 2m/s"
266 #ifdef V_CTL_AUTO_GROUNDSPEED_SETPOINT
332 #ifdef V_CTL_AUTO_GROUNDSPEED_SETPOINT
375 float en_tot_err = gamma_err + vdot_err;
378 float en_dis_err = gamma_err - vdot_err;
396 en_dis_err = -vdot_err;
410 float v_ctl_pitch_of_vz =
427 #ifdef V_CTL_THROTTLE_SLEW_LIMITER
428 #define V_CTL_THROTTLE_SLEW (1./CONTROL_FREQUENCY/(V_CTL_THROTTLE_SLEW_LIMITER))
431 #ifndef V_CTL_THROTTLE_SLEW
432 #define V_CTL_THROTTLE_SLEW 1.
Main include for ABI (AirBorneInterface).
Event structure to store callbacks in a linked list.
struct pprz_autopilot autopilot
Global autopilot structure.
bool autopilot_throttle_killed(void)
get kill status
Core autopilot interface common to all firmwares.
bool launch
request launch
float v_ctl_energy_total_pgain
float v_ctl_auto_pitch_of_airspeed_igain
pprz_t v_ctl_throttle_setpoint
static void ac_char_update(float throttle, float pitch, float climb, float accelerate)
float v_ctl_desired_acceleration
float v_ctl_auto_groundspeed_sum_err
float v_ctl_auto_throttle_climb_throttle_increment
int ac_char_descend_count
void v_ctl_climb_loop(void)
Auto-throttle inner loop.
float ac_char_climb_pitch
float v_ctl_auto_airspeed_controlled
float v_ctl_auto_throttle_nominal_cruise_pitch
static abi_event accel_ev
float v_ctl_energy_total_igain
static struct Int32Vect3 accel_imu_meas
uint8_t v_ctl_auto_throttle_submode
float v_ctl_auto_groundspeed_igain
float v_ctl_auto_pitch_of_airspeed_dgain
float v_ctl_altitude_pgain
float ac_char_cruise_throttle
float v_ctl_pitch_setpoint
float ac_char_descend_max
void v_ctl_throttle_slew(void)
Computes slewed throttle from throttle setpoint called at 20Hz.
float v_ctl_energy_diff_pgain
float v_ctl_auto_throttle_sum_err
float v_ctl_max_acceleration
float v_ctl_altitude_setpoint
in meters above MSL
float ac_char_cruise_pitch
pprz_t v_ctl_throttle_slewed
static const float dt_navigation
static const float dt_attidude
#define V_CTL_AUTO_GROUNDSPEED_MAX_SUM_ERR
float v_ctl_auto_throttle_nominal_cruise_throttle
float v_ctl_auto_throttle_of_airspeed_igain
static void ac_char_average(float *last_v, float new_v, int count)
#define V_CTL_ALTITUDE_MAX_CLIMB
#define V_CTL_ENERGY_IMU_ID
static void accel_cb(uint8_t sender_id, uint32_t stamp, struct Int32Vect3 *accel)
float v_ctl_auto_airspeed_setpoint_slew
float v_ctl_airspeed_pgain
float v_ctl_auto_throttle_pitch_of_vz_pgain
#define AIRSPEED_SETPOINT_SLEW
void v_ctl_altitude_loop(void)
outer loop
#define V_CTL_THROTTLE_SLEW
float v_ctl_auto_throttle_cruise_throttle
float v_ctl_altitude_pre_climb
Path Angle.
float v_ctl_auto_airspeed_setpoint
in meters per second
static float low_pass_vdot(float v)
float v_ctl_altitude_error
in meters, (setpoint - alt) -> positive = too low
float v_ctl_auto_pitch_of_airspeed_pgain
float v_ctl_auto_groundspeed_pgain
float ac_char_descend_pitch
float v_ctl_auto_groundspeed_setpoint
in meters per second
#define V_CTL_GLIDE_RATIO
float v_ctl_climb_setpoint
float v_ctl_auto_throttle_of_airspeed_pgain
#define V_CTL_MAX_ACCELERATION
float v_ctl_energy_diff_igain
Vertical control using total energy control for fixed wing vehicles.
#define V_CTL_SPEED_THROTTLE
#define CONTROL_FREQUENCY
#define ACCELS_FLOAT_OF_BFP(_ef, _ei)
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
static float stateGetAirspeed_f(void)
Get airspeed (float).
#define V_CTL_MODE_MANUAL
#define V_CTL_CLIMB_MODE_AUTO_THROTTLE
#define V_CTL_MODE_AUTO_CLIMB
float controlled_throttle
Fixedwing Navigation library.
#define NAVIGATION_FREQUENCY
Default fixedwing navigation frequency.
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
API to get/set the generic vehicle states.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.