Paparazzi UAS  v6.2_unstable
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"
34 #include "generated/airframe.h"
36 
38 #ifndef GUIDANCE_H_REF_MAX_SPEED
39 #define GUIDANCE_H_REF_MAX_SPEED 5.
40 #endif
41 
45 extern float gh_max_speed;
46 
50 #ifndef GUIDANCE_H_REF_MAX_ACCEL
51 #define GUIDANCE_H_REF_MAX_ACCEL 5.66
52 #endif
53 
58 #define GH_POS_REF_FRAC 37
59 
60 struct GuidanceHRef {
64  struct FloatVect2 accel;
65 
70  struct FloatVect2 speed;
71 
76  struct Int64Vect2 pos;
77 
78  float tau;
79  float omega;
80  float zeta;
81 
85  float max_speed;
86 
87  /*
88  * internal variables
89  */
90  float zeta_omega;
91  float omega_2;
92  float inv_tau;
93 
96  float dt;
97 };
98 
99 extern struct GuidanceHRef gh_ref;
100 
101 extern void gh_ref_init(void);
102 extern void gh_set_ref(struct Int32Vect2 pos, struct FloatVect2 speed, struct FloatVect2 accel);
103 extern void gh_update_ref_from_pos_sp(struct Int32Vect2 pos_sp);
105 
111 extern float gh_set_max_speed(float max_speed);
112 
113 extern float gh_set_tau(float tau);
114 extern float gh_set_omega(float omega);
115 extern float gh_set_zeta(float zeta);
116 
117 #endif /* GUIDANCE_H_REF_H */
gh_ref
struct GuidanceHRef gh_ref
Definition: guidance_h_ref.c:30
gh_ref_init
void gh_ref_init(void)
Definition: guidance_h_ref.c:51
GuidanceHRef::accel
struct FloatVect2 accel
Reference model acceleration.
Definition: guidance_h_ref.h:64
gh_set_omega
float gh_set_omega(float omega)
Definition: guidance_h_ref.c:78
gh_set_zeta
float gh_set_zeta(float zeta)
Definition: guidance_h_ref.c:87
pprz_algebra_float.h
Paparazzi floating point algebra.
pprz_algebra_int.h
Paparazzi fixed point algebra.
gh_max_speed
float gh_max_speed
Current maximum speed for waypoint navigation.
FloatVect2
Definition: pprz_algebra_float.h:49
gh_update_ref_from_speed_sp
void gh_update_ref_from_speed_sp(struct FloatVect2 speed_sp)
Definition: guidance_h_ref.c:143
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:63
Int32Vect2
Definition: pprz_algebra_int.h:83
GuidanceHRef::inv_tau
float inv_tau
Definition: guidance_h_ref.h:92
GuidanceHRef::dt
float dt
Integration timestep.
Definition: guidance_h_ref.h:96
gh_set_tau
float gh_set_tau(float tau)
Definition: guidance_h_ref.c:70
GuidanceHRef::speed
struct FloatVect2 speed
Reference model speed.
Definition: guidance_h_ref.h:70
gh_update_ref_from_pos_sp
void gh_update_ref_from_pos_sp(struct Int32Vect2 pos_sp)
Definition: guidance_h_ref.c:105
GuidanceHRef::tau
float tau
first order time constant
Definition: guidance_h_ref.h:78
GuidanceHRef
Definition: guidance_h_ref.h:60
Int64Vect2
Definition: pprz_algebra_int.h:192
pprz_algebra.h
Paparazzi generic algebra macros.
GuidanceHRef::zeta_omega
float zeta_omega
Definition: guidance_h_ref.h:90
GuidanceHRef::zeta
float zeta
second order model damping
Definition: guidance_h_ref.h:80
GuidanceHRef::max_speed
float max_speed
Current maximum speed for waypoint navigation.
Definition: guidance_h_ref.h:85
GuidanceHRef::omega
float omega
second order model natural frequency
Definition: guidance_h_ref.h:79
gh_set_ref
void gh_set_ref(struct Int32Vect2 pos, struct FloatVect2 speed, struct FloatVect2 accel)
Definition: guidance_h_ref.c:95
GuidanceHRef::pos
struct Int64Vect2 pos
Reference model position.
Definition: guidance_h_ref.h:76
GuidanceHRef::omega_2
float omega_2
Definition: guidance_h_ref.h:91
speed_sp
struct FloatVect3 speed_sp
Definition: guidance_indi.c:76