Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
guidance_h_ref.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2013 The Paparazzi Team
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
27 #ifndef GUIDANCE_H_REF_H
28 #define GUIDANCE_H_REF_H
29 
30 #include "inttypes.h"
31 #include "math/pprz_algebra.h"
32 #include "math/pprz_algebra_int.h"
33 #include "generated/airframe.h"
34 
36 #ifndef GUIDANCE_H_REF_MAX_SPEED
37 #define GUIDANCE_H_REF_MAX_SPEED 5.
38 #endif
39 
43 extern float gh_max_speed;
44 
48 #ifndef GUIDANCE_H_REF_MAX_ACCEL
49 #define GUIDANCE_H_REF_MAX_ACCEL 5.66
50 #endif
51 
54 #define GH_FREQ_FRAC 9
55 #define GH_FREQ (1<<GH_FREQ_FRAC)
56 
57 #define GH_ACCEL_REF_FRAC 8
58 #define GH_SPEED_REF_FRAC (GH_ACCEL_REF_FRAC + GH_FREQ_FRAC)
59 #define GH_POS_REF_FRAC (GH_SPEED_REF_FRAC + GH_FREQ_FRAC)
60 
61 struct GuidanceHRef {
67  struct Int32Vect2 accel;
68 
74  struct Int32Vect2 speed;
75 
80  struct Int64Vect2 pos;
81 
82  float tau;
83  float omega;
84  float zeta;
85 
89  float max_speed;
90 
91  /*
92  * internal variables
93  */
97 
100 
105 
109 };
110 
111 extern struct GuidanceHRef gh_ref;
112 
113 extern void gh_ref_init(void);
114 extern void gh_set_ref(struct Int32Vect2 pos, struct Int32Vect2 speed, struct Int32Vect2 accel);
115 extern void gh_update_ref_from_pos_sp(struct Int32Vect2 pos_sp);
117 
123 extern float gh_set_max_speed(float max_speed);
124 
125 extern float gh_set_tau(float tau);
126 extern float gh_set_omega(float omega);
127 extern float gh_set_zeta(float zeta);
128 
129 #endif /* GUIDANCE_H_REF_H */
speed_sp
struct FloatVect3 speed_sp
Definition: guidance_indi_hybrid.c:134
GuidanceHRef::max_accel
struct Int32Vect2 max_accel
Definition: guidance_h_ref.h:99
gh_ref
struct GuidanceHRef gh_ref
Definition: guidance_h_ref.c:30
GuidanceHRef::c_route_ref
int32_t c_route_ref
Definition: guidance_h_ref.h:108
gh_ref_init
void gh_ref_init(void)
Definition: guidance_h_ref.c:62
GuidanceHRef::inv_tau
int32_t inv_tau
Definition: guidance_h_ref.h:96
GuidanceHRef::zeta_omega
int32_t zeta_omega
Definition: guidance_h_ref.h:94
gh_set_omega
float gh_set_omega(float omega)
Definition: guidance_h_ref.c:89
gh_set_zeta
float gh_set_zeta(float zeta)
Definition: guidance_h_ref.c:98
GuidanceHRef::max_speed_int
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...
Definition: guidance_h_ref.h:104
GuidanceHRef::speed
struct Int32Vect2 speed
Reference model speed.
Definition: guidance_h_ref.h:74
pprz_algebra_int.h
Paparazzi fixed point algebra.
gh_max_speed
float gh_max_speed
Current maximum speed for waypoint navigation.
gh_set_max_speed
float gh_set_max_speed(float max_speed)
Set a new maximum speed for waypoint navigation.
Definition: guidance_h_ref.c:73
Int32Vect2
Definition: pprz_algebra_int.h:83
GuidanceHRef::route_ref
int32_t route_ref
Definition: guidance_h_ref.h:106
gh_set_tau
float gh_set_tau(float tau)
Definition: guidance_h_ref.c:81
gh_set_ref
void gh_set_ref(struct Int32Vect2 pos, struct Int32Vect2 speed, struct Int32Vect2 accel)
Definition: guidance_h_ref.c:106
gh_update_ref_from_pos_sp
void gh_update_ref_from_pos_sp(struct Int32Vect2 pos_sp)
Definition: guidance_h_ref.c:116
gh_update_ref_from_speed_sp
void gh_update_ref_from_speed_sp(struct Int32Vect2 speed_sp)
Definition: guidance_h_ref.c:148
GuidanceHRef::tau
float tau
first order time constant
Definition: guidance_h_ref.h:82
GuidanceHRef
Definition: guidance_h_ref.h:61
GuidanceHRef::s_route_ref
int32_t s_route_ref
Definition: guidance_h_ref.h:107
Int64Vect2
Definition: pprz_algebra_int.h:192
GuidanceHRef::max_vel
struct Int32Vect2 max_vel
Definition: guidance_h_ref.h:98
int32_t
signed long int32_t
Definition: types.h:19
GuidanceHRef::omega_2
int32_t omega_2
Definition: guidance_h_ref.h:95
GuidanceHRef::accel
struct Int32Vect2 accel
Reference model acceleration.
Definition: guidance_h_ref.h:67
pprz_algebra.h
Paparazzi generic algebra macros.
GuidanceHRef::zeta
float zeta
second order model damping
Definition: guidance_h_ref.h:84
GuidanceHRef::max_speed
float max_speed
Current maximum speed for waypoint navigation.
Definition: guidance_h_ref.h:89
GuidanceHRef::omega
float omega
second order model natural frequency
Definition: guidance_h_ref.h:83
inttypes.h
GuidanceHRef::pos
struct Int64Vect2 pos
Reference model position.
Definition: guidance_h_ref.h:80