Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
A guidance mode based on Incremental Nonlinear Dynamic Inversion Come to IROS2016 to learn more! More...
#include "generated/airframe.h"
#include "firmwares/rotorcraft/guidance/guidance_indi_hybrid.h"
#include "modules/radio_control/radio_control.h"
#include "firmwares/rotorcraft/autopilot_rc_helpers.h"
#include "state.h"
#include "mcu_periph/sys_time.h"
#include "autopilot.h"
#include "stdio.h"
#include "filters/low_pass_filter.h"
#include "modules/core/abi.h"
#include "firmwares/rotorcraft/navigation.h"
#include "modules/datalink/telemetry.h"
Go to the source code of this file.
Functions | |
static void | vel_sp_cb (uint8_t sender_id, struct FloatVect3 *vel_sp) |
ABI callback that obtains the velocity setpoint from a module. More... | |
void | guidance_indi_propagate_filters (void) |
Low pass the accelerometer measurements to remove noise from vibrations. More... | |
static void | send_eff_mat_guid_indi_hybrid (struct transport_tx *trans, struct link_device *dev) |
static void | send_guidance_indi_hybrid (struct transport_tx *trans, struct link_device *dev) |
void | guidance_indi_init (void) |
Init function. More... | |
void | guidance_indi_enter (void) |
Call upon entering indi guidance. More... | |
void | guidance_set_min_max_airspeed (float min_airspeed, float max_airspeed) |
struct StabilizationSetpoint | guidance_indi_run (struct FloatVect3 *accel_sp, float heading_sp) |
static struct FloatVect3 | compute_accel_from_speed_sp (void) |
static float | bound_vz_sp (float vz_sp) |
struct StabilizationSetpoint | guidance_indi_run_mode (bool in_flight UNUSED, struct HorizontalGuidance *gh, struct VerticalGuidance *gv, enum GuidanceIndiHybrid_HMode h_mode, enum GuidanceIndiHybrid_VMode v_mode) |
float WEAK | guidance_indi_get_liftd (float airspeed, float theta) |
Get the derivative of lift w.r.t. More... | |
A guidance mode based on Incremental Nonlinear Dynamic Inversion Come to IROS2016 to learn more!
Definition in file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_AIRSPEED_FILT_CUTOFF 0.5 |
Definition at line 196 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_COORDINATED_TURN_AIRSPEED_MARGIN 0.0 |
Definition at line 212 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_COORDINATED_TURN_MAX_AIRSPEED 30.0 |
Definition at line 208 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_COORDINATED_TURN_MIN_AIRSPEED 10.0 |
Definition at line 204 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_FILTER_CUTOFF 3.0 |
Definition at line 191 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_FWD_CLIMB_SPEED 4.0 |
Climb speed when navigation is making turns instead of direct lines.
Definition at line 86 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_FWD_DESCEND_SPEED -4.0 |
Descend speed when navigation is making turns instead of direct lines.
Definition at line 93 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_LIFTD_ASQ 0.20 |
Definition at line 58 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_LIFTD_P50 (GUIDANCE_INDI_LIFTD_P80/2) |
Definition at line 71 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_LIFTD_P80 (GUIDANCE_INDI_LIFTD_ASQ*12*12) |
Definition at line 70 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_MAX_LAT_ACCEL 9.81 |
Definition at line 200 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_MAX_PUSHER_INCREMENT MAX_PPRZ |
Definition at line 62 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_MIN_AIRSPEED -10.f |
Definition at line 79 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_POS_GAIN 0.5 |
Definition at line 53 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_POS_GAINZ 0.5 |
Definition at line 54 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_QUAD_CLIMB_SPEED 2.0 |
Climb speed when navigation is doing direct lines.
Definition at line 100 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_QUAD_DESCEND_SPEED -2.0 |
Descend speed when navigation is doing direct lines.
Definition at line 107 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_SPEED_GAIN 1.8 |
Definition at line 48 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_SPEED_GAINZ 1.8 |
Definition at line 49 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_VEL_SP_ID ABI_BROADCAST |
Definition at line 292 of file guidance_indi_hybrid.c.
#define GUIDANCE_INDI_ZERO_AIRSPEED FALSE |
Definition at line 149 of file guidance_indi_hybrid.c.
#define TURN_AIRSPEED_TH 13.0 |
Definition at line 154 of file guidance_indi_hybrid.c.
|
static |
Definition at line 749 of file guidance_indi_hybrid.c.
References guidance_indi_hybrid_params::climb_vspeed_fwd, guidance_indi_hybrid_params::climb_vspeed_quad, guidance_indi_hybrid_params::descend_vspeed_fwd, guidance_indi_hybrid_params::descend_vspeed_quad, gih_params, stateGetAirspeed_f(), and TURN_AIRSPEED_TH.
|
static |
Definition at line 414 of file guidance_indi_hybrid.c.
References gih_params, max_airspeed, guidance_indi_hybrid_params::max_airspeed, and guidance_indi_hybrid_params::min_airspeed.
void guidance_indi_enter | ( | void | ) |
Call upon entering indi guidance.
Definition at line 389 of file guidance_indi_hybrid.c.
References accely_filt, Stabilization::cmd, eulers_zxy, filt_accel_ned, filter_cutoff, float_eulers_of_quat_zxy(), guidance_indi_airspeed_filt, guidance_indi_airspeed_filt_cutoff, guidance_indi_hybrid_heading_sp, RotorcraftNavigation::heading, init_butterworth_2_low_pass(), nav, FloatEulers::phi, pitch_filt, FloatEulers::psi, roll_filt, stabilization, stateGetNedToBodyQuat_f(), FloatEulers::theta, thrust_act, thrust_filt, and thrust_in.
float WEAK guidance_indi_get_liftd | ( | float | airspeed, |
float | theta | ||
) |
Get the derivative of lift w.r.t.
pitch.
airspeed | The airspeed says most about the flight condition |
Definition at line 883 of file guidance_indi_hybrid.c.
References gih_params, guidance_indi_hybrid_params::liftd_asq, guidance_indi_hybrid_params::liftd_p50, and guidance_indi_hybrid_params::liftd_p80.
Referenced by guidance_indi_calcg_wing().
void guidance_indi_init | ( | void | ) |
Init function.
Definition at line 343 of file guidance_indi_hybrid.c.
References accely_filt, DefaultPeriodic, filt_accel_ned, filter_cutoff, Ga, guidance_indi_airspeed_filt, guidance_indi_airspeed_filt_cutoff, GUIDANCE_INDI_VEL_SP_ID, init_butterworth_2_low_pass(), pitch_filt, register_periodic_telemetry(), roll_filt, send_eff_mat_guid_indi_hybrid(), send_guidance_indi_hybrid(), thrust_dyn, thrust_filt, vel_sp_cb(), and vel_sp_ev.
void guidance_indi_propagate_filters | ( | void | ) |
Low pass the accelerometer measurements to remove noise from vibrations.
The roll and pitch also need to be filtered to synchronize them with the acceleration Called as a periodic function with PERIODIC_FREQ
Definition at line 856 of file guidance_indi_hybrid.c.
References ACCEL_FLOAT_OF_BFP, accely_filt, eulers_zxy, filt_accel_ned, guidance_indi_airspeed_filt, FloatEulers::phi, pitch_filt, roll_filt, stateGetAccelBody_i(), stateGetAccelNed_f(), stateGetAirspeed_f(), FloatEulers::theta, update_butterworth_2_low_pass(), NedCoor_f::x, NedCoor_f::y, and NedCoor_f::z.
struct StabilizationSetpoint guidance_indi_run | ( | struct FloatVect3 * | accel_sp, |
float | heading_sp | ||
) |
accel_sp | accel setpoint in NED frame [m/s^2] |
heading_sp | the desired heading [rad] |
main indi guidance function
Definition at line 414 of file guidance_indi_hybrid.c.
struct StabilizationSetpoint guidance_indi_run_mode | ( | bool in_flight | UNUSED, |
struct HorizontalGuidance * | gh, | ||
struct VerticalGuidance * | gv, | ||
enum GuidanceIndiHybrid_HMode | h_mode, | ||
enum GuidanceIndiHybrid_VMode | v_mode | ||
) |
Definition at line 749 of file guidance_indi_hybrid.c.
void guidance_set_min_max_airspeed | ( | float | min_airspeed, |
float | max_airspeed | ||
) |
Definition at line 414 of file guidance_indi_hybrid.c.
Referenced by rotwing_state_periodic().
|
static |
Definition at line 303 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_init().
|
static |
Definition at line 310 of file guidance_indi_hybrid.c.
References dev, euler_cmd, filt_accel_ned, gi_speed_sp, SecondOrderLowPass::o, sp_accel, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by guidance_indi_init().
|
static |
ABI callback that obtains the velocity setpoint from a module.
Definition at line 915 of file guidance_indi_hybrid.c.
References get_sys_time_float(), indi_vel_sp, time_of_vel_sp, FloatVect3::x, FloatVect3::y, and FloatVect3::z.
Referenced by guidance_indi_init().
Butterworth2LowPass accely_filt |
Definition at line 240 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter(), guidance_indi_init(), and guidance_indi_propagate_filters().
bool coordinated_turn_use_accel = false |
Definition at line 229 of file guidance_indi_hybrid.c.
struct FloatVect2 desired_airspeed |
Definition at line 241 of file guidance_indi_hybrid.c.
float du_gih[GUIDANCE_INDI_HYBRID_U] |
Definition at line 249 of file guidance_indi_hybrid.c.
struct FloatVect3 euler_cmd |
Definition at line 246 of file guidance_indi_hybrid.c.
Referenced by send_guidance_indi_hybrid().
struct FloatEulers eulers_zxy |
state eulers in zxy order
Definition at line 229 of file guidance_indi_hybrid.c.
Referenced by eff_scheduling_falcon_periodic(), eff_scheduling_periodic_b(), guidance_indi_calcg_wing(), guidance_indi_enter(), guidance_indi_hybrid_set_wls_settings(), guidance_indi_propagate_filters(), schdule_control_effectiveness(), and send_fp().
Butterworth2LowPass filt_accel_ned[3] |
Definition at line 236 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter(), guidance_indi_init(), guidance_indi_propagate_filters(), and send_guidance_indi_hybrid().
float filter_cutoff = GUIDANCE_INDI_FILTER_CUTOFF |
Definition at line 281 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter(), and guidance_indi_init().
bool force_forward = false |
forward flight for hybrid nav
Definition at line 160 of file guidance_indi_hybrid.c.
Referenced by reshape_wind().
float Ga[GUIDANCE_INDI_HYBRID_V][GUIDANCE_INDI_HYBRID_U] |
Definition at line 246 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_init(), and send_eff_mat_guid_indi_hybrid().
struct FloatVect3 gi_speed_sp = {0.0, 0.0, 0.0} |
Definition at line 287 of file guidance_indi_hybrid.c.
Referenced by send_guidance_indi_hybrid().
float gi_unbounded_airspeed_sp = 0.f |
Definition at line 244 of file guidance_indi_hybrid.c.
Referenced by rotwing_state_periodic(), and send_rotating_wing_state().
float gih_coordinated_turn_max_airspeed = GUIDANCE_INDI_COORDINATED_TURN_MAX_AIRSPEED + GUIDANCE_INDI_COORDINATED_TURN_AIRSPEED_MARGIN |
Definition at line 226 of file guidance_indi_hybrid.c.
float gih_coordinated_turn_min_airspeed = GUIDANCE_INDI_COORDINATED_TURN_MIN_AIRSPEED |
Definition at line 225 of file guidance_indi_hybrid.c.
struct guidance_indi_hybrid_params gih_params |
Definition at line 1 of file guidance_indi_hybrid.c.
Referenced by bound_vz_sp(), compute_accel_from_speed_sp(), and guidance_indi_get_liftd().
struct FloatEulers guidance_euler_cmd |
Definition at line 284 of file guidance_indi_hybrid.c.
Butterworth2LowPass guidance_indi_airspeed_filt |
Definition at line 241 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter(), guidance_indi_init(), and guidance_indi_propagate_filters().
float guidance_indi_airspeed_filt_cutoff = GUIDANCE_INDI_AIRSPEED_FILT_CUTOFF |
Definition at line 282 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter(), and guidance_indi_init().
bool guidance_indi_airspeed_filtering = false |
Definition at line 162 of file guidance_indi_hybrid.c.
float guidance_indi_hybrid_heading_sp = 0.f |
Definition at line 284 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter().
float guidance_indi_max_bank = GUIDANCE_H_MAX_BANK |
Definition at line 218 of file guidance_indi_hybrid.c.
float guidance_indi_min_pitch = GUIDANCE_INDI_MIN_PITCH |
Definition at line 219 of file guidance_indi_hybrid.c.
float guidance_indi_pitch_pref_deg = 0 |
Definition at line 131 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_hybrid_set_wls_settings().
struct FloatVect3 indi_vel_sp = {0.0, 0.0, 0.0} |
Definition at line 295 of file guidance_indi_hybrid.c.
Referenced by vel_sp_cb().
float inv_eff[4] |
Definition at line 215 of file guidance_indi_hybrid.c.
Butterworth2LowPass pitch_filt |
Definition at line 238 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter(), guidance_indi_init(), and guidance_indi_propagate_filters().
Butterworth2LowPass roll_filt |
Definition at line 237 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter(), guidance_indi_init(), and guidance_indi_propagate_filters().
struct FloatVect3 sp_accel = {0.0,0.0,0.0} |
Definition at line 162 of file guidance_indi_hybrid.c.
Referenced by send_guidance_indi_hybrid().
bool take_heading_control = false |
Definition at line 158 of file guidance_indi_hybrid.c.
float thrust_act = 0.f |
Definition at line 235 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter().
float thrust_dyn = 0.f |
Definition at line 234 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_init().
Butterworth2LowPass thrust_filt |
Definition at line 239 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter(), and guidance_indi_init().
float thrust_in |
Definition at line 287 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_enter().
struct ThrustSetpoint thrust_sp |
Definition at line 284 of file guidance_indi_hybrid.c.
float time_of_vel_sp = 0.0 |
Definition at line 297 of file guidance_indi_hybrid.c.
Referenced by vel_sp_cb().
float v_gih[3] |
Definition at line 278 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_calcg_wing().
abi_event vel_sp_ev |
Definition at line 294 of file guidance_indi_hybrid.c.
Referenced by guidance_indi_init().