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_h.h File Reference

Horizontal guidance for rotorcrafts. More...

#include "math/pprz_algebra_int.h"
#include "math/pprz_algebra_float.h"
#include "firmwares/rotorcraft/guidance/guidance_h_ref.h"
#include "generated/airframe.h"
#include "std.h"
+ Include dependency graph for guidance_h.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  HorizontalGuidanceSetpoint
 
struct  HorizontalGuidanceReference
 
struct  HorizontalGuidanceGains
 
struct  HorizontalGuidance
 

Macros

#define GUIDANCE_H_USE_REF   TRUE
 Use horizontal guidance reference trajectory. More...
 
#define GUIDANCE_H_USE_SPEED_REF   TRUE
 Use horizontal guidance speed reference. More...
 
#define GUIDANCE_H_MODE_KILL   0
 
#define GUIDANCE_H_MODE_RATE   1
 
#define GUIDANCE_H_MODE_ATTITUDE   2
 
#define GUIDANCE_H_MODE_HOVER   3
 
#define GUIDANCE_H_MODE_NAV   4
 
#define GUIDANCE_H_MODE_RC_DIRECT   5
 
#define GUIDANCE_H_MODE_CARE_FREE   6
 
#define GUIDANCE_H_MODE_FORWARD   7
 
#define GUIDANCE_H_MODE_MODULE   8
 
#define GUIDANCE_H_MODE_FLIP   9
 
#define GUIDANCE_H_MODE_GUIDED   10
 
#define guidance_h_SetUseRef(_val)
 

Functions

void guidance_h_init (void)
 
void guidance_h_mode_changed (uint8_t new_mode)
 
void guidance_h_read_rc (bool in_flight)
 
void guidance_h_run (bool in_flight)
 
void guidance_h_hover_enter (void)
 
void guidance_h_nav_enter (void)
 
void guidance_h_from_nav (bool in_flight)
 Set horizontal guidance from NAV and run control loop. More...
 
void guidance_h_set_igain (uint32_t igain)
 
void guidance_h_guided_run (bool in_flight)
 Run GUIDED mode control. More...
 
bool guidance_h_set_guided_pos (float x, float y)
 Set horizontal position setpoint in GUIDED mode. More...
 
bool guidance_h_set_guided_heading (float heading)
 Set heading setpoint in GUIDED mode. More...
 
bool guidance_h_set_guided_body_vel (float vx, float vy)
 Set body relative horizontal velocity setpoint in GUIDED mode. More...
 
bool guidance_h_set_guided_vel (float vx, float vy)
 Set horizontal velocity setpoint in GUIDED mode. More...
 
bool guidance_h_set_guided_heading_rate (float rate)
 Set heading rate setpoint in GUIDED mode. More...
 
const struct Int32Vect2guidance_h_get_pos_err (void)
 Gets the position error. More...
 
static void guidance_h_SetMaxSpeed (float speed)
 
static void guidance_h_SetOmega (float omega)
 
static void guidance_h_SetZeta (float zeta)
 
static void guidance_h_SetTau (float tau)
 

Variables

struct HorizontalGuidance guidance_h
 
int32_t transition_percentage
 

Detailed Description

Horizontal guidance for rotorcrafts.

Definition in file guidance_h.h.


Data Structure Documentation

struct HorizontalGuidanceSetpoint

Definition at line 66 of file guidance_h.h.

+ Collaboration diagram for HorizontalGuidanceSetpoint:
Data Fields
float heading
float heading_rate
uint8_t mask bit 5: vx & vy, bit 6: vz, bit 7: vyaw
struct Int32Vect2 pos horizontal position setpoint in NED.

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

struct Int32Vect2 speed only used in HOVER mode if GUIDANCE_H_USE_SPEED_REF or in GUIDED mode
struct HorizontalGuidanceReference

Definition at line 78 of file guidance_h.h.

+ Collaboration diagram for HorizontalGuidanceReference:
Data Fields
struct Int32Vect2 accel with INT32_ACCEL_FRAC
struct Int32Vect2 pos with INT32_POS_FRAC
struct Int32Vect2 speed with INT32_SPEED_FRAC
struct HorizontalGuidanceGains

Definition at line 84 of file guidance_h.h.

Data Fields
int32_t a
int32_t d
int32_t i
int32_t p
int32_t v
struct HorizontalGuidance

Definition at line 92 of file guidance_h.h.

+ Collaboration diagram for HorizontalGuidance:
Data Fields
bool approx_force_by_thrust
struct HorizontalGuidanceGains gains
uint8_t mode
struct FloatEulers rc_sp
struct HorizontalGuidanceReference ref reference calculated from setpoints
struct HorizontalGuidanceSetpoint sp setpoints
bool use_ref

Macro Definition Documentation

#define GUIDANCE_H_MODE_ATTITUDE   2
#define GUIDANCE_H_MODE_CARE_FREE   6
#define GUIDANCE_H_MODE_FLIP   9
#define GUIDANCE_H_MODE_FORWARD   7
#define GUIDANCE_H_MODE_HOVER   3
#define GUIDANCE_H_MODE_KILL   0
#define GUIDANCE_H_MODE_MODULE   8

Definition at line 61 of file guidance_h.h.

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

#define GUIDANCE_H_MODE_NAV   4
#define GUIDANCE_H_MODE_RATE   1
#define GUIDANCE_H_MODE_RC_DIRECT   5
#define guidance_h_SetUseRef (   _val)
Value:
{ \
}
struct HorizontalGuidance guidance_h
Definition: guidance_h.c:80
#define GUIDANCE_H_USE_REF
Use horizontal guidance reference trajectory.
Definition: guidance_h.h:42

Definition at line 170 of file guidance_h.h.

#define GUIDANCE_H_USE_REF   TRUE

Use horizontal guidance reference trajectory.

Default is TRUE, define to FALSE to always disable it.

Definition at line 42 of file guidance_h.h.

Referenced by guidance_h_init().

#define GUIDANCE_H_USE_SPEED_REF   TRUE

Use horizontal guidance speed reference.

This also allows to give velocity commands via RC in GUIDANCE_H_MODE_HOVER. Default is TRUE, define to FALSE to always disable it.

Definition at line 50 of file guidance_h.h.

Function Documentation

const struct Int32Vect2* guidance_h_get_pos_err ( void  )

Gets the position error.

Parameters
none.
Returns
Pointer to a structure containing x and y position errors

Definition at line 748 of file guidance_h.c.

References guidance_h_pos_err.

void guidance_h_guided_run ( bool  in_flight)
bool guidance_h_set_guided_body_vel ( float  vx,
float  vy 
)

Set body relative horizontal velocity setpoint in GUIDED mode.

Parameters
vxforward velocity (body frame) in meters/sec.
vyright velocity (body frame) in meters/sec.
Returns
TRUE if setpoints were set (currently in GUIDANCE_H_MODE_GUIDED)

Definition at line 719 of file guidance_h.c.

References guidance_h_set_guided_vel(), FloatEulers::psi, Int32Eulers::psi, and stateGetNedToBodyEulers_f().

Referenced by autopilot_guided_update().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool 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 708 of file guidance_h.c.

References FLOAT_ANGLE_NORMALIZE, guidance_h, GUIDANCE_H_MODE_GUIDED, heading, HorizontalGuidanceSetpoint::heading, HorizontalGuidanceSetpoint::mask, HorizontalGuidance::mode, and HorizontalGuidance::sp.

Referenced by autopilot_guided_goto_ned(), autopilot_guided_move_ned(), and autopilot_guided_update().

+ Here is the caller graph for this function:

bool guidance_h_set_guided_heading_rate ( float  rate)

Set heading rate setpoint in GUIDED mode.

Parameters
rateHeading rate in radians.
Returns
TRUE if setpoints were set (currently in GUIDANCE_H_MODE_GUIDED)

Definition at line 738 of file guidance_h.c.

References guidance_h, GUIDANCE_H_MODE_GUIDED, HorizontalGuidanceSetpoint::heading_rate, HorizontalGuidanceSetpoint::mask, HorizontalGuidance::mode, and HorizontalGuidance::sp.

Referenced by autopilot_guided_update().

+ Here is the caller graph for this function:

bool 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 697 of file guidance_h.c.

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

Referenced by autopilot_guided_goto_ned(), and autopilot_guided_update().

+ Here is the caller graph for this function:

bool guidance_h_set_guided_vel ( float  vx,
float  vy 
)

Set horizontal velocity setpoint in GUIDED mode.

Parameters
vxNorth velocity (local NED frame) in meters/sec.
vyEast velocity (local NED frame) in meters/sec.
Returns
TRUE if setpoints were set (currently in GUIDANCE_H_MODE_GUIDED)

Definition at line 727 of file guidance_h.c.

References guidance_h, GUIDANCE_H_MODE_GUIDED, HorizontalGuidanceSetpoint::mask, HorizontalGuidance::mode, HorizontalGuidance::sp, HorizontalGuidanceSetpoint::speed, SPEED_BFP_OF_REAL, Int32Vect2::x, and Int32Vect2::y.

Referenced by autopilot_guided_move_ned(), autopilot_guided_update(), and guidance_h_set_guided_body_vel().

+ Here is the caller graph for this function:

void guidance_h_set_igain ( uint32_t  igain)
static void guidance_h_SetMaxSpeed ( float  speed)
inlinestatic

Definition at line 174 of file guidance_h.h.

References gh_set_max_speed().

+ Here is the call graph for this function:

static void guidance_h_SetOmega ( float  omega)
inlinestatic

Definition at line 179 of file guidance_h.h.

References gh_set_omega().

+ Here is the call graph for this function:

static void guidance_h_SetTau ( float  tau)
inlinestatic

Definition at line 189 of file guidance_h.h.

References gh_set_tau().

+ Here is the call graph for this function:

static void guidance_h_SetZeta ( float  zeta)
inlinestatic

Definition at line 184 of file guidance_h.h.

References gh_set_zeta().

+ Here is the call graph for this function:

Variable Documentation

int32_t transition_percentage

Definition at line 82 of file guidance_h.c.

Referenced by ctrl_eff_scheduling_periodic().