Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
oneloop_andi.h File Reference
+ Include dependency graph for oneloop_andi.h:
+ This graph shows which files directly or indirectly include this file:

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)
 

Variables

bool ctrl_off
 
float act_state_filt_vect_1l [ANDI_NUM_ACT]
 
float actuator_state_1l [ANDI_NUM_ACT]
 
float nu [6]
 
float g1g2_1l [ANDI_OUTPUTS][ANDI_NUM_ACT_TOT]
 
float andi_u [ANDI_NUM_ACT_TOT]
 
float andi_du [ANDI_NUM_ACT_TOT]
 
float psi_des_deg
 
bool heading_manual
 
bool yaw_stick_in_auto
 
float fwd_sideslip_gain
 
struct FloatEulers eulers_zxy_des
 
float psi_des_rad
 
float k_as
 
float max_as
 
float gi_unbounded_airspeed_sp
 
bool chirp_on
 
float f0_chirp
 
float f1_chirp
 
float t_chirp
 
float A_chirp
 
int8_t chirp_axis
 
struct guidance_indi_hybrid_params gih_params
 
struct OneloopGeneral oneloop_andi
 
struct Oneloop_CF_t cf
 
int16_t temp_pitch
 
struct PolePlacement p_att_e
 
struct PolePlacement p_att_rm
 
struct PolePlacement p_pos_e
 
struct PolePlacement p_pos_rm
 
struct PolePlacement p_alt_e
 
struct PolePlacement p_alt_rm
 
struct PolePlacement p_head_e
 
struct PolePlacement p_head_rm
 
struct Gains3rdOrder k_att_e
 
struct Gains3rdOrder k_att_rm
 
struct Gains2ndOrder k_head_e
 
struct Gains2ndOrder k_head_rm
 
struct Gains3rdOrder k_pos_e
 
struct Gains3rdOrder k_pos_rm
 

Detailed Description

Author
Tomaso De Ponti tmlde.nosp@m.pont.nosp@m.i@tud.nosp@m.elft.nosp@m..nl One loop (Guidance + Stabilization) ANDI controller for rotorcrafts
Tomaso De Ponti tmlde.nosp@m.pont.nosp@m.i@tud.nosp@m.elft.nosp@m..nl One loop (Guidance + Stabilization) ANDI controller for the rotating wing drone RW3C

Definition in file oneloop_andi.h.


Data Structure Documentation

◆ guidance_indi_hybrid_params

struct guidance_indi_hybrid_params

Definition at line 75 of file guidance_indi_hybrid.h.

Data Fields
float climb_vspeed_fwd
float climb_vspeed_quad
float descend_vspeed_fwd
float descend_vspeed_quad
float heading_bank_gain
float liftd_asq
float liftd_p50
float liftd_p80
float max_airspeed
float min_airspeed
float pos_gain
float pos_gainz
float speed_gain
float speed_gainz
float stall_protect_gain

◆ OneloopGuidanceRef

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]

◆ OneloopGuidanceState

struct OneloopGuidanceState

Definition at line 108 of file oneloop_andi.h.

Data Fields
float acc[3]
float pos[3]
float vel[3]

◆ OneloopStabilizationRef

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]

◆ OneloopStabilizationState

struct OneloopStabilizationState

Definition at line 121 of file oneloop_andi.h.

Data Fields
float att[3]
float att_2d[3]
float att_d[3]

◆ OneloopGeneral

struct OneloopGeneral

Definition at line 126 of file oneloop_andi.h.

+ Collaboration diagram for OneloopGeneral:
Data Fields
int ctrl_type
struct OneloopGuidanceRef gui_ref
struct OneloopGuidanceState gui_state
bool half_loop
struct OneloopStabilizationRef sta_ref
struct OneloopStabilizationState sta_state

◆ PolePlacement

struct PolePlacement

Definition at line 138 of file oneloop_andi.h.

Data Fields
float omega_n
float p3
float zeta

◆ Gains3rdOrder

struct Gains3rdOrder

Definition at line 143 of file oneloop_andi.h.

Data Fields
float k1[3]
float k2[3]
float k3[3]

◆ Gains2ndOrder

struct Gains2ndOrder

Definition at line 148 of file oneloop_andi.h.

Data Fields
float k2
float k3

◆ CF4_t

struct CF4_t

Definition at line 153 of file oneloop_andi.h.

+ Collaboration diagram for CF4_t:
Data Fields
float feedback
Butterworth4LowPass feedback_filt
float freq
float freq_set
float model
Butterworth4LowPass model_filt
float out
float tau

◆ CF2_t

struct CF2_t

Definition at line 163 of file oneloop_andi.h.

+ Collaboration diagram for CF2_t:
Data Fields
float feedback
Butterworth2LowPass feedback_filt
float freq
float freq_set
float model
Butterworth2LowPass model_filt
float out
float tau

◆ Oneloop_CF_t

struct Oneloop_CF_t

Definition at line 174 of file oneloop_andi.h.

+ Collaboration diagram for Oneloop_CF_t:
Data Fields
struct CF2_t ax
struct CF2_t ay
struct CF2_t az
struct CF2_t p
struct CF4_t p_dot
struct CF2_t q
struct CF4_t q_dot
struct CF2_t r
struct CF2_t r_dot

◆ notch_axis_t

struct notch_axis_t

Definition at line 186 of file oneloop_andi.h.

+ Collaboration diagram for notch_axis_t:
Data Fields
float bandwidth
struct SecondOrderNotchFilter filter
float freq

◆ Oneloop_notch_t

struct Oneloop_notch_t

Definition at line 191 of file oneloop_andi.h.

+ Collaboration diagram for Oneloop_notch_t:
Data Fields
struct notch_axis_t pitch
struct notch_axis_t roll
struct notch_axis_t yaw

Macro Definition Documentation

◆ ANDI_G_SCALING

#define ANDI_G_SCALING   1000.0f

Definition at line 56 of file oneloop_andi.h.

◆ ANDI_NUM_ACT

#define ANDI_NUM_ACT   COMMANDS_NB_REAL

Definition at line 37 of file oneloop_andi.h.

◆ ANDI_NUM_ACT_TOT

#define ANDI_NUM_ACT_TOT   (ANDI_NUM_ACT + ANDI_NUM_VIRTUAL_ACT)

Definition at line 50 of file oneloop_andi.h.

◆ ANDI_NUM_VIRTUAL_ACT [1/2]

#define ANDI_NUM_VIRTUAL_ACT   COMMANDS_NB_VIRTUAL

Definition at line 47 of file oneloop_andi.h.

◆ ANDI_NUM_VIRTUAL_ACT [2/2]

#define ANDI_NUM_VIRTUAL_ACT   2

Definition at line 47 of file oneloop_andi.h.

◆ ANDI_OUTPUTS

#define ANDI_OUTPUTS   6

Definition at line 54 of file oneloop_andi.h.

◆ CTRL_ANDI

#define CTRL_ANDI   0

Control types.

Definition at line 59 of file oneloop_andi.h.

◆ CTRL_INDI

#define CTRL_INDI   1

Definition at line 60 of file oneloop_andi.h.

Function Documentation

◆ guidance_set_min_max_airspeed()

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().

+ Here is the caller graph for this function:

◆ oneloop_andi_enter()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ oneloop_andi_init()

◆ oneloop_andi_read_rc()

void oneloop_andi_read_rc ( bool  in_flight,
bool  in_carefree,
bool  coordinated_turn 
)

◆ oneloop_andi_RM()

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.

Parameters
half_loopIn half-loop mode the controller is used for stabilization only
PSA_desDesired position/speed/acceleration
rm_order_hOrder of the reference model for horizontal guidance
rm_order_vOrder 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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.

Parameters
half_loopIn half-loop mode the controller is used for stabilization only
in_flightThe drone is in flight
PSA_desDesired position/speed/acceleration
rm_order_hOrder of the reference model for horizontal guidance
rm_order_vOrder 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ oneloop_andi_set_failsafe_setpoint()

void oneloop_andi_set_failsafe_setpoint ( void  )

◆ oneloop_from_nav()

Variable Documentation

◆ A_chirp

float A_chirp
extern

Definition at line 427 of file oneloop_andi.c.

Referenced by oneloop_andi_RM().

◆ act_state_filt_vect_1l

float act_state_filt_vect_1l[ANDI_NUM_ACT]
extern

◆ actuator_state_1l

◆ andi_du

float andi_du[ANDI_NUM_ACT_TOT]
extern

Definition at line 347 of file oneloop_andi.c.

Referenced by oneloop_andi_init(), and oneloop_andi_run().

◆ andi_u

float andi_u[ANDI_NUM_ACT_TOT]
extern

Definition at line 346 of file oneloop_andi.c.

Referenced by get_act_state_oneloop(), oneloop_andi_init(), and oneloop_andi_run().

◆ cf

◆ chirp_axis

int8_t chirp_axis
extern

Definition at line 428 of file oneloop_andi.c.

◆ chirp_on

bool chirp_on
extern

Definition at line 420 of file oneloop_andi.c.

Referenced by chirp_call(), oneloop_andi_RM(), and oneloop_andi_run().

◆ ctrl_off

bool ctrl_off
extern

Definition at line 376 of file oneloop_andi.c.

Referenced by G1G2_oneloop(), and oneloop_andi_run().

◆ eulers_zxy_des

struct FloatEulers eulers_zxy_des
extern

◆ f0_chirp

float f0_chirp
extern

Definition at line 424 of file oneloop_andi.c.

Referenced by oneloop_andi_RM().

◆ f1_chirp

float f1_chirp
extern

Definition at line 425 of file oneloop_andi.c.

Referenced by oneloop_andi_RM().

◆ fwd_sideslip_gain

float fwd_sideslip_gain
extern

Definition at line 280 of file oneloop_andi.c.

Referenced by oneloop_andi_sideslip().

◆ g1g2_1l

float g1g2_1l[ANDI_OUTPUTS][ANDI_NUM_ACT_TOT]
extern

◆ gi_unbounded_airspeed_sp

float gi_unbounded_airspeed_sp
extern

◆ gih_params

struct guidance_indi_hybrid_params gih_params
extern

◆ heading_manual

bool heading_manual
extern

Definition at line 369 of file oneloop_andi.c.

Referenced by oneloop_andi_RM(), and oneloop_andi_run().

◆ k_as

float k_as
extern

Definition at line 341 of file oneloop_andi.c.

◆ k_att_e

struct Gains3rdOrder k_att_e
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), and oneloop_andi_run().

◆ k_att_rm

struct Gains3rdOrder k_att_rm
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), and oneloop_andi_RM().

◆ k_head_e

struct Gains2ndOrder k_head_e
extern

◆ k_head_rm

struct Gains2ndOrder k_head_rm
extern

◆ k_pos_e

struct Gains3rdOrder k_pos_e
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), and oneloop_andi_run().

◆ k_pos_rm

struct Gains3rdOrder k_pos_rm
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), oneloop_andi_RM(), and reshape_wind().

◆ max_as

float max_as
extern

Definition at line 270 of file oneloop_andi.c.

Referenced by guidance_set_min_max_airspeed(), and reshape_wind().

◆ nu

float nu[6]
extern

Definition at line 349 of file oneloop_andi.c.

Referenced by normalize_nu(), oneloop_andi_init(), and oneloop_andi_run().

◆ oneloop_andi

◆ p_alt_e

struct PolePlacement p_alt_e
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), init_poles(), and init_poles_pos().

◆ p_alt_rm

struct PolePlacement p_alt_rm
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), init_poles(), and init_poles_pos().

◆ p_att_e

struct PolePlacement p_att_e
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), init_poles(), and init_poles_att().

◆ p_att_rm

struct PolePlacement p_att_rm
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), init_poles(), init_poles_att(), and init_poles_pos().

◆ p_head_e

struct PolePlacement p_head_e
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), init_poles(), and init_poles_att().

◆ p_head_rm

struct PolePlacement p_head_rm
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), init_poles(), and init_poles_att().

◆ p_pos_e

struct PolePlacement p_pos_e
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), init_poles(), and init_poles_pos().

◆ p_pos_rm

struct PolePlacement p_pos_rm
extern

Definition at line 429 of file oneloop_andi.c.

Referenced by init_controller(), init_poles(), and init_poles_pos().

◆ psi_des_deg

float psi_des_deg
extern

Definition at line 363 of file oneloop_andi.c.

Referenced by oneloop_andi_enter(), oneloop_andi_RM(), and oneloop_andi_run().

◆ psi_des_rad

float psi_des_rad
extern

Definition at line 362 of file oneloop_andi.c.

Referenced by oneloop_andi_enter(), oneloop_andi_RM(), and oneloop_andi_run().

◆ t_chirp

float t_chirp
extern

Definition at line 426 of file oneloop_andi.c.

Referenced by chirp_call(), chirp_pos(), and oneloop_andi_RM().

◆ temp_pitch

int16_t temp_pitch
extern

Definition at line 342 of file oneloop_andi.c.

Referenced by indi_apply_actuator_models().

◆ yaw_stick_in_auto

bool yaw_stick_in_auto
extern

Definition at line 374 of file oneloop_andi.c.

Referenced by oneloop_andi_RM().