28 #include "generated/airframe.h"
34 #define GH_MAX_SPEED_REF_FRAC 7
37 #ifndef GUIDANCE_H_REF_OMEGA
38 #define GUIDANCE_H_REF_OMEGA RadOfDeg(67.)
41 #ifndef GUIDANCE_H_REF_ZETA
42 #define GUIDANCE_H_REF_ZETA 0.85
45 #define GH_ZETA_OMEGA_FRAC 10
46 #define GH_OMEGA_2_FRAC 7
50 #ifndef GUIDANCE_H_REF_TAU
51 #define GUIDANCE_H_REF_TAU 0.5
53 #define GH_REF_INV_TAU_FRAC 16
174 float f_route_ref = atan2f(-ref_vector->
y, -ref_vector->
x);
188 if (ref_vector->
x == 0 && ref_vector->
y == 0) {
209 if (ref_vector->
x == 0 && ref_vector->
y == 0) {
224 if (ref_vector->
x == 0 && ref_vector->
y == 0) {
void gh_update_ref_from_pos_sp(struct Int32Vect2 pos_sp)
void gh_set_ref(struct Int32Vect2 pos, struct Int32Vect2 speed, struct Int32Vect2 accel)
static void gh_saturate_ref_accel(void)
saturate reference accelerations
Reference generation for horizontal guidance.
void gh_update_ref_from_speed_sp(struct Int32Vect2 speed_sp)
float gh_set_max_speed(float max_speed)
Set a new maximum speed for waypoint navigation.
#define GH_ZETA_OMEGA_FRAC
struct GuidanceHRef gh_ref
#define VECT2_SUM(_c, _a, _b)
static void gh_compute_route_ref(struct Int32Vect2 *ref_vector)
static void gh_compute_ref_max_accel(struct Int32Vect2 *ref_vector)
#define VECT2_DIFF(_c, _a, _b)
#define GUIDANCE_H_REF_TAU
first order time constant
#define GUIDANCE_H_REF_MAX_SPEED
Default speed saturation.
#define VECT2_ADD(_a, _b)
struct Int64Vect2 pos
Reference model position.
#define GUIDANCE_H_REF_OMEGA
default second order model natural frequency
#define BFP_OF_REAL(_vr, _frac)
#define PPRZ_ITRIG_SIN(_s, _a)
#define GUIDANCE_H_REF_MAX_ACCEL
Accel saturation.
float gh_set_omega(float omega)
float gh_set_tau(float tau)
float max_speed
Current maximum speed for waypoint navigation.
#define GH_SPEED_REF_FRAC
#define GH_REF_INV_TAU_FRAC
float tau
first order time constant
struct Int32Vect2 max_vel
#define VECT2_SMUL(_vo, _vi, _s)
#define ANGLE_BFP_OF_REAL(_af)
#define GH_ACCEL_REF_FRAC
struct Int32Vect2 speed
Reference model speed.
#define INT_MULT_RSHIFT(_a, _b, _r)
float omega
second order model natural frequency
int32_t max_speed_int
gh_max_speed in fixed point representation with GH_MAX_SPEED_REF_FRAC must be limited to 2^14 to avoi...
static void gh_saturate_ref_speed(void)
Saturate ref speed and adjust acceleration accordingly.
#define GUIDANCE_H_REF_ZETA
default second order model damping
struct Int32Vect2 accel
Reference model acceleration.
static void gh_compute_ref_max_speed(struct Int32Vect2 *ref_vector)
static const int32_t gh_max_accel
struct Int32Vect2 max_accel
float zeta
second order model damping
#define INT32_VECT2_RSHIFT(_o, _i, _r)
#define GH_MAX_SPEED_REF_FRAC
#define INT32_VECT2_LSHIFT(_o, _i, _l)
float gh_set_zeta(float zeta)
static void gh_compute_ref_max(struct Int32Vect2 *ref_vector)
#define PPRZ_ITRIG_COS(_c, _a)