Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
guidance_h.c File Reference

Horizontal guidance for rotorcrafts. More...

+ Include dependency graph for guidance_h.c:

Go to the source code of this file.

Macros

#define GUIDANCE_H_AGAIN   0
 
#define GUIDANCE_H_MAX_BANK   RadOfDeg(20)
 
#define MAX_POS_ERR   POS_BFP_OF_REAL(16.)
 
#define MAX_SPEED_ERR   SPEED_BFP_OF_REAL(16.)
 
#define MAX_POS_ERR_SUM   ((int32_t)(MAX_POS_ERR)<< 12)
 
#define GH_GAIN_SCALE   2
 
#define TRAJ_MAX_BANK   BFP_OF_REAL(GUIDANCE_H_MAX_BANK, INT32_ANGLE_FRAC)
 maximum bank angle: default 20 deg More...
 

Functions

static void guidance_h_update_reference (void)
 
static void guidance_h_traj_run (bool_t in_flight)
 
static void guidance_h_hover_enter (void)
 
static void guidance_h_nav_enter (void)
 
static void transition_run (void)
 
void guidance_h_init (void)
 
static void reset_guidance_reference_from_current_position (void)
 
void guidance_h_mode_changed (uint8_t new_mode)
 
void guidance_h_read_rc (bool_t in_flight)
 
void guidance_h_run (bool_t in_flight)
 

Variables

uint8_t guidance_h_mode
 
bool_t guidance_h_use_ref
 
struct Int32Vect2 guidance_h_pos_sp
 horizontal position setpoint in NED. More...
 
struct Int32Vect2 guidance_h_pos_ref
 with INT32_POS_FRAC More...
 
struct Int32Vect2 guidance_h_speed_ref
 with INT32_SPEED_FRAC More...
 
struct Int32Vect2 guidance_h_accel_ref
 with INT32_ACCEL_FRAC More...
 
struct Int32Vect2 guidance_h_pos_err
 
struct Int32Vect2 guidance_h_speed_err
 
struct Int32Vect2 guidance_h_pos_err_sum
 
struct Int32Vect2 guidance_h_nav_err
 
struct Int32Eulers guidance_h_rc_sp
 with INT32_ANGLE_FRAC More...
 
struct Int32Vect2 guidance_h_command_earth
 
struct Int32Vect2 guidance_h_stick_earth_sp
 
struct Int32Eulers guidance_h_command_body
 with INT32_ANGLE_FRAC More...
 
int32_t guidance_h_pgain
 
int32_t guidance_h_dgain
 
int32_t guidance_h_igain
 
int32_t guidance_h_again
 
int32_t transition_percentage
 
int32_t transition_theta_offset
 

Detailed Description

Horizontal guidance for rotorcrafts.

Definition in file guidance_h.c.

Macro Definition Documentation

#define GH_GAIN_SCALE   2

Definition at line 304 of file guidance_h.c.

Referenced by guidance_h_traj_run().

#define GUIDANCE_H_AGAIN   0

Definition at line 45 of file guidance_h.c.

Referenced by guidance_h_init().

#define GUIDANCE_H_MAX_BANK   RadOfDeg(20)

Definition at line 53 of file guidance_h.c.

#define MAX_POS_ERR   POS_BFP_OF_REAL(16.)

Definition at line 298 of file guidance_h.c.

Referenced by guidance_h_traj_run().

#define MAX_POS_ERR_SUM   ((int32_t)(MAX_POS_ERR)<< 12)

Definition at line 300 of file guidance_h.c.

Referenced by guidance_h_traj_run().

#define MAX_SPEED_ERR   SPEED_BFP_OF_REAL(16.)

Definition at line 299 of file guidance_h.c.

Referenced by guidance_h_traj_run().

#define TRAJ_MAX_BANK   BFP_OF_REAL(GUIDANCE_H_MAX_BANK, INT32_ANGLE_FRAC)

maximum bank angle: default 20 deg

Definition at line 307 of file guidance_h.c.

Referenced by guidance_h_traj_run().

Function Documentation

static void guidance_h_hover_enter ( void  )
static

Definition at line 365 of file guidance_h.c.

References guidance_h_pos_sp, guidance_h_rc_sp, Int32Eulers::psi, reset_guidance_reference_from_current_position(), stateGetNedToBodyEulers_i(), stateGetPositionNed_i(), and VECT2_COPY.

Referenced by guidance_h_mode_changed(), and guidance_h_run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void guidance_h_init ( void  )

Definition at line 93 of file guidance_h.c.

References GUIDANCE_H_AGAIN, GUIDANCE_H_MODE_KILL, GUIDANCE_H_USE_REF, INT_EULERS_ZERO, and INT_VECT2_ZERO.

Referenced by autopilot_init(), and main_init().

+ Here is the caller graph for this function:

static void guidance_h_nav_enter ( void  )
static

Definition at line 375 of file guidance_h.c.

References guidance_h_pos_sp, INT32_VECT2_NED_OF_ENU, nav_heading, navigation_carrot, Int32Eulers::psi, reset_guidance_reference_from_current_position(), and stateGetNedToBodyEulers_i().

Referenced by guidance_h_mode_changed(), and guidance_h_run().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void guidance_h_update_reference ( void  )
static
static void reset_guidance_reference_from_current_position ( void  )
inlinestatic

Definition at line 111 of file guidance_h.c.

References gh_set_ref(), guidance_h_accel_ref, guidance_h_pos_err_sum, guidance_h_pos_ref, guidance_h_speed_ref, INT_VECT2_ZERO, stateGetPositionNed_i(), stateGetSpeedNed_i(), and VECT2_COPY.

Referenced by guidance_h_hover_enter(), and guidance_h_nav_enter().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void transition_run ( void  )
inlinestatic

Definition at line 385 of file guidance_h.c.

References ANGLE_BFP_OF_REAL, INT32_ANGLE_FRAC, INT32_PERCENTAGE_FRAC, INT_MULT_RSHIFT, transition_percentage, and transition_theta_offset.

Referenced by guidance_h_run().

+ Here is the caller graph for this function:

Variable Documentation

int32_t guidance_h_again

Definition at line 80 of file guidance_h.c.

Referenced by guidance_h_traj_run().

struct Int32Eulers guidance_h_command_body

with INT32_ANGLE_FRAC

Definition at line 75 of file guidance_h.c.

Referenced by guidance_h_run(), and guidance_h_traj_run().

struct Int32Vect2 guidance_h_command_earth

Definition at line 73 of file guidance_h.c.

Referenced by guidance_h_traj_run().

int32_t guidance_h_dgain

Definition at line 78 of file guidance_h.c.

Referenced by guidance_h_traj_run().

int32_t guidance_h_igain

Definition at line 79 of file guidance_h.c.

Referenced by guidance_h_traj_run().

struct Int32Vect2 guidance_h_nav_err

Definition at line 70 of file guidance_h.c.

int32_t guidance_h_pgain

Definition at line 77 of file guidance_h.c.

Referenced by guidance_h_traj_run().

struct Int32Vect2 guidance_h_pos_err

Definition at line 67 of file guidance_h.c.

Referenced by guidance_h_traj_run().

struct Int32Vect2 guidance_h_pos_err_sum
struct Int32Vect2 guidance_h_pos_sp

horizontal position setpoint in NED.

fixed point representation: Q23.8 accuracy 0.0039, range 8388km

Definition at line 62 of file guidance_h.c.

Referenced by guidance_h_hover_enter(), guidance_h_nav_enter(), guidance_h_run(), and guidance_h_update_reference().

struct Int32Eulers guidance_h_rc_sp
struct Int32Vect2 guidance_h_speed_err

Definition at line 68 of file guidance_h.c.

Referenced by guidance_h_traj_run().

struct Int32Vect2 guidance_h_stick_earth_sp

Definition at line 74 of file guidance_h.c.

bool_t guidance_h_use_ref

Definition at line 60 of file guidance_h.c.

Referenced by guidance_h_update_reference().

int32_t transition_percentage

Definition at line 82 of file guidance_h.c.

Referenced by guidance_h_mode_changed(), guidance_h_run(), and transition_run().

int32_t transition_theta_offset