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
 

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

Variables

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
 
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
 
bool force_forward
 forward flight for hybrid nav More...
 
struct OneloopGeneral oneloop_andi
 
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 72 of file guidance_indi_hybrid.h.

Data Fields
float heading_bank_gain
float liftd_asq
float liftd_p50
float liftd_p80
float pos_gain
float pos_gainz
float speed_gain
float speed_gainz

◆ OneloopGuidanceRef

struct OneloopGuidanceRef

Definition at line 95 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 102 of file oneloop_andi.h.

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

◆ OneloopStabilizationRef

struct OneloopStabilizationRef

Definition at line 108 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 115 of file oneloop_andi.h.

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

◆ OneloopGeneral

struct OneloopGeneral

Definition at line 120 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 132 of file oneloop_andi.h.

Data Fields
float omega_n
float p3
float zeta

◆ Gains3rdOrder

struct Gains3rdOrder

Definition at line 137 of file oneloop_andi.h.

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

◆ Gains2ndOrder

struct Gains2ndOrder

Definition at line 142 of file oneloop_andi.h.

Data Fields
float k2
float k3

Macro Definition Documentation

◆ ANDI_G_SCALING

#define ANDI_G_SCALING   1000.0f

Definition at line 54 of file oneloop_andi.h.

◆ ANDI_NUM_ACT

#define ANDI_NUM_ACT   COMMANDS_NB_REAL

Definition at line 35 of file oneloop_andi.h.

◆ ANDI_NUM_ACT_TOT

#define ANDI_NUM_ACT_TOT   (ANDI_NUM_ACT + ANDI_NUM_VIRTUAL_ACT)

Definition at line 48 of file oneloop_andi.h.

◆ ANDI_NUM_VIRTUAL_ACT [1/2]

#define ANDI_NUM_VIRTUAL_ACT   COMMANDS_NB_VIRTUAL

Definition at line 45 of file oneloop_andi.h.

◆ ANDI_NUM_VIRTUAL_ACT [2/2]

#define ANDI_NUM_VIRTUAL_ACT   2

Definition at line 45 of file oneloop_andi.h.

◆ ANDI_OUTPUTS

#define ANDI_OUTPUTS   6

Definition at line 52 of file oneloop_andi.h.

◆ CTRL_ANDI

#define CTRL_ANDI   0

Control types.

Definition at line 57 of file oneloop_andi.h.

◆ CTRL_INDI

#define CTRL_INDI   1

Definition at line 58 of file oneloop_andi.h.

Function Documentation

◆ 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 1126 of file oneloop_andi.c.

References ANDI_OUTPUTS, ang_acc, OneloopStabilizationRef::att, OneloopStabilizationRef::att_2d, OneloopStabilizationRef::att_3d, OneloopStabilizationRef::att_d, calc_normalization(), OneloopGeneral::ctrl_type, eulers_zxy, eulers_zxy_des, float_vect_zero(), OneloopGeneral::half_loop, init_controller(), init_filter(), lin_acc, model_pred, nav_target, oneloop_andi, FloatEulers::phi, FloatEulers::psi, psi_des_deg, psi_des_rad, OneloopGeneral::sta_ref, sum_g1g2_1l(), 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 
)

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 1158 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_nav, MAX_PPRZ, max_r, max_v_nav, nav_target, 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, rm_1st_pos(), rm_2nd_pos(), rm_3rd_attitude(), rm_3rd_pos(), OneloopGeneral::sta_ref, t_0_chirp, t_chirp, FloatEulers::theta, time_elapsed_chirp, use_increment, OneloopGuidanceRef::vel, OneloopGuidanceState::vel, Wv, Wv_wls, 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 1279 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_G_SCALING, ANDI_NUM_ACT, ANDI_NUM_ACT_TOT, ANDI_OUTPUTS, andi_u, ang_acc, AP_MODE_ATTITUDE_DIRECT, OneloopStabilizationRef::att, OneloopStabilizationState::att, OneloopStabilizationRef::att_2d, OneloopStabilizationState::att_2d, OneloopStabilizationRef::att_3d, OneloopStabilizationRef::att_d, OneloopStabilizationState::att_d, autopilot, bwls_1l, calc_normalization(), chirp_on, Stabilization::cmd, CTRL_ANDI, CTRL_INDI, OneloopGeneral::ctrl_type, du_max_1l, du_min_1l, du_pref_1l, ec_3rd(), ec_3rd_att(), eulers_zxy, eulers_zxy_des, filt_veloc_ned, float_eulers_of_quat_zxy(), float_vect_copy(), float_vect_sum(), g1g2_1l, g2_1l, g2_ff, gamma_wls, get_act_state_oneloop(), OneloopGeneral::gui_ref, OneloopGeneral::gui_state, heading_manual, init_controller(), OneloopGuidanceRef::jer, Gains3rdOrder::k1, Gains3rdOrder::k2, Gains3rdOrder::k3, k_att_e, k_att_e_indi, k_pos_e, k_pos_e_indi, lin_acc, MAX_PPRZ, pprz_autopilot::mode, nu, num_thrusters_oneloop, number_iter, SecondOrderLowPass::o, oneloop_andi, ONELOOP_ANDI_AC_HAS_PUSHER, ONELOOP_ANDI_DEBUG_MODE, ONELOOP_ANDI_MAX_PHI, ONELOOP_ANDI_MAX_THETA, ONELOOP_ANDI_PHI_IDX, oneloop_andi_propagate_filters(), ONELOOP_ANDI_PUSHER_IDX, oneloop_andi_RM(), ONELOOP_ANDI_THETA_IDX, FloatEulers::phi, pitch_pref, OneloopGuidanceRef::pos, OneloopGuidanceState::pos, FloatEulers::psi, psi_des_deg, psi_des_rad, RADIO_AUX4, RADIO_AUX5, radio_control, rates_filt_bt, ratio_u_un, OneloopGeneral::sta_ref, OneloopGeneral::sta_state, stabilization, stateGetNedToBodyQuat_f(), stateGetPositionNed_f(), sum_g1g2_1l(), FloatEulers::theta, theta_pref_max, pprz_autopilot::throttle, u_pref, use_increment, RadioControl::values, OneloopGuidanceRef::vel, OneloopGuidanceState::vel, wls_alloc(), Wu, Wv_wls, 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 367 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 326 of file oneloop_andi.c.

Referenced by oneloop_andi_init(), and oneloop_andi_run().

◆ andi_u

◆ chirp_axis

int8_t chirp_axis
extern

Definition at line 368 of file oneloop_andi.c.

◆ chirp_on

bool chirp_on
extern

Definition at line 360 of file oneloop_andi.c.

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

◆ eulers_zxy_des

struct FloatEulers eulers_zxy_des
extern

◆ f0_chirp

float f0_chirp
extern

Definition at line 364 of file oneloop_andi.c.

Referenced by oneloop_andi_RM().

◆ f1_chirp

float f1_chirp
extern

Definition at line 365 of file oneloop_andi.c.

Referenced by oneloop_andi_RM().

◆ force_forward

bool force_forward
extern

forward flight for hybrid nav

Definition at line 122 of file guidance_indi_hybrid.c.

◆ fwd_sideslip_gain

float fwd_sideslip_gain
extern

Definition at line 284 of file oneloop_andi.c.

Referenced by oneloop_andi_sideslip().

◆ g1g2_1l

◆ gih_params

struct guidance_indi_hybrid_params gih_params
extern

Definition at line 1 of file guidance_indi_hybrid.c.

Referenced by guidance_indi_get_liftd().

◆ heading_manual

bool heading_manual
extern

Definition at line 343 of file oneloop_andi.c.

Referenced by oneloop_andi_RM(), and oneloop_andi_run().

◆ k_att_e

struct Gains3rdOrder k_att_e
extern

Definition at line 369 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 369 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 369 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 369 of file oneloop_andi.c.

Referenced by init_controller(), and oneloop_andi_RM().

◆ nu

float nu[6]
extern

Definition at line 328 of file oneloop_andi.c.

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

◆ oneloop_andi

◆ p_alt_e

struct PolePlacement p_alt_e
extern

Definition at line 369 of file oneloop_andi.c.

Referenced by init_controller(), and init_poles().

◆ p_alt_rm

struct PolePlacement p_alt_rm
extern

Definition at line 369 of file oneloop_andi.c.

Referenced by init_controller(), and init_poles().

◆ p_att_e

struct PolePlacement p_att_e
extern

Definition at line 369 of file oneloop_andi.c.

Referenced by init_controller(), and init_poles().

◆ p_att_rm

struct PolePlacement p_att_rm
extern

Definition at line 369 of file oneloop_andi.c.

Referenced by init_controller(), and init_poles().

◆ p_head_e

struct PolePlacement p_head_e
extern

Definition at line 369 of file oneloop_andi.c.

Referenced by init_controller(), and init_poles().

◆ p_head_rm

struct PolePlacement p_head_rm
extern

Definition at line 369 of file oneloop_andi.c.

Referenced by init_controller(), and init_poles().

◆ p_pos_e

struct PolePlacement p_pos_e
extern

Definition at line 369 of file oneloop_andi.c.

Referenced by init_controller(), and init_poles().

◆ p_pos_rm

struct PolePlacement p_pos_rm
extern

Definition at line 369 of file oneloop_andi.c.

Referenced by init_controller(), and init_poles().

◆ psi_des_deg

float psi_des_deg
extern

Definition at line 341 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 340 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 366 of file oneloop_andi.c.

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

◆ yaw_stick_in_auto

bool yaw_stick_in_auto
extern

Definition at line 344 of file oneloop_andi.c.

Referenced by oneloop_andi_RM().