Paparazzi UAS  v6.3_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 "firmwares/rotorcraft/stabilization.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  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_MAX_BANK   RadOfDeg(20)
 Max bank controlled by guidance. More...
 
#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_run_enter (void)
 
struct StabilizationSetpoint guidance_h_run_pos (bool in_flight, struct HorizontalGuidance *gh)
 
struct StabilizationSetpoint guidance_h_run_speed (bool in_flight, struct HorizontalGuidance *gh)
 
struct StabilizationSetpoint guidance_h_run_accel (bool in_flight, struct HorizontalGuidance *gh)
 
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_guided_run (bool in_flight)
 Run GUIDED mode control. More...
 
void guidance_h_set_pos (float x, float y)
 Set horizontal position setpoint. More...
 
void guidance_h_set_heading (float heading)
 Set heading setpoint. More...
 
void guidance_h_set_body_vel (float vx, float vy)
 Set body relative horizontal velocity setpoint. More...
 
void guidance_h_set_vel (float vx, float vy)
 Set horizontal velocity setpoint. More...
 
void guidance_h_set_heading_rate (float rate)
 Set heading rate setpoint. 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

◆ HorizontalGuidanceSetpoint

struct HorizontalGuidanceSetpoint

Definition at line 75 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

◆ HorizontalGuidanceReference

struct HorizontalGuidanceReference

Definition at line 87 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

◆ HorizontalGuidance

struct HorizontalGuidance

Definition at line 93 of file guidance_h.h.

+ Collaboration diagram for HorizontalGuidance:
Data Fields
uint8_t mode
struct FloatEulers rc_sp remote control setpoint
struct HorizontalGuidanceReference ref reference calculated from setpoints
struct HorizontalGuidanceSetpoint sp setpoints
bool use_ref

Macro Definition Documentation

◆ GUIDANCE_H_MAX_BANK

#define GUIDANCE_H_MAX_BANK   RadOfDeg(20)

Max bank controlled by guidance.

Definition at line 71 of file guidance_h.h.

◆ GUIDANCE_H_MODE_ATTITUDE

#define GUIDANCE_H_MODE_ATTITUDE   2

Definition at line 58 of file guidance_h.h.

◆ GUIDANCE_H_MODE_CARE_FREE

#define GUIDANCE_H_MODE_CARE_FREE   6

Definition at line 62 of file guidance_h.h.

◆ GUIDANCE_H_MODE_FLIP

#define GUIDANCE_H_MODE_FLIP   9

Definition at line 65 of file guidance_h.h.

◆ GUIDANCE_H_MODE_FORWARD

#define GUIDANCE_H_MODE_FORWARD   7

Definition at line 63 of file guidance_h.h.

◆ GUIDANCE_H_MODE_GUIDED

#define GUIDANCE_H_MODE_GUIDED   10

Definition at line 66 of file guidance_h.h.

◆ GUIDANCE_H_MODE_HOVER

#define GUIDANCE_H_MODE_HOVER   3

Definition at line 59 of file guidance_h.h.

◆ GUIDANCE_H_MODE_KILL

#define GUIDANCE_H_MODE_KILL   0

Definition at line 56 of file guidance_h.h.

◆ GUIDANCE_H_MODE_MODULE

#define GUIDANCE_H_MODE_MODULE   8

Definition at line 64 of file guidance_h.h.

◆ GUIDANCE_H_MODE_NAV

#define GUIDANCE_H_MODE_NAV   4

Definition at line 60 of file guidance_h.h.

◆ GUIDANCE_H_MODE_RATE

#define GUIDANCE_H_MODE_RATE   1

Definition at line 57 of file guidance_h.h.

◆ GUIDANCE_H_MODE_RC_DIRECT

#define GUIDANCE_H_MODE_RC_DIRECT   5

Definition at line 61 of file guidance_h.h.

◆ guidance_h_SetUseRef

#define guidance_h_SetUseRef (   _val)
Value:
{ \
guidance_h.use_ref = _val && GUIDANCE_H_USE_REF; \
}
#define GUIDANCE_H_USE_REF
Use horizontal guidance reference trajectory.
Definition: guidance_h.h:45

Definition at line 159 of file guidance_h.h.

◆ GUIDANCE_H_USE_REF

#define GUIDANCE_H_USE_REF   TRUE

Use horizontal guidance reference trajectory.

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

Definition at line 45 of file guidance_h.h.

◆ GUIDANCE_H_USE_SPEED_REF

#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 53 of file guidance_h.h.

Function Documentation

◆ guidance_h_from_nav()

◆ guidance_h_guided_run()

void guidance_h_guided_run ( bool  in_flight)

Run GUIDED mode control.

Definition at line 535 of file guidance_h.c.

References guidance_h, guidance_h_cmd, guidance_h_hover_enter(), guidance_h_run_pos(), guidance_h_update_reference(), stabilization_attitude_run(), and stabilization_attitude_set_stab_sp().

Referenced by guidance_h_from_nav(), and guidance_h_run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ guidance_h_hover_enter()

◆ guidance_h_init()

◆ guidance_h_mode_changed()

◆ guidance_h_nav_enter()

void guidance_h_nav_enter ( void  )

◆ guidance_h_read_rc()

◆ guidance_h_run()

◆ guidance_h_run_accel()

struct StabilizationSetpoint guidance_h_run_accel ( bool  in_flight,
struct HorizontalGuidance gh 
)

Referenced by guidance_h_from_nav().

+ Here is the caller graph for this function:

◆ guidance_h_run_enter()

void guidance_h_run_enter ( void  )

Referenced by guidance_h_hover_enter(), and guidance_h_nav_enter().

+ Here is the caller graph for this function:

◆ guidance_h_run_pos()

struct StabilizationSetpoint guidance_h_run_pos ( bool  in_flight,
struct HorizontalGuidance gh 
)

Referenced by guidance_h_from_nav(), and guidance_h_guided_run().

+ Here is the caller graph for this function:

◆ guidance_h_run_speed()

struct StabilizationSetpoint guidance_h_run_speed ( bool  in_flight,
struct HorizontalGuidance gh 
)

Referenced by guidance_h_from_nav().

+ Here is the caller graph for this function:

◆ guidance_h_set_body_vel()

void guidance_h_set_body_vel ( float  vx,
float  vy 
)

Set body relative horizontal velocity setpoint.

Parameters
vxforward velocity (body frame) in meters/sec.
vyright velocity (body frame) in meters/sec.

Definition at line 564 of file guidance_h.c.

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

Referenced by autopilot_guided_update(), and orange_avoider_guided_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ guidance_h_set_heading()

void guidance_h_set_heading ( float  heading)

◆ guidance_h_set_heading_rate()

void guidance_h_set_heading_rate ( float  rate)

Set heading rate setpoint.

Parameters
rateHeading rate in radians.

Definition at line 579 of file guidance_h.c.

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

Referenced by autopilot_guided_update(), and orange_avoider_guided_periodic().

+ Here is the caller graph for this function:

◆ guidance_h_set_pos()

void guidance_h_set_pos ( float  x,
float  y 
)

Set horizontal position setpoint.

Parameters
xNorth position (local NED frame) in meters.
yEast position (local NED frame) in meters.

Definition at line 550 of file guidance_h.c.

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

Referenced by autopilot_guided_goto_ned(), autopilot_guided_update(), guidance_h_from_nav(), guidance_h_hover_enter(), and guidance_h_nav_enter().

+ Here is the caller graph for this function:

◆ guidance_h_set_vel()

void guidance_h_set_vel ( float  vx,
float  vy 
)

Set horizontal velocity setpoint.

Parameters
vxNorth velocity (local NED frame) in meters/sec.
vyEast velocity (local NED frame) in meters/sec.

Definition at line 572 of file guidance_h.c.

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

Referenced by autopilot_guided_move_ned(), autopilot_guided_update(), guidance_h_from_nav(), and guidance_h_set_body_vel().

+ Here is the caller graph for this function:

◆ guidance_h_SetMaxSpeed()

static void guidance_h_SetMaxSpeed ( float  speed)
inlinestatic

Definition at line 163 of file guidance_h.h.

References gh_set_max_speed().

+ Here is the call graph for this function:

◆ guidance_h_SetOmega()

static void guidance_h_SetOmega ( float  omega)
inlinestatic

Definition at line 168 of file guidance_h.h.

References gh_set_omega().

+ Here is the call graph for this function:

◆ guidance_h_SetTau()

static void guidance_h_SetTau ( float  tau)
inlinestatic

Definition at line 178 of file guidance_h.h.

◆ guidance_h_SetZeta()

static void guidance_h_SetZeta ( float  zeta)
inlinestatic

Definition at line 173 of file guidance_h.h.

References gh_set_zeta().

+ Here is the call graph for this function:

Variable Documentation

◆ guidance_h

◆ transition_percentage

int32_t transition_percentage
extern