Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "firmwares/rotorcraft/stabilization.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude_common_int.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude_ref_quat_int.h"
#include "generated/airframe.h"
#include "filters/low_pass_filter.h"
#include "filters/notch_filter_float.h"
Go to the source code of this file.
Data Structures | |
struct | guidance_indi_hybrid_params |
struct | OneloopGuidanceRef |
struct | OneloopGuidanceState |
struct | OneloopStabilizationRef |
struct | OneloopStabilizationState |
struct | OneloopGeneral |
struct | PolePlacement |
struct | Gains3rdOrder |
struct | Gains2ndOrder |
struct | CF4_t |
struct | CF2_t |
struct | Oneloop_CF_t |
struct | notch_axis_t |
struct | Oneloop_notch_t |
Macros | |
#define | ANDI_NUM_ACT COMMANDS_NB_REAL |
#define | ANDI_NUM_VIRTUAL_ACT COMMANDS_NB_VIRTUAL |
#define | ANDI_NUM_VIRTUAL_ACT 2 |
#define | ANDI_NUM_ACT_TOT (ANDI_NUM_ACT + ANDI_NUM_VIRTUAL_ACT) |
#define | ANDI_OUTPUTS 6 |
#define | ANDI_G_SCALING 1000.0f |
#define | CTRL_ANDI 0 |
Control types. More... | |
#define | CTRL_INDI 1 |
Functions | |
void | oneloop_andi_init (void) |
Init function of Oneloop ANDI controller More... | |
void | oneloop_andi_enter (bool half_loop_sp, int ctrl_type) |
Function that resets important values upon engaging Oneloop ANDI. More... | |
void | oneloop_andi_set_failsafe_setpoint (void) |
void | oneloop_andi_run (bool in_flight, bool half_loop, struct FloatVect3 PSA_des, int rm_order_h, int rm_order_v) |
Main function that runs the controller and performs control allocation. More... | |
void | oneloop_andi_RM (bool half_loop, struct FloatVect3 PSA_des, int rm_order_h, int rm_order_v, bool in_flight_oneloop) |
Function to generate the reference signals for the oneloop controller. More... | |
void | oneloop_andi_read_rc (bool in_flight, bool in_carefree, bool coordinated_turn) |
void | oneloop_from_nav (bool in_flight) |
Function that maps navigation inputs to the oneloop controller for the generated autopilot. More... | |
void | guidance_set_min_max_airspeed (float min_airspeed, float max_airspeed) |
Definition in file oneloop_andi.h.
struct guidance_indi_hybrid_params |
Definition at line 75 of file guidance_indi_hybrid.h.
struct OneloopGuidanceRef |
Definition at line 101 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | acc[3] | |
float | jer[3] | |
float | pos[3] | |
float | vel[3] |
struct OneloopGuidanceState |
Definition at line 108 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | acc[3] | |
float | pos[3] | |
float | vel[3] |
struct OneloopStabilizationRef |
Definition at line 114 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | att[3] | |
float | att_2d[3] | |
float | att_3d[3] | |
float | att_d[3] |
struct OneloopStabilizationState |
Definition at line 121 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | att[3] | |
float | att_2d[3] | |
float | att_d[3] |
struct OneloopGeneral |
Definition at line 126 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
int | ctrl_type | |
struct OneloopGuidanceRef | gui_ref | |
struct OneloopGuidanceState | gui_state | |
bool | half_loop | |
struct OneloopStabilizationRef | sta_ref | |
struct OneloopStabilizationState | sta_state |
struct PolePlacement |
Definition at line 138 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | omega_n | |
float | p3 | |
float | zeta |
struct Gains3rdOrder |
Definition at line 143 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | k1[3] | |
float | k2[3] | |
float | k3[3] |
struct Gains2ndOrder |
Definition at line 148 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | k2 | |
float | k3 |
struct CF4_t |
Definition at line 153 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | feedback | |
Butterworth4LowPass | feedback_filt | |
float | freq | |
float | freq_set | |
float | model | |
Butterworth4LowPass | model_filt | |
float | out | |
float | tau |
struct CF2_t |
Definition at line 163 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | feedback | |
Butterworth2LowPass | feedback_filt | |
float | freq | |
float | freq_set | |
float | model | |
Butterworth2LowPass | model_filt | |
float | out | |
float | tau |
struct Oneloop_CF_t |
struct notch_axis_t |
Definition at line 186 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
float | bandwidth | |
struct SecondOrderNotchFilter | filter | |
float | freq |
struct Oneloop_notch_t |
Definition at line 191 of file oneloop_andi.h.
Data Fields | ||
---|---|---|
struct notch_axis_t | pitch | |
struct notch_axis_t | roll | |
struct notch_axis_t | yaw |
#define ANDI_G_SCALING 1000.0f |
Definition at line 56 of file oneloop_andi.h.
#define ANDI_NUM_ACT COMMANDS_NB_REAL |
Definition at line 37 of file oneloop_andi.h.
#define ANDI_NUM_ACT_TOT (ANDI_NUM_ACT + ANDI_NUM_VIRTUAL_ACT) |
Definition at line 50 of file oneloop_andi.h.
#define ANDI_NUM_VIRTUAL_ACT COMMANDS_NB_VIRTUAL |
Definition at line 47 of file oneloop_andi.h.
#define ANDI_NUM_VIRTUAL_ACT 2 |
Definition at line 47 of file oneloop_andi.h.
#define ANDI_OUTPUTS 6 |
Definition at line 54 of file oneloop_andi.h.
#define CTRL_ANDI 0 |
Control types.
Definition at line 59 of file oneloop_andi.h.
#define CTRL_INDI 1 |
Definition at line 60 of file oneloop_andi.h.
void guidance_set_min_max_airspeed | ( | float | min_airspeed, |
float | max_airspeed | ||
) |
Definition at line 414 of file guidance_indi_hybrid.c.
References max_airspeed, max_as, and min_as.
Referenced by rotwing_state_periodic().
void oneloop_andi_enter | ( | bool | half_loop_sp, |
int | ctrl_type | ||
) |
Function that resets important values upon engaging Oneloop ANDI.
FIXME: Ideally we should distinguish between the "stabilization" and "guidance" needs because it is unlikely to switch stabilization in flight, and there are multiple modes that use (the same) stabilization. Resetting the controller is not so nice when you are flying.
Definition at line 1456 of file oneloop_andi.c.
References ANDI_OUTPUTS, OneloopStabilizationRef::att, OneloopStabilizationRef::att_2d, OneloopStabilizationRef::att_3d, OneloopStabilizationRef::att_d, bwls_1l, calc_normalization(), OneloopGeneral::ctrl_type, EFF_MAT_G, ele_min, eulers_zxy, eulers_zxy_des, float_vect_zero(), G1G2_oneloop(), OneloopGeneral::half_loop, init_controller(), init_filter(), nav_target, nav_target_new, oneloop_andi, FloatEulers::phi, FloatEulers::psi, psi_des_deg, psi_des_rad, reinit_all_cf(), OneloopGeneral::sta_ref, and FloatEulers::theta.
Referenced by chirp_call(), guidance_h_run_enter(), oneloop_from_nav(), and stabilization_attitude_enter().
void oneloop_andi_init | ( | void | ) |
Init function of Oneloop ANDI controller
Definition at line 1401 of file oneloop_andi.c.
References act_dynamics, actuator_state_1l, andi_du, andi_du_n, ANDI_NUM_ACT, ANDI_NUM_ACT_TOT, ANDI_OUTPUTS, andi_u, OneloopStabilizationRef::att, OneloopStabilizationRef::att_2d, OneloopStabilizationRef::att_3d, OneloopStabilizationRef::att_d, bwls_1l, calc_normalization(), CTRL_ANDI, OneloopGeneral::ctrl_type, DefaultPeriodic, EFF_MAT_G, eulers_zxy_des, float_vect_zero(), G1G2_oneloop(), OneloopGeneral::half_loop, init_all_cf(), init_controller(), init_filter(), init_poles(), nav_target, nav_target_new, nu, nu_n, oneloop_andi, FloatEulers::phi, positive_non_zero(), FloatEulers::psi, register_periodic_telemetry(), send_eff_mat_guid_oneloop_andi(), send_eff_mat_stab_oneloop_andi(), send_guidance_oneloop_andi(), send_oneloop_andi(), send_oneloop_debug(), send_wls_u_oneloop(), send_wls_v_oneloop(), OneloopGeneral::sta_ref, and FloatEulers::theta.
void oneloop_andi_read_rc | ( | bool | in_flight, |
bool | in_carefree, | ||
bool | coordinated_turn | ||
) |
void oneloop_andi_RM | ( | bool | half_loop, |
struct FloatVect3 | PSA_des, | ||
int | rm_order_h, | ||
int | rm_order_v, | ||
bool | in_flight_oneloop | ||
) |
Function to generate the reference signals for the oneloop controller.
half_loop | In half-loop mode the controller is used for stabilization only |
PSA_des | Desired position/speed/acceleration |
rm_order_h | Order of the reference model for horizontal guidance |
rm_order_v | Order of the reference model for vertical guidance |
Definition at line 1492 of file oneloop_andi.c.
References A_chirp, a_thrust, OneloopGuidanceRef::acc, OneloopGuidanceState::acc, actuator_state_1l, ANDI_NUM_ACT, OneloopStabilizationRef::att, OneloopStabilizationRef::att_2d, OneloopStabilizationRef::att_3d, OneloopStabilizationRef::att_d, bwls_1l, chirp_axis, chirp_call(), chirp_first_call, chirp_on, dt_1l, eulers_zxy, eulers_zxy_des, f0_chirp, f1_chirp, float_vect_copy(), float_vect_norm(), float_vect_zero(), OneloopGeneral::gui_ref, OneloopGeneral::gui_state, heading_manual, OneloopGuidanceRef::jer, Gains3rdOrder::k1, Gains3rdOrder::k2, Gains3rdOrder::k3, k_att_rm, k_pos_rm, max_a_nav, max_j_ang, max_j_nav, MAX_PPRZ, max_r, max_v_nav, max_v_nav_v, nav_target, nav_target_new, oneloop_andi, ONELOOP_ANDI_MAX_PHI, ONELOOP_ANDI_MAX_THETA, oneloop_andi_sideslip(), p_ref_0, FloatEulers::phi, OneloopGuidanceRef::pos, OneloopGuidanceState::pos, FloatEulers::psi, psi_des_deg, psi_des_rad, psi_vec, radio_control_get(), RADIO_PITCH, RADIO_ROLL, RADIO_THROTTLE, RADIO_YAW, ratio_u_un, ratio_vn_v, reshape_wind(), rm_1st_pos(), rm_2nd_pos(), rm_3rd_attitude(), rm_3rd_pos(), RW_aD, OneloopGeneral::sta_ref, t_0_chirp, t_chirp, FloatEulers::theta, time_elapsed_chirp, use_increment, OneloopGuidanceRef::vel, OneloopGuidanceState::vel, WLS_one_p, WLS_t::Wv, Wv_backup, FloatVect3::x, FloatVect3::y, yaw_stick_in_auto, and FloatVect3::z.
Referenced by oneloop_andi_run().
void oneloop_andi_run | ( | bool | in_flight, |
bool | half_loop, | ||
struct FloatVect3 | PSA_des, | ||
int | rm_order_h, | ||
int | rm_order_v | ||
) |
Main function that runs the controller and performs control allocation.
half_loop | In half-loop mode the controller is used for stabilization only |
in_flight | The drone is in flight |
PSA_des | Desired position/speed/acceleration |
rm_order_h | Order of the reference model for horizontal guidance |
rm_order_v | Order of the reference model for vertical guidance |
Definition at line 1629 of file oneloop_andi.c.
References a_thrust, OneloopGuidanceRef::acc, OneloopGuidanceState::acc, act_dynamics, act_max, act_min, actuator_state_1l, andi_du, andi_du_n, ANDI_NUM_ACT, ANDI_NUM_ACT_TOT, ANDI_OUTPUTS, andi_u, AP_MODE_ATTITUDE_DIRECT, OneloopStabilizationRef::att, OneloopStabilizationState::att, OneloopStabilizationRef::att_2d, OneloopStabilizationState::att_2d, OneloopStabilizationRef::att_3d, OneloopStabilizationRef::att_d, OneloopStabilizationState::att_d, autopilot, Oneloop_CF_t::ax, Oneloop_CF_t::ay, Oneloop_CF_t::az, bwls_1l, calc_normalization(), cf, chirp_on, Stabilization::cmd, commands, CTRL_ANDI, CTRL_INDI, ctrl_off, OneloopGeneral::ctrl_type, RW_skew::deg, ec_3rd(), ec_3rd_att(), ec_3rd_pos(), EFF_MAT_G, RW_Model::ele_pref, eulers_zxy, eulers_zxy_des, rotwing_state_t::fail_pusher_motor, filt_veloc_D, filt_veloc_E, filt_veloc_N, float_eulers_of_quat_zxy(), float_vect_copy(), float_vect_sum(), G1G2_oneloop(), g2_ff, G2_RW, get_act_state_oneloop(), OneloopGeneral::gui_ref, OneloopGeneral::gui_state, heading_manual, rotwing_state_t::hover_motors_enabled, init_controller(), OneloopGuidanceRef::jer, Gains3rdOrder::k1, Gains3rdOrder::k2, Gains3rdOrder::k3, k_att_e, k_att_e_indi, k_pos_e, k_pos_e_indi, max_a_nav, max_j_ang, max_j_nav, MAX_PPRZ, max_v_nav, pprz_autopilot::mode, normalize_nu(), nu, num_thrusters_oneloop, SecondOrderLowPass::o, oneloop_andi, ONELOOP_ANDI_DEBUG_MODE, ONELOOP_ANDI_MAX_PHI, ONELOOP_ANDI_MAX_THETA, oneloop_andi_propagate_filters(), oneloop_andi_RM(), CF4_t::out, CF2_t::out, Oneloop_CF_t::p, Oneloop_CF_t::p_dot, FloatEulers::phi, pitch_pref, OneloopGuidanceRef::pos, OneloopGuidanceState::pos, FloatEulers::psi, psi_des_deg, psi_des_rad, Oneloop_CF_t::q, Oneloop_CF_t::q_dot, Oneloop_CF_t::r, Oneloop_CF_t::r_dot, RADIO_AUX4, RADIO_AUX5, radio_control, ratio_u_un, rotwing_state, RW, RW_Model::skew, OneloopGeneral::sta_ref, OneloopGeneral::sta_state, stabilization, stateGetNedToBodyQuat_f(), stateGetPositionNed_f(), FloatEulers::theta, theta_pref_max, pprz_autopilot::throttle, WLS_t::u, WLS_t::u_max, WLS_t::u_min, u_pref, WLS_t::u_pref, use_increment, RadioControl::values, OneloopGuidanceRef::vel, OneloopGuidanceState::vel, wls_alloc(), WLS_one_p, WLS_t::Wu, Wu_backup, Wu_quad_motors_fwd, NedCoor_f::x, NedCoor_f::y, and NedCoor_f::z.
Referenced by oneloop_from_nav(), and stabilization_attitude_run().
void oneloop_andi_set_failsafe_setpoint | ( | void | ) |
void oneloop_from_nav | ( | bool | in_flight | ) |
Function that maps navigation inputs to the oneloop controller for the generated autopilot.
Definition at line 2004 of file oneloop_andi.c.
References RotorcraftNavigation::climb, OneloopGeneral::ctrl_type, nav, RotorcraftNavigation::nav_altitude, NAV_SETPOINT_MODE_POS, NAV_SETPOINT_MODE_SPEED, NAV_VERTICAL_MODE_ALT, NAV_VERTICAL_MODE_CLIMB, oneloop_andi, oneloop_andi_enter(), oneloop_andi_run(), POS_BFP_OF_REAL, POS_FLOAT_OF_BFP, RotorcraftNavigation::setpoint_mode, RotorcraftNavigation::speed, SPEED_BFP_OF_REAL, SPEED_FLOAT_OF_BFP, stateGetPositionNed_f(), RotorcraftNavigation::target, RotorcraftNavigation::vertical_mode, FloatVect3::x, NedCoor_f::x, EnuCoor_f::x, FloatVect3::y, NedCoor_f::y, EnuCoor_f::y, FloatVect3::z, and NedCoor_f::z.
|
extern |
Definition at line 427 of file oneloop_andi.c.
Referenced by oneloop_andi_RM().
|
extern |
|
extern |
Definition at line 352 of file oneloop_andi.c.
Referenced by calc_G1_G2_RW(), calc_model(), get_act_state_oneloop(), oneloop_andi_init(), oneloop_andi_RM(), oneloop_andi_run(), and send_oneloop_andi().
|
extern |
Definition at line 347 of file oneloop_andi.c.
Referenced by oneloop_andi_init(), and oneloop_andi_run().
|
extern |
Definition at line 346 of file oneloop_andi.c.
Referenced by get_act_state_oneloop(), oneloop_andi_init(), and oneloop_andi_run().
|
extern |
Definition at line 412 of file oneloop_andi.c.
Referenced by calc_model(), init_all_cf(), init_cf2(), init_cf4(), oneloop_andi_propagate_filters(), oneloop_andi_run(), reinit_all_cf(), reinit_cf2(), reinit_cf4(), and send_oneloop_debug().
|
extern |
Definition at line 428 of file oneloop_andi.c.
|
extern |
Definition at line 420 of file oneloop_andi.c.
Referenced by chirp_call(), oneloop_andi_RM(), and oneloop_andi_run().
|
extern |
Definition at line 376 of file oneloop_andi.c.
Referenced by G1G2_oneloop(), and oneloop_andi_run().
|
extern |
Definition at line 354 of file oneloop_andi.c.
Referenced by oneloop_andi_enter(), oneloop_andi_init(), oneloop_andi_RM(), oneloop_andi_run(), and send_oneloop_andi().
|
extern |
Definition at line 424 of file oneloop_andi.c.
Referenced by oneloop_andi_RM().
|
extern |
Definition at line 425 of file oneloop_andi.c.
Referenced by oneloop_andi_RM().
|
extern |
Definition at line 280 of file oneloop_andi.c.
Referenced by oneloop_andi_sideslip().
|
extern |
|
extern |
Definition at line 244 of file guidance_indi_hybrid.c.
Referenced by reshape_wind(), rotwing_state_periodic(), and send_rotating_wing_state().
|
extern |
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().
|
extern |
Definition at line 369 of file oneloop_andi.c.
Referenced by oneloop_andi_RM(), and oneloop_andi_run().
|
extern |
Definition at line 341 of file oneloop_andi.c.
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), and oneloop_andi_run().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), and oneloop_andi_RM().
|
extern |
|
extern |
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), and oneloop_andi_run().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), oneloop_andi_RM(), and reshape_wind().
|
extern |
Definition at line 270 of file oneloop_andi.c.
Referenced by guidance_set_min_max_airspeed(), and reshape_wind().
|
extern |
Definition at line 349 of file oneloop_andi.c.
Referenced by normalize_nu(), oneloop_andi_init(), and oneloop_andi_run().
|
extern |
Definition at line 330 of file oneloop_andi.c.
Referenced by chirp_call(), oneloop_andi_enter(), oneloop_andi_init(), oneloop_andi_RM(), oneloop_andi_run(), oneloop_from_nav(), reshape_wind(), send_guidance_oneloop_andi(), send_oneloop_andi(), and stabilization_attitude_run().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), init_poles(), and init_poles_pos().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), init_poles(), and init_poles_pos().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), init_poles(), and init_poles_att().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), init_poles(), init_poles_att(), and init_poles_pos().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), init_poles(), and init_poles_att().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), init_poles(), and init_poles_att().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), init_poles(), and init_poles_pos().
|
extern |
Definition at line 429 of file oneloop_andi.c.
Referenced by init_controller(), init_poles(), and init_poles_pos().
|
extern |
Definition at line 363 of file oneloop_andi.c.
Referenced by oneloop_andi_enter(), oneloop_andi_RM(), and oneloop_andi_run().
|
extern |
Definition at line 362 of file oneloop_andi.c.
Referenced by oneloop_andi_enter(), oneloop_andi_RM(), and oneloop_andi_run().
|
extern |
Definition at line 426 of file oneloop_andi.c.
Referenced by chirp_call(), chirp_pos(), and oneloop_andi_RM().
|
extern |
Definition at line 342 of file oneloop_andi.c.
Referenced by indi_apply_actuator_models().
|
extern |
Definition at line 374 of file oneloop_andi.c.
Referenced by oneloop_andi_RM().