Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
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  HorizontalGuidanceRCInput
struct  HorizontalGuidance

Macros

#define GUIDANCE_H_USE_REF   TRUE
 Use horizontal guidance reference trajectory.
#define GUIDANCE_H_USE_SPEED_REF   TRUE
 Use horizontal guidance speed reference.
#define GUIDANCE_H_MODE_NONE   0
#define GUIDANCE_H_MODE_HOVER   1
#define GUIDANCE_H_MODE_NAV   2
#define GUIDANCE_H_MODE_GUIDED   3
#define GUIDANCE_H_MAX_BANK   RadOfDeg(20)
 Max bank controlled by guidance.
#define guidance_h_SetUseRef(_val)

Functions

void guidance_h_init (void)
void guidance_h_mode_changed (uint8_t new_mode)
void guidance_h_run_enter (void)
struct StabilizationSetpoint guidance_h_run (bool in_flight)
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)
struct StabilizationSetpoint guidance_h_from_nav (bool in_flight)
 Set horizontal guidance from NAV and run control loop.
struct StabilizationSetpoint guidance_h_guided_run (bool in_flight)
 Run GUIDED mode control.
void guidance_h_set_pos (float x, float y)
 Set horizontal position setpoint.
void guidance_h_set_heading (float heading)
 Set heading setpoint.
void guidance_h_set_body_vel (float vx, float vy)
 Set body relative horizontal velocity setpoint.
void guidance_h_set_vel (float vx, float vy)
 Set horizontal velocity setpoint.
void guidance_h_set_body_acc (float ax, float ay)
 Set body relative horizontal acceleration setpoint.
void guidance_h_set_acc (float ax, float ay)
 Set horizontal acceleration setpoint.
void guidance_h_set_heading_rate (float rate)
 Set heading rate setpoint.
void guidance_h_set_all (float x, float y, float vx, float vy, float ax, float ay)
 Set position speed and acceleration (NED frame).
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

Detailed Description

Horizontal guidance for rotorcrafts.

Definition in file guidance_h.h.


Data Structure Documentation

◆ HorizontalGuidanceReference

struct HorizontalGuidanceReference

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

◆ HorizontalGuidanceRCInput

struct HorizontalGuidanceRCInput

Definition at line 98 of file guidance_h.h.

Collaboration diagram for HorizontalGuidanceRCInput:
Data Fields
float heading
float last_ts
struct Int32Vect2 vect

◆ HorizontalGuidance

struct HorizontalGuidance

Definition at line 104 of file guidance_h.h.

Collaboration diagram for HorizontalGuidance:
Data Fields
uint8_t mode
struct HorizontalGuidanceRCInput 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 64 of file guidance_h.h.

Referenced by computeOptiTrack(), guidance_pid_h_run(), and rotwing_state_periodic().

◆ GUIDANCE_H_MODE_GUIDED

#define GUIDANCE_H_MODE_GUIDED   3

◆ GUIDANCE_H_MODE_HOVER

◆ GUIDANCE_H_MODE_NAV

◆ GUIDANCE_H_MODE_NONE

◆ guidance_h_SetUseRef

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

Definition at line 188 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.

Referenced by guidance_h_init().

◆ 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()

struct StabilizationSetpoint guidance_h_from_nav ( bool in_flight)
extern

Set horizontal guidance from NAV and run control loop.

Definition at line 391 of file guidance_h.c.

References guidance_h_from_nav(), guidance_h_nav_enter(), if(), nav, NAV_HORIZONTAL_MODE_ATTITUDE, NAV_HORIZONTAL_MODE_NONE, and stab_sp_from_eulers_f().

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_guided_run()

struct StabilizationSetpoint guidance_h_guided_run ( bool in_flight)
extern

Run GUIDED mode control.

Definition at line 457 of file guidance_h.c.

References guidance_h, guidance_h_cmd, guidance_h_guided_run(), guidance_h_hover_enter(), guidance_h_run_pos(), guidance_h_run_speed(), and guidance_h_update_reference().

Referenced by guidance_h_guided_run(), and guidance_h_run().

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

◆ guidance_h_hover_enter()

void guidance_h_hover_enter ( void )
extern

◆ guidance_h_init()

void guidance_h_init ( void )
extern

◆ guidance_h_mode_changed()

void guidance_h_mode_changed ( uint8_t new_mode)
extern

◆ guidance_h_nav_enter()

void guidance_h_nav_enter ( void )
extern

Definition at line 380 of file guidance_h.c.

References guidance_h_run_enter(), guidance_h_set_heading(), guidance_h_set_pos(), nav, and reset_guidance_reference_from_current_position().

Referenced by guidance_h_from_nav(), and guidance_h_mode_changed().

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

◆ guidance_h_run()

struct StabilizationSetpoint guidance_h_run ( bool in_flight)
extern

◆ guidance_h_run_accel()

struct StabilizationSetpoint guidance_h_run_accel ( bool in_flight,
struct HorizontalGuidance * gh )
extern

Definition at line 58 of file guidance_oneloop.c.

References _gv, _v_mode, guidance_h_run_accel(), GUIDANCE_ONELOOP_H_ACCEL, GUIDANCE_ONELOOP_NB_H_ACCEL, guidance_oneloop_nB_run_mode(), and guidance_oneloop_run_mode().

Referenced by guidance_h_run_accel().

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

◆ guidance_h_run_enter()

void guidance_h_run_enter ( void )
extern

Definition at line 35 of file guidance_oneloop.c.

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 )
extern

Definition at line 48 of file guidance_oneloop.c.

References _gv, _v_mode, guidance_h_run_pos(), GUIDANCE_ONELOOP_H_POS, GUIDANCE_ONELOOP_NB_H_POS, guidance_oneloop_nB_run_mode(), and guidance_oneloop_run_mode().

Referenced by guidance_h_guided_run(), and guidance_h_run_pos().

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

◆ guidance_h_run_speed()

struct StabilizationSetpoint guidance_h_run_speed ( bool in_flight,
struct HorizontalGuidance * gh )
extern

Definition at line 53 of file guidance_oneloop.c.

References _gv, _v_mode, guidance_h_run_speed(), GUIDANCE_ONELOOP_H_SPEED, GUIDANCE_ONELOOP_NB_H_SPEED, guidance_oneloop_nB_run_mode(), and guidance_oneloop_run_mode().

Referenced by guidance_h_guided_run(), and guidance_h_run_speed().

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

◆ guidance_h_set_acc()

void guidance_h_set_acc ( float ax,
float ay )
extern

Set horizontal acceleration setpoint.

Parameters
axNorth acceleration (local NED frame) in meters/sec².
ayEast acceleration (local NED frame) in meters/sec².

Definition at line 520 of file guidance_h.c.

References ACCEL_BFP_OF_REAL, guidance_h, and reset_guidance_reference_from_current_position().

Referenced by guidance_h_set_body_acc().

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

◆ guidance_h_set_all()

void guidance_h_set_all ( float x,
float y,
float vx,
float vy,
float ax,
float ay )
extern

Set position speed and acceleration (NED frame).

Parameters
xNorth position (local NED frame) in meters.
yEast position (local NED frame) in meters.
vxNorth velocity (local NED frame) in meters/sec.
vyEast velocity (local NED frame) in meters/sec.
axNorth acceleration (local NED frame) in meters/sec².
ayEast acceleration (local NED frame) in meters/sec².

Definition at line 536 of file guidance_h.c.

References ACCEL_BFP_OF_REAL, guidance_h, POS_BFP_OF_REAL, and SPEED_BFP_OF_REAL.

◆ guidance_h_set_body_acc()

void guidance_h_set_body_acc ( float ax,
float ay )
extern

Set body relative horizontal acceleration setpoint.

Parameters
axforward acceleration (body frame) in meters/sec².
ayright acceleration (body frame) in meters/sec².

Definition at line 512 of file guidance_h.c.

References guidance_h_set_acc(), FloatEulers::psi, and stateGetNedToBodyEulers_f().

Here is the call graph for this function:

◆ guidance_h_set_body_vel()

void guidance_h_set_body_vel ( float vx,
float vy )
extern

Set body relative horizontal velocity setpoint.

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

Definition at line 494 of file guidance_h.c.

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

Referenced by 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)
extern

Set heading setpoint.

Parameters
headingSetpoint in radians.

Definition at line 487 of file guidance_h.c.

References FLOAT_ANGLE_NORMALIZE, guidance_h, and heading.

Referenced by guidance_h_hover_enter(), guidance_h_nav_enter(), orange_avoider_guided_periodic(), and wedgebug_periodic().

Here is the caller graph for this function:

◆ guidance_h_set_heading_rate()

void guidance_h_set_heading_rate ( float rate)
extern

Set heading rate setpoint.

Parameters
rateHeading rate in radians.

Definition at line 530 of file guidance_h.c.

References guidance_h.

Referenced by 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 )
extern

Set horizontal position setpoint.

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

Definition at line 477 of file guidance_h.c.

References guidance_h, POS_BFP_OF_REAL, and reset_guidance_reference_from_current_position().

Referenced by guidance_h_hover_enter(), guidance_h_nav_enter(), and wedgebug_periodic().

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

◆ guidance_h_set_vel()

void guidance_h_set_vel ( float vx,
float vy )
extern

Set horizontal velocity setpoint.

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

Definition at line 502 of file guidance_h.c.

References guidance_h, reset_guidance_reference_from_current_position(), and SPEED_BFP_OF_REAL.

Referenced by guidance_h_set_body_vel().

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

◆ guidance_h_SetMaxSpeed()

void guidance_h_SetMaxSpeed ( float speed)
inlinestatic

Definition at line 192 of file guidance_h.h.

References gh_set_max_speed().

Here is the call graph for this function:

◆ guidance_h_SetOmega()

void guidance_h_SetOmega ( float omega)
inlinestatic

Definition at line 197 of file guidance_h.h.

References gh_set_omega().

Here is the call graph for this function:

◆ guidance_h_SetTau()

void guidance_h_SetTau ( float tau)
inlinestatic

Definition at line 207 of file guidance_h.h.

References gh_set_tau().

Here is the call graph for this function:

◆ guidance_h_SetZeta()

void guidance_h_SetZeta ( float zeta)
inlinestatic

Definition at line 202 of file guidance_h.h.

References gh_set_zeta().

Here is the call graph for this function:

Variable Documentation

◆ guidance_h