Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
guidance_hybrid.c File Reference

Guidance controllers (horizontal and vertical) for Hybrid UAV configurations. More...

+ Include dependency graph for guidance_hybrid.c:

Go to the source code of this file.

Macros

#define MAX_AIRSPEED   15
 
#define INT32_ANGLE_HIGH_RES_FRAC   18
 
#define INT32_ANGLE_HIGH_RES_NORMALIZE(_a)
 

Functions

static void send_hybrid_guidance (struct transport_tx *trans, struct link_device *dev)
 
void guidance_hybrid_init (void)
 Hybrid Guidance Initialization function. More...
 
void guidance_hybrid_run (void)
 Runs the Hybrid Guidance main functions. More...
 
void guidance_hybrid_reset_heading (struct Int32Eulers *sp_cmd)
 Description. More...
 
void guidance_hybrid_airspeed_to_attitude (struct Int32Eulers *ypr_sp)
 Convert a required airspeed to a certain attitude for the Quadshot. More...
 
void guidance_hybrid_position_to_airspeed (void)
 Description. More...
 
void guidance_hybrid_determine_wind_estimate (void)
 Description. More...
 
void guidance_hybrid_set_cmd_i (struct Int32Eulers *sp_cmd)
 Creates the attitude set-points from an orientation vector. More...
 
void guidance_hybrid_vertical (void)
 Description. More...
 

Variables

int32_t guidance_hybrid_norm_ref_airspeed
 
float alt_pitch_gain = 0.3
 
int32_t max_airspeed = MAX_AIRSPEED
 
int32_t wind_gain
 
int32_t horizontal_speed_gain
 
float max_turn_bank
 
float turn_bank_gain
 
static struct Int32Eulers guidance_hybrid_ypr_sp
 
static struct Int32Vect2 guidance_hybrid_airspeed_sp
 
static struct Int32Vect2 guidance_h_pos_err
 
static struct Int32Vect2 guidance_hybrid_airspeed_ref
 
static struct Int32Vect2 wind_estimate
 
static struct Int32Vect2 wind_estimate_high_res
 
static struct Int32Vect2 guidance_hybrid_ref_airspeed
 
static int32_t norm_sp_airspeed_disp
 
static int32_t heading_diff_disp
 
static int32_t omega_disp
 
static int32_t high_res_psi
 
static int32_t airspeed_sp_heading_disp
 
static bool guidance_hovering
 
bool force_forward_flight
 
static int32_t v_control_pitch
 

Detailed Description

Guidance controllers (horizontal and vertical) for Hybrid UAV configurations.

Functionality: 1) hover with (helicopter) thrust vectoring and align the heading with the wind vector. 2) Forward flight with using pitch and a bit of thrust to control altitude and heading to control the velocity vector 3) Transition between the two, with the possibility to fly at any airspeed

Definition in file guidance_hybrid.c.

Macro Definition Documentation

#define INT32_ANGLE_HIGH_RES_FRAC   18
#define INT32_ANGLE_HIGH_RES_NORMALIZE (   _a)
Value:
{ \
}
#define INT32_ANGLE_HIGH_RES_FRAC
#define INT32_ANGLE_FRAC
#define INT32_ANGLE_2_PI
#define INT32_ANGLE_PI

Definition at line 124 of file guidance_hybrid.c.

Referenced by guidance_hybrid_airspeed_to_attitude().

#define MAX_AIRSPEED   15

Definition at line 44 of file guidance_hybrid.c.

Function Documentation

void guidance_hybrid_airspeed_to_attitude ( struct Int32Eulers ypr_sp)

Convert a required airspeed to a certain attitude for the Quadshot.

Convert a required airspeed to a certain attitude for the Hybrid.

if required speed is lower than 4 m/s act like a rotorcraft

if required speed is higher than 4 m/s act like a fixedwing

Definition at line 145 of file guidance_hybrid.c.

References airspeed_sp_heading_disp, ANGLE_BFP_OF_REAL, ANGLE_FLOAT_OF_BFP, FLOAT_ANGLE_NORMALIZE, guidance_hybrid_airspeed_sp, guidance_hybrid_norm_ref_airspeed, guidance_hybrid_ref_airspeed, heading_diff_disp, high_res_psi, INT32_ANGLE_FRAC, INT32_ANGLE_HIGH_RES_FRAC, INT32_ANGLE_HIGH_RES_NORMALIZE, INT32_ANGLE_PI, INT32_POS_FRAC, INT32_TRIG_FRAC, int32_vect2_norm(), max_turn_bank, norm_sp_airspeed_disp, omega_disp, Int32Eulers::phi, POS_FLOAT_OF_BFP, PPRZ_ITRIG_COS, PPRZ_ITRIG_SIN, Int32Eulers::psi, Int32Eulers::theta, turn_bank_gain, v_control_pitch, Int32Vect2::x, and Int32Vect2::y.

Referenced by guidance_hybrid_run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void guidance_hybrid_determine_wind_estimate ( void  )

Description.

Definition at line 332 of file guidance_hybrid.c.

References guidance_hybrid_ref_airspeed, INT32_VECT2_RSHIFT, stateGetSpeedNed_i(), VECT2_DIFF, wind_estimate, wind_estimate_high_res, wind_gain, Int32Vect2::x, and Int32Vect2::y.

Referenced by guidance_hybrid_run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void guidance_hybrid_reset_heading ( struct Int32Eulers sp_cmd)

Description.

Parameters
sp_cmdAdd Description

Definition at line 137 of file guidance_hybrid.c.

References guidance_hybrid_ypr_sp, high_res_psi, INT32_ANGLE_FRAC, INT32_ANGLE_HIGH_RES_FRAC, Int32Eulers::psi, and stabilization_attitude_set_rpy_setpoint_i().

Referenced by guidance_h_from_nav().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void guidance_hybrid_run ( void  )

Runs the Hybrid Guidance main functions.

Definition at line 129 of file guidance_hybrid.c.

References guidance_hybrid_airspeed_to_attitude(), guidance_hybrid_determine_wind_estimate(), guidance_hybrid_position_to_airspeed(), guidance_hybrid_set_cmd_i(), and guidance_hybrid_ypr_sp.

Referenced by guidance_h_from_nav().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void guidance_hybrid_set_cmd_i ( struct Int32Eulers sp_cmd)

Creates the attitude set-points from an orientation vector.

Parameters
sp_cmdThe orientation vector
Todo:
calc sp_quat in fixed-point

Definition at line 350 of file guidance_hybrid.c.

References ANGLE_FLOAT_OF_BFP, float_quat_of_orientation_vect(), int32_eulers_of_quat(), int32_quat_comp(), int32_quat_of_axis_angle(), Int32Eulers::phi, Int32Eulers::psi, QUAT_BFP_OF_REAL, stab_att_sp_euler, stab_att_sp_quat, Int32Eulers::theta, FloatVect3::x, FloatVect3::y, and FloatVect3::z.

Referenced by guidance_hybrid_run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void guidance_hybrid_vertical ( void  )
static void send_hybrid_guidance ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Variable Documentation

int32_t airspeed_sp_heading_disp
static

Definition at line 70 of file guidance_hybrid.c.

Referenced by guidance_hybrid_airspeed_to_attitude().

float alt_pitch_gain = 0.3

Definition at line 50 of file guidance_hybrid.c.

Referenced by guidance_hybrid_vertical().

bool force_forward_flight

Definition at line 72 of file guidance_hybrid.c.

Referenced by guidance_hybrid_init(), and guidance_hybrid_position_to_airspeed().

struct Int32Vect2 guidance_h_pos_err
static

Definition at line 60 of file guidance_hybrid.c.

Referenced by guidance_hybrid_position_to_airspeed(), and send_hybrid_guidance().

bool guidance_hovering
static

Definition at line 71 of file guidance_hybrid.c.

Referenced by guidance_hybrid_init().

struct Int32Vect2 guidance_hybrid_airspeed_ref
static

Definition at line 61 of file guidance_hybrid.c.

Referenced by guidance_hybrid_init().

struct Int32Vect2 guidance_hybrid_airspeed_sp
static
struct Int32Vect2 guidance_hybrid_ref_airspeed
static
int32_t heading_diff_disp
static

Definition at line 67 of file guidance_hybrid.c.

Referenced by guidance_hybrid_airspeed_to_attitude(), and send_hybrid_guidance().

int32_t horizontal_speed_gain

Definition at line 53 of file guidance_hybrid.c.

Referenced by guidance_hybrid_init(), and guidance_hybrid_position_to_airspeed().

int32_t max_airspeed = MAX_AIRSPEED

Definition at line 51 of file guidance_hybrid.c.

Referenced by guidance_hybrid_position_to_airspeed().

float max_turn_bank

Definition at line 54 of file guidance_hybrid.c.

Referenced by guidance_hybrid_airspeed_to_attitude(), and guidance_hybrid_init().

int32_t norm_sp_airspeed_disp
static

Definition at line 66 of file guidance_hybrid.c.

Referenced by guidance_hybrid_airspeed_to_attitude().

int32_t omega_disp
static

Definition at line 68 of file guidance_hybrid.c.

Referenced by guidance_hybrid_airspeed_to_attitude().

float turn_bank_gain

Definition at line 55 of file guidance_hybrid.c.

Referenced by guidance_hybrid_airspeed_to_attitude(), and guidance_hybrid_init().

int32_t v_control_pitch
static
struct Int32Vect2 wind_estimate_high_res
static
int32_t wind_gain