Paparazzi UAS  v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
gvf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Hector Garcia de Marina
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  */
22 
28 #ifndef GVF_H
29 #define GVF_H
30 
31 #define GVF_GRAVITY 9.806
32 
33 #include "std.h"
34 
42 typedef struct {
43  float ke;
44  float kn;
45  float error;
47 } gvf_con;
48 
49 extern gvf_con gvf_control;
50 
52  LINE = 0,
54  SIN,
55  NONE = 255,
56 };
57 
58 typedef struct {
59  enum trajectories type;
60  float p[16];
61 } gvf_tra;
62 
71 typedef struct {
72  int seg;
73  float x1;
74  float y1;
75  float x2;
76  float y2;
77 } gvf_seg;
78 
79 extern gvf_tra gvf_trajectory;
80 
81 struct gvf_grad {
82  float nx;
83  float ny;
84  float nz;
85 };
86 
87 struct gvf_Hess {
88  float H11;
89  float H12;
90  float H13;
91  float H21;
92  float H22;
93  float H23;
94  float H31;
95  float H32;
96  float H33;
97 };
98 
99 extern void gvf_init(void);
100 void gvf_control_2D(float ke, float kn, float e,
101  struct gvf_grad *, struct gvf_Hess *);
102 extern void gvf_set_direction(int8_t s);
103 
104 // Straigh line
105 extern bool gvf_line_XY_heading(float x, float y, float heading);
106 extern bool gvf_line_XY1_XY2(float x1, float y1, float x2, float y2);
107 extern bool gvf_line_wp1_wp2(uint8_t wp1, uint8_t wp2);
108 extern bool gvf_segment_loop_XY1_XY2(float x1, float y1, float x2, float y2, float d1, float d2);
109 extern bool gvf_segment_loop_wp1_wp2(uint8_t wp1, uint8_t wp2, float d1, float d2);
110 extern bool gvf_segment_XY1_XY2(float x1, float y1, float x2, float y2);
111 extern bool gvf_segment_wp1_wp2(uint8_t wp1, uint8_t wp2);
112 extern bool gvf_line_wp_heading(uint8_t wp, float heading);
113 
114 
115 // Ellipse
116 extern bool gvf_ellipse_wp(uint8_t wp, float a, float b, float alpha);
117 extern bool gvf_ellipse_XY(float x, float y, float a, float b, float alpha);
118 
119 // Sinusoidal
120 extern bool gvf_sin_XY_alpha(float x, float y, float alpha, float w, float off, float A);
121 extern bool gvf_sin_wp1_wp2(uint8_t wp1, uint8_t wp2, float w, float off,
122  float A);
123 extern bool gvf_sin_wp_alpha(uint8_t wp, float alpha, float w, float off,
124  float A);
125 
126 
127 #endif // GVF_H
static uint16_t d2
Definition: baro_MS5534A.c:202
bool gvf_segment_loop_XY1_XY2(float x1, float y1, float x2, float y2, float d1, float d2)
Definition: gvf.c:279
float H22
Definition: gvf.h:92
float y2
Definition: gvf.h:76
bool gvf_line_wp_heading(uint8_t wp, float heading)
Definition: gvf.c:344
float H12
Definition: gvf.h:89
float ke
Definition: gvf.h:43
gvf_con gvf_control
Definition: gvf.c:37
Definition: gvf.h:71
gvf_tra gvf_trajectory
Definition: gvf.c:40
float alpha
Definition: textons.c:107
float H31
Definition: gvf.h:94
static uint16_t d1
Definition: baro_MS5534A.c:202
float H21
Definition: gvf.h:91
Definition: gvf.h:58
bool gvf_segment_wp1_wp2(uint8_t wp1, uint8_t wp2)
Definition: gvf.c:334
Definition: gvf.h:87
void gvf_init(void)
Definition: gvf.c:124
float nz
Definition: gvf.h:84
void gvf_set_direction(int8_t s)
Definition: gvf.c:205
float H13
Definition: gvf.h:90
Definition: gvf.h:53
bool gvf_line_wp1_wp2(uint8_t wp1, uint8_t wp2)
Definition: gvf.c:269
float x1
Definition: gvf.h:73
static float heading
Definition: ahrs_infrared.c:45
bool gvf_line_XY1_XY2(float x1, float y1, float x2, float y2)
Definition: gvf.c:240
float H33
Definition: gvf.h:96
Definition: gvf.h:42
float ny
Definition: gvf.h:83
float nx
Definition: gvf.h:82
bool gvf_sin_XY_alpha(float x, float y, float alpha, float w, float off, float A)
Definition: gvf.c:400
float x2
Definition: gvf.h:75
bool gvf_segment_XY1_XY2(float x1, float y1, float x2, float y2)
Definition: gvf.c:312
Definition: gvf.h:55
float y1
Definition: gvf.h:74
trajectories
Definition: gvf.h:51
float error
Definition: gvf.h:45
float kn
Definition: gvf.h:44
Definition: gvf.h:81
Definition: gvf.h:54
float H32
Definition: gvf.h:95
Definition: gvf.h:52
unsigned char uint8_t
Definition: types.h:14
bool gvf_segment_loop_wp1_wp2(uint8_t wp1, uint8_t wp2, float d1, float d2)
Definition: gvf.c:302
bool gvf_line_XY_heading(float x, float y, float heading)
Definition: gvf.c:233
float H23
Definition: gvf.h:93
static float p[2][2]
#define A
int seg
Definition: gvf.h:72
bool gvf_sin_wp_alpha(uint8_t wp, float alpha, float w, float off, float A)
Definition: gvf.c:442
bool gvf_sin_wp1_wp2(uint8_t wp1, uint8_t wp2, float w, float off, float A)
Definition: gvf.c:423
bool gvf_ellipse_XY(float x, float y, float a, float b, float alpha)
Definition: gvf.c:356
void gvf_control_2D(float ke, float kn, float e, struct gvf_grad *, struct gvf_Hess *)
Definition: gvf.c:139
signed char int8_t
Definition: types.h:15
bool gvf_ellipse_wp(uint8_t wp, float a, float b, float alpha)
Definition: gvf.c:392
int8_t s
Definition: gvf.h:46
float H11
Definition: gvf.h:88