|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
67 #include "generated/airframe.h"
80 #error "Energy Controller can not accept Loiter Trim"
129 #define V_CTL_AUTO_GROUNDSPEED_MAX_SUM_ERR 100
145 #ifndef V_CTL_ALTITUDE_MAX_CLIMB
146 #define V_CTL_ALTITUDE_MAX_CLIMB 2;
147 INFO(
"V_CTL_ALTITUDE_MAX_CLIMB not defined - default is 2 , indicating 2 m/s")
149 #ifndef STALL_AIRSPEED
150 INFO(
"No STALL_AIRSPEED defined. Using NOMINAL_AIRSPEED")
151 #define STALL_AIRSPEED NOMINAL_AIRSPEED
153 #ifndef V_CTL_GLIDE_RATIO
154 #define V_CTL_GLIDE_RATIO 8.
155 INFO(
"V_CTL_GLIDE_RATIO not defined - default is 8.")
157 #ifndef AIRSPEED_SETPOINT_SLEW
158 #define AIRSPEED_SETPOINT_SLEW 1
160 #ifndef V_CTL_MAX_ACCELERATION
161 #define V_CTL_MAX_ACCELERATION 0.5 //G
164 #ifndef V_CTL_ENERGY_IMU_ID
165 #define V_CTL_ENERGY_IMU_ID ABI_BROADCAST
182 *last_v = (((*last_v) * (((float)count) - 1.0f)) + new_v) / ((
float) count);
185 static void ac_char_update(
float throttle,
float pitch,
float climb,
float accelerate)
187 if ((accelerate > -0.02) && (accelerate < 0.02)) {
188 if (throttle >= 1.0
f) {
192 }
else if (throttle <= 0.0
f) {
196 }
else if ((climb > -0.125) && (climb < 0.125)) {
205 uint32_t stamp __attribute__((unused)),
228 #ifdef V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_PITCH
255 #ifdef V_CTL_ENERGY_TOT_PGAIN
265 #warning "V_CTL_ENERGY_TOT GAINS are not defined and set to 0"
268 #ifdef V_CTL_ALTITUDE_MAX_CLIMB
272 #warning "V_CTL_ALTITUDE_MAX_CLIMB not defined - default is 2m/s"
275 #ifdef V_CTL_AUTO_GROUNDSPEED_SETPOINT
344 #ifdef V_CTL_AUTO_GROUNDSPEED_SETPOINT
390 float en_tot_err = gamma_err + vdot_err;
393 float en_dis_err = gamma_err - vdot_err;
411 en_dis_err = -vdot_err;
425 float v_ctl_pitch_of_vz =
442 #ifdef V_CTL_THROTTLE_SLEW_LIMITER
443 #define V_CTL_THROTTLE_SLEW (1./CONTROL_FREQUENCY/(V_CTL_THROTTLE_SLEW_LIMITER))
446 #ifndef V_CTL_THROTTLE_SLEW
447 #define V_CTL_THROTTLE_SLEW 1.
float v_ctl_energy_diff_igain
static void body_to_imu_cb(uint8_t sender_id, struct FloatQuat *q_b2i_f)
float ac_char_cruise_pitch
float v_ctl_altitude_pgain
#define V_CTL_AUTO_GROUNDSPEED_MAX_SUM_ERR
#define V_CTL_CLIMB_MODE_AUTO_THROTTLE
#define NAVIGATION_FREQUENCY
#define V_CTL_GLIDE_RATIO
#define V_CTL_SPEED_THROTTLE
static void float_quat_identity(struct FloatQuat *q)
initialises a quaternion to identity
float v_ctl_energy_total_pgain
float v_ctl_auto_throttle_pitch_of_vz_pgain
static void ac_char_update(float throttle, float pitch, float climb, float accelerate)
Event structure to store callbacks in a linked list.
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
static void accel_cb(uint8_t sender_id, uint32_t stamp, struct Int32Vect3 *accel)
float v_ctl_auto_airspeed_setpoint_slew
static struct UtmCoor_f * stateGetPositionUtm_f(void)
Get position in UTM coordinates (float).
float v_ctl_auto_throttle_cruise_throttle
float v_ctl_auto_throttle_of_airspeed_pgain
float v_ctl_auto_groundspeed_pgain
float v_ctl_auto_throttle_nominal_cruise_pitch
static abi_event body_to_imu_ev
static struct Int32Vect3 accel_imu_meas
static const float dt_attidude
float controlled_throttle
static struct FloatQuat imu_to_body_quat
struct pprz_autopilot autopilot
Global autopilot structure.
bool autopilot_throttle_killed(void)
get kill status
float v_ctl_altitude_error
in meters, (setpoint - alt) -> positive = too low
float alt
in meters (above WGS84 reference ellipsoid or above MSL)
float v_ctl_airspeed_pgain
float v_ctl_auto_throttle_nominal_cruise_throttle
static float stateGetAirspeed_f(void)
Get airspeed (float).
#define V_CTL_MAX_ACCELERATION
static void float_quat_invert(struct FloatQuat *qo, struct FloatQuat *qi)
float v_ctl_climb_setpoint
float ac_char_descend_pitch
float v_ctl_auto_pitch_of_airspeed_pgain
pprz_t v_ctl_throttle_slewed
float v_ctl_auto_pitch_of_airspeed_igain
static void ac_char_average(float *last_v, float new_v, int count)
float v_ctl_max_acceleration
float v_ctl_energy_total_igain
float v_ctl_auto_airspeed_controlled
void v_ctl_altitude_loop(void)
outer loop
uint16_t f
Camera baseline, in meters (i.e. horizontal distance between the two cameras of the stereo setup)
void float_quat_vmult(struct FloatVect3 *v_out, struct FloatQuat *q, const struct FloatVect3 *v_in)
rotate 3D vector by quaternion.
#define V_CTL_MODE_MANUAL
int ac_char_descend_count
#define V_CTL_ENERGY_IMU_ID
pprz_t v_ctl_throttle_setpoint
#define V_CTL_THROTTLE_SLEW
float v_ctl_auto_pitch_of_airspeed_dgain
float v_ctl_desired_acceleration
float ac_char_cruise_throttle
float v_ctl_auto_groundspeed_setpoint
in meters per second
static float stateGetHorizontalSpeedNorm_f(void)
Get norm of horizontal ground speed (float).
float v_ctl_altitude_setpoint
in meters above MSL
void v_ctl_throttle_slew(void)
Computes slewed throttle from throttle setpoint called at 20Hz.
static struct EnuCoor_f * stateGetSpeedEnu_f(void)
Get ground speed in local ENU coordinates (float).
void v_ctl_climb_loop(void)
Auto-throttle inner loop.
float ac_char_descend_max
float v_ctl_altitude_pre_climb
Path Angle.
float v_ctl_energy_diff_pgain
static float low_pass_vdot(float v)
float v_ctl_auto_groundspeed_igain
float v_ctl_auto_airspeed_setpoint
in meters per second
#define ACCELS_FLOAT_OF_BFP(_ef, _ei)
#define V_CTL_ALTITUDE_MAX_CLIMB
float v_ctl_pitch_setpoint
float v_ctl_auto_throttle_climb_throttle_increment
float ac_char_climb_pitch
float v_ctl_auto_groundspeed_sum_err
#define V_CTL_MODE_AUTO_CLIMB
float v_ctl_auto_throttle_of_airspeed_igain
uint8_t v_ctl_auto_throttle_submode
#define CONTROL_FREQUENCY
float v_ctl_auto_throttle_sum_err
static abi_event accel_ev
bool launch
request launch
static const float dt_navigation
#define AIRSPEED_SETPOINT_SLEW