|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
27 #include "generated/airframe.h"
42 #if (GUIDANCE_V_HOVER_KP < 0) || \
43 (GUIDANCE_V_HOVER_KD < 0) || \
44 (GUIDANCE_V_HOVER_KI < 0)
45 #error "ALL control gains must be positive!!!"
53 #ifdef GUIDANCE_V_NOMINAL_HOVER_THROTTLE
54 # ifndef GUIDANCE_V_ADAPT_THROTTLE_ENABLED
55 # define GUIDANCE_V_ADAPT_THROTTLE_ENABLED FALSE
58 # define GUIDANCE_V_NOMINAL_HOVER_THROTTLE 0.4
59 # ifndef GUIDANCE_V_ADAPT_THROTTLE_ENABLED
60 # define GUIDANCE_V_ADAPT_THROTTLE_ENABLED TRUE
67 #ifndef GUIDANCE_V_CLIMB_RC_DEADBAND
68 #define GUIDANCE_V_CLIMB_RC_DEADBAND MAX_PPRZ/10
71 #ifndef GUIDANCE_V_MAX_RC_CLIMB_SPEED
72 #define GUIDANCE_V_MAX_RC_CLIMB_SPEED GUIDANCE_V_REF_MIN_ZD
75 #ifndef GUIDANCE_V_MAX_RC_DESCENT_SPEED
76 #define GUIDANCE_V_MAX_RC_DESCENT_SPEED GUIDANCE_V_REF_MAX_ZD
79 #ifndef GUIDANCE_V_MIN_ERR_Z
80 #define GUIDANCE_V_MIN_ERR_Z POS_BFP_OF_REAL(-10.)
83 #ifndef GUIDANCE_V_MAX_ERR_Z
84 #define GUIDANCE_V_MAX_ERR_Z POS_BFP_OF_REAL(10.)
87 #ifndef GUIDANCE_V_MIN_ERR_ZD
88 #define GUIDANCE_V_MIN_ERR_ZD SPEED_BFP_OF_REAL(-10.)
91 #ifndef GUIDANCE_V_MAX_ERR_ZD
92 #define GUIDANCE_V_MAX_ERR_ZD SPEED_BFP_OF_REAL(10.)
95 #ifndef GUIDANCE_V_MAX_SUM_ERR
96 #define GUIDANCE_V_MAX_SUM_ERR 2000000
99 #ifndef GUIDANCE_V_MAX_CMD
100 #define GUIDANCE_V_MAX_CMD 0.9*MAX_PPRZ
112 #define GUIDANCE_V_GUIDED_MODE_ZHOLD 0
113 #define GUIDANCE_V_GUIDED_MODE_CLIMB 1
114 #define GUIDANCE_V_GUIDED_MODE_THROTTLE 2
147 #if PERIODIC_TELEMETRY
152 pprz_msg_send_VERT_LOOP(trans,
dev, AC_ID,
170 pprz_msg_send_TUNE_VERT(trans,
dev, AC_ID,
198 #if GUIDANCE_V_MODE_MODULE_SETTING == GUIDANCE_V_MODE_MODULE
202 #if PERIODIC_TELEMETRY
253 #if GUIDANCE_V_MODE_MODULE_SETTING == GUIDANCE_V_MODE_MODULE
323 #if !NO_RC_THRUST_LIMIT
339 #if GUIDANCE_V_MODE_MODULE_SETTING == GUIDANCE_V_MODE_MODULE
403 if (coef < max_bank_coef) {
404 coef = max_bank_coef;
410 #define FF_CMD_FRAC 18
451 #if HYBRID_NAVIGATION
492 #if HYBRID_NAVIGATION
495 #if !NO_RC_THRUST_LIMIT
542 #if !NO_RC_THRUST_LIMIT
int32_t nav_flight_altitude
static void send_tune_vert(struct transport_tx *trans, struct link_device *dev)
#define GUIDANCE_V_MAX_SUM_ERR
bool guidance_v_set_guided_vz(float vz)
Set z velocity setpoint in GUIDED mode.
void guidance_v_notify_in_flight(bool in_flight)
int32_t guidance_v_rc_delta_t
Direct throttle from radio control.
int32_t gv_adapt_X
State of the estimator.
static bool desired_zd_updated
#define GUIDANCE_V_MIN_ERR_Z
void guidance_v_set_ref(int32_t pos, int32_t speed, int32_t accel)
Set guidance ref parameters.
#define GV_ZDD_REF_FRAC
number of bits for the fractional part of gv_zdd_ref
void guidance_v_module_init(void)
#define GUIDANCE_V_NOMINAL_HOVER_THROTTLE
int32_t guidance_v_zdd_ref
vertical acceleration reference in meter/s^2.
int32_t guidance_v_z_sp
altitude setpoint in meters (input).
void guidance_v_mode_changed(uint8_t new_mode)
void guidance_v_module_enter(void)
void guidance_v_read_rc(void)
#define GUIDANCE_V_MODE_CLIMB
#define GUIDANCE_V_MODE_MODULE
#define GUIDANCE_V_GUIDED_MODE_ZHOLD
#define SPEED_BFP_OF_REAL(_af)
void run_hover_loop(bool in_flight)
int32_t gv_adapt_P
Covariance.
int32_t guidance_v_fb_cmd
feed-back command
static struct NedCoor_i * stateGetPositionNed_i(void)
Get position in local NED coordinates (int).
#define VERTICAL_MODE_CLIMB
void gv_update_ref_from_zd_sp(int32_t zd_sp, int32_t z_pos)
update vertical reference from speed setpoint.
int32_t guidance_v_z_sum_err
accumulator for I-gain
Paparazzi fixed point algebra.
int32_t guidance_v_zd_ref
vertical speed reference in meter/s.
#define GUIDANCE_V_MAX_RC_DESCENT_SPEED
int32_t gv_zd_ref
reference model vertical speed in meters/sec (output) fixed point representation with GV_ZD_REF_FRAC ...
void guidance_v_z_enter(void)
static struct Int32RMat * stateGetNedToBodyRMat_i(void)
Get vehicle body attitude rotation matrix (int).
static void send_vert_loop(struct transport_tx *trans, struct link_device *dev)
void guidance_v_init(void)
int32_t guidance_v_ff_cmd
feed-forward command
#define GUIDANCE_V_MODE_RC_CLIMB
static struct NedCoor_i * stateGetSpeedNed_i(void)
Get ground speed in local NED coordinates (int).
#define VERTICAL_MODE_MANUAL
#define GUIDANCE_V_MODE_KILL
#define GUIDANCE_V_MODE_RC_DIRECT
static const struct usb_device_descriptor dev
int32_t guidance_v_zd_sp
vertical speed setpoint in meter/s (input).
bool guidance_v_adapt_throttle_enabled
Use adaptive throttle command estimation.
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
int32_t gv_adapt_Xmeas
Measurement.
void guidance_hybrid_vertical(void)
Description.
void guidance_v_run(bool in_flight)
int64_t gv_z_ref
reference model altitude in meters (output) fixed point representation with GV_Z_REF_FRAC Q37....
void guidance_v_guided_enter(void)
Enter GUIDED mode control.
#define BFP_OF_REAL(_vr, _frac)
#define GUIDANCE_V_GUIDED_MODE_CLIMB
#define GUIDANCE_V_MODE_HOVER
uint16_t f
Camera baseline, in meters (i.e. horizontal distance between the two cameras of the stereo setup)
void gv_adapt_run(int32_t zdd_meas, int32_t thrust_applied, int32_t zd_ref)
Adaptation function.
#define GUIDANCE_V_MAX_ERR_ZD
#define GUIDANCE_V_GUIDED_MODE_THROTTLE
float guidance_v_nominal_throttle
nominal throttle for hover.
#define GUIDANCE_V_MODE_FLIP
bool guidance_v_set_guided_z(float z)
Set z setpoint in GUIDED mode.
#define GUIDANCE_V_MAX_ERR_Z
#define GUIDANCE_V_MIN_ERR_ZD
#define GV_Z_REF_FRAC
number of bits for the fractional part of gv_z_ref
#define GUIDANCE_V_MAX_RC_CLIMB_SPEED
int32_t gv_zdd_ref
reference model vertical accel in meters/s^2 (output) fixed point representation with GV_ZDD_REF_FRAC...
int32_t guidance_v_delta_t
thrust command.
void guidance_v_module_run(UNUSED bool in_flight)
#define VERTICAL_MODE_ALT
#define GUIDANCE_V_MODE_NAV
void guidance_v_thrust_adapt(bool in_flight)
int32_t guidance_v_ki
vertical control I-gain
#define GUIDANCE_V_CLIMB_RC_DEADBAND
bool guidance_v_set_guided_th(float th)
void gv_update_ref_from_z_sp(int32_t z_sp)
#define GUIDANCE_V_MODE_GUIDED
int32_t guidance_v_thrust_coeff
int32_t stabilization_cmd[COMMANDS_NB]
Stabilization commands.
#define GUIDANCE_V_MAX_CMD
#define GV_ZD_REF_FRAC
number of bits for the fractional part of gv_zd_ref
void gv_set_ref(int32_t alt, int32_t speed, int32_t accel)
static struct NedCoor_i * stateGetAccelNed_i(void)
Get acceleration in NED coordinates (int).
int32_t guidance_v_kd
vertical control D-gain
#define POS_BFP_OF_REAL(_af)
int32_t guidance_v_kp
vertical control P-gain
static int32_t get_vertical_thrust_coeff(void)
get the cosine of the angle between thrust vector and gravity vector
void guidance_v_guided_run(bool in_flight)
Run GUIDED mode control.
int guidance_v_guided_mode
#define GUIDANCE_V_ADAPT_THROTTLE_ENABLED
void guidance_v_from_nav(bool in_flight)
Set guidance setpoint from NAV and run hover loop.
uint32_t nav_throttle
direct throttle from 0:MAX_PPRZ, used in VERTICAL_MODE_MANUAL
int32_t guidance_v_rc_zd_sp
Vertical speed setpoint from radio control.
#define DefaultPeriodic
Set default periodic telemetry.
struct RadioControl radio_control
pprz_t values[RADIO_CONTROL_NB_CHANNEL]
int32_t guidance_v_z_ref
altitude reference in meters.