Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
guidance_v_ref.h File Reference

Reference generation for vertical guidance. More...

#include "inttypes.h"
#include "math/pprz_algebra.h"
#include "math/pprz_algebra_int.h"
#include "generated/airframe.h"
+ Include dependency graph for guidance_v_ref.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define GUIDANCE_V_REF_MIN_ZD   (-3.)
 
#define GUIDANCE_V_REF_MAX_ZD   ( 3.)
 
#define GV_FREQ_FRAC   9
 Update frequency. More...
 
#define GV_FREQ   (1<<GV_FREQ_FRAC)
 
#define GV_ZDD_REF_FRAC   8
 number of bits for the fractional part of gv_zdd_ref More...
 
#define GV_ZD_REF_FRAC   (GV_ZDD_REF_FRAC + GV_FREQ_FRAC)
 number of bits for the fractional part of gv_zd_ref More...
 
#define GV_Z_REF_FRAC   (GV_ZD_REF_FRAC + GV_FREQ_FRAC)
 number of bits for the fractional part of gv_z_ref More...
 

Functions

void gv_set_ref (int32_t alt, int32_t speed, int32_t accel)
 
void gv_update_ref_from_z_sp (int32_t z_sp)
 
void gv_update_ref_from_zd_sp (int32_t zd_sp, int32_t z_pos)
 update vertical reference from speed setpoint. More...
 

Variables

int32_t gv_zdd_ref
 reference model vertical accel in meters/s^2 (output) fixed point representation with GV_ZDD_REF_FRAC Q23.8 : accuracy 0.0039 , range 8388km/s^2 More...
 
int32_t gv_zd_ref
 reference model vertical speed in meters/sec (output) fixed point representation with GV_ZD_REF_FRAC Q14.17 : accuracy 0.0000076 , range 16384m/s2 More...
 
int64_t gv_z_ref
 reference model altitude in meters (output) fixed point representation with GV_Z_REF_FRAC Q37.26 : More...
 

Detailed Description

Reference generation for vertical guidance.

Definition in file guidance_v_ref.h.

Macro Definition Documentation

◆ GUIDANCE_V_REF_MAX_ZD

#define GUIDANCE_V_REF_MAX_ZD   ( 3.)

Definition at line 41 of file guidance_v_ref.h.

◆ GUIDANCE_V_REF_MIN_ZD

#define GUIDANCE_V_REF_MIN_ZD   (-3.)

Definition at line 37 of file guidance_v_ref.h.

◆ GV_FREQ

#define GV_FREQ   (1<<GV_FREQ_FRAC)

Definition at line 48 of file guidance_v_ref.h.

◆ GV_FREQ_FRAC

#define GV_FREQ_FRAC   9

Update frequency.

Definition at line 47 of file guidance_v_ref.h.

◆ GV_Z_REF_FRAC

#define GV_Z_REF_FRAC   (GV_ZD_REF_FRAC + GV_FREQ_FRAC)

number of bits for the fractional part of gv_z_ref

Definition at line 75 of file guidance_v_ref.h.

◆ GV_ZD_REF_FRAC

#define GV_ZD_REF_FRAC   (GV_ZDD_REF_FRAC + GV_FREQ_FRAC)

number of bits for the fractional part of gv_zd_ref

Definition at line 66 of file guidance_v_ref.h.

◆ GV_ZDD_REF_FRAC

#define GV_ZDD_REF_FRAC   8

number of bits for the fractional part of gv_zdd_ref

Definition at line 57 of file guidance_v_ref.h.

Function Documentation

◆ gv_set_ref()

void gv_set_ref ( int32_t  alt,
int32_t  speed,
int32_t  accel 
)

Definition at line 87 of file guidance_v_ref.c.

References gv_z_ref, GV_Z_REF_FRAC, gv_zd_ref, GV_ZD_REF_FRAC, gv_zdd_ref, GV_ZDD_REF_FRAC, INT32_ACCEL_FRAC, INT32_POS_FRAC, and INT32_SPEED_FRAC.

Referenced by guidance_v_set_ref().

+ Here is the caller graph for this function:

◆ gv_update_ref_from_z_sp()

◆ gv_update_ref_from_zd_sp()

void gv_update_ref_from_zd_sp ( int32_t  zd_sp,
int32_t  z_pos 
)

update vertical reference from speed setpoint.

Parameters
zd_spvertical speed setpoint with INT32_SPEED_FRAC
z_poscurrent vertical position (z-down) with INT32_POS_FRAC

Definition at line 129 of file guidance_v_ref.c.

References GV_MAX_Z_DIFF, GV_MAX_ZD, GV_MAX_ZDD, GV_MIN_ZD, GV_MIN_ZDD, GV_REF_INV_THAU, GV_REF_INV_THAU_FRAC, gv_z_ref, GV_Z_REF_FRAC, gv_zd_ref, GV_ZD_REF_FRAC, gv_zdd_ref, GV_ZDD_REF_FRAC, INT32_POS_FRAC, and INT32_SPEED_FRAC.

Variable Documentation

◆ gv_z_ref

int64_t gv_z_ref
extern

reference model altitude in meters (output) fixed point representation with GV_Z_REF_FRAC Q37.26 :

Definition at line 47 of file guidance_v_ref.c.

Referenced by guidance_v_from_nav(), gv_set_ref(), gv_update_ref_from_z_sp(), and gv_update_ref_from_zd_sp().

◆ gv_zd_ref

int32_t gv_zd_ref
extern

reference model vertical speed in meters/sec (output) fixed point representation with GV_ZD_REF_FRAC Q14.17 : accuracy 0.0000076 , range 16384m/s2

Definition at line 41 of file guidance_v_ref.c.

Referenced by guidance_v_from_nav(), gv_set_ref(), gv_update_ref_from_z_sp(), and gv_update_ref_from_zd_sp().

◆ gv_zdd_ref

int32_t gv_zdd_ref
extern

reference model vertical accel in meters/s^2 (output) fixed point representation with GV_ZDD_REF_FRAC Q23.8 : accuracy 0.0039 , range 8388km/s^2

Definition at line 35 of file guidance_v_ref.c.

Referenced by guidance_v_from_nav(), gv_set_ref(), gv_update_ref_from_z_sp(), and gv_update_ref_from_zd_sp().