Paparazzi UAS  v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces 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_VGAIN   0
 
#define GUIDANCE_H_MAX_BANK   RadOfDeg(20)
 
#define GUIDANCE_H_APPROX_FORCE_BY_THRUST   FALSE
 
#define GUIDANCE_INDI   FALSE
 
#define MAX_POS_ERR   POS_BFP_OF_REAL(16.)
 
#define MAX_SPEED_ERR   SPEED_BFP_OF_REAL(16.)
 
#define GUIDANCE_H_THRUST_CMD_FILTER   10
 
#define GH_GAIN_SCALE   2
 

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)
 
static void read_rc_setpoint_speed_i (struct Int32Vect2 *speed_sp, bool_t in_flight)
 read speed setpoint from RC More...
 
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)
 
void guidance_h_set_igain (uint32_t igain)
 
bool_t guidance_h_set_guided_pos (float x, float y)
 Set horizontal position setpoint in GUIDED mode. More...
 
bool_t guidance_h_set_guided_heading (float heading)
 Set heading setpoint in GUIDED mode. More...
 

Variables

struct HorizontalGuidance guidance_h
 
int32_t transition_percentage
 
int32_t transition_theta_offset
 
struct Int32Vect2 guidance_h_pos_err
 
struct Int32Vect2 guidance_h_speed_err
 
struct Int32Vect2 guidance_h_trim_att_integrator
 
struct Int32Vect2 guidance_h_cmd_earth
 horizontal guidance command. More...
 

Detailed Description

Horizontal guidance for rotorcrafts.

Definition in file guidance_h.c.

Macro Definition Documentation

#define GH_GAIN_SCALE   2

Definition at line 481 of file guidance_h.c.

Referenced by guidance_h_traj_run().

#define GUIDANCE_H_AGAIN   0

Definition at line 48 of file guidance_h.c.

Referenced by guidance_h_init().

#define GUIDANCE_H_APPROX_FORCE_BY_THRUST   FALSE

Definition at line 72 of file guidance_h.c.

Referenced by guidance_h_init().

#define GUIDANCE_H_MAX_BANK   RadOfDeg(20)

Definition at line 65 of file guidance_h.c.

Referenced by guidance_h_traj_run(), and guidance_indi_run().

#define GUIDANCE_H_THRUST_CMD_FILTER   10

Definition at line 476 of file guidance_h.c.

Referenced by guidance_h_traj_run().

#define GUIDANCE_H_VGAIN   0

Definition at line 52 of file guidance_h.c.

Referenced by guidance_h_init().

#define GUIDANCE_INDI   FALSE

Definition at line 76 of file guidance_h.c.

#define MAX_POS_ERR   POS_BFP_OF_REAL(16.)

Definition at line 472 of file guidance_h.c.

Referenced by guidance_h_traj_run().

#define MAX_SPEED_ERR   SPEED_BFP_OF_REAL(16.)

Definition at line 473 of file guidance_h.c.

Referenced by guidance_h_traj_run().

Function Documentation

static void guidance_h_hover_enter ( void  )
static
static void guidance_h_nav_enter ( void  )
static
bool_t guidance_h_set_guided_heading ( float  heading)

Set heading setpoint in GUIDED mode.

Parameters
headingSetpoint in radians.
Returns
TRUE if setpoint was set (currently in GUIDANCE_H_MODE_GUIDED)

Definition at line 631 of file guidance_h.c.

References ANGLE_BFP_OF_REAL, FALSE, guidance_h, GUIDANCE_H_MODE_GUIDED, HorizontalGuidanceSetpoint::heading, INT32_ANGLE_NORMALIZE, HorizontalGuidance::mode, HorizontalGuidance::sp, and TRUE.

Referenced by autopilot_guided_goto_ned().

+ Here is the caller graph for this function:

bool_t guidance_h_set_guided_pos ( float  x,
float  y 
)

Set horizontal position setpoint in GUIDED mode.

Parameters
xNorth position (local NED frame) in meters.
yEast position (local NED frame) in meters.
Returns
TRUE if setpoints were set (currently in GUIDANCE_H_MODE_GUIDED)

Definition at line 621 of file guidance_h.c.

References FALSE, guidance_h, GUIDANCE_H_MODE_GUIDED, HorizontalGuidance::mode, HorizontalGuidanceSetpoint::pos, POS_BFP_OF_REAL, HorizontalGuidance::sp, TRUE, Int32Vect2::x, and Int32Vect2::y.

Referenced by autopilot_guided_goto_ned().

+ Here is the caller graph for this function:

void guidance_h_set_igain ( uint32_t  igain)
static void read_rc_setpoint_speed_i ( struct Int32Vect2 speed_sp,
bool_t  in_flight 
)
static

read speed setpoint from RC

Todo:
calc proper scale while making sure a division by zero can't occur

Definition at line 585 of file guidance_h.c.

References GUIDANCE_H_REF_MAX_SPEED, INT32_TRIG_FRAC, MAX_PPRZ, PPRZ_ITRIG_COS, PPRZ_ITRIG_SIN, Int32Eulers::psi, radio_control, RADIO_PITCH, RADIO_ROLL, SPEED_BFP_OF_REAL, stateGetNedToBodyEulers_i(), RadioControl::values, Int32Vect2::x, and Int32Vect2::y.

Referenced by guidance_h_read_rc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void reset_guidance_reference_from_current_position ( void  )
inlinestatic
static void transition_run ( void  )
inlinestatic

Definition at line 572 of file guidance_h.c.

References ANGLE_BFP_OF_REAL, INT32_ANGLE_FRAC, INT32_PERCENTAGE_FRAC, and INT_MULT_RSHIFT.

Referenced by guidance_h_run().

+ Here is the caller graph for this function:

Variable Documentation

struct Int32Vect2 guidance_h_cmd_earth

horizontal guidance command.

In north/east with INT32_ANGLE_FRAC

Todo:
convert to real force command

Definition at line 95 of file guidance_h.c.

Referenced by guidance_h_run(), and guidance_h_traj_run().

struct Int32Vect2 guidance_h_pos_err

Definition at line 87 of file guidance_h.c.

Referenced by guidance_h_traj_run().

struct Int32Vect2 guidance_h_speed_err

Definition at line 88 of file guidance_h.c.

Referenced by guidance_h_traj_run().

struct Int32Vect2 guidance_h_trim_att_integrator
int32_t transition_percentage

Definition at line 81 of file guidance_h.c.

int32_t transition_theta_offset

Definition at line 82 of file guidance_h.c.

Referenced by stabilization_attitude_read_rc_roll_pitch_earth_quat_f().