Paparazzi UAS  v6.3_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 
34 #ifndef GVF_OCAML_GCS
35 #define GVF_OCAML_GCS true
36 #endif
37 
38 #include "std.h"
39 
47 typedef struct {
48  float ke;
49  float kn;
50  float error;
51  float omega;
53 } gvf_con;
54 
55 extern gvf_con gvf_control;
56 
57 typedef struct {
58  float course;
59  float px_dot;
60  float py_dot;
61 } gvf_st;
62 
63 extern gvf_st gvf_state;
64 
66  LINE = 0,
68  SIN,
69  NONE = 255,
70 };
71 
72 typedef struct {
73  enum trajectories type;
74  float p[16];
75 } gvf_tra;
76 
85 typedef struct {
86  int seg;
87  float x1;
88  float y1;
89  float x2;
90  float y2;
91 } gvf_seg;
92 
93 extern gvf_tra gvf_trajectory;
94 
95 struct gvf_grad {
96  float nx;
97  float ny;
98  float nz;
99 };
100 
101 struct gvf_Hess {
102  float H11;
103  float H12;
104  float H13;
105  float H21;
106  float H22;
107  float H23;
108  float H31;
109  float H32;
110  float H33;
111 };
112 
113 extern void gvf_init(void);
114 void gvf_control_2D(float ke, float kn, float e,
115  struct gvf_grad *, struct gvf_Hess *);
116 extern void gvf_set_direction(int8_t s);
117 
118 // Straigh line
119 extern bool gvf_line_XY_heading(float x, float y, float heading);
120 extern bool gvf_line_XY1_XY2(float x1, float y1, float x2, float y2);
121 extern bool gvf_line_wp1_wp2(uint8_t wp1, uint8_t wp2);
122 extern bool gvf_segment_loop_XY1_XY2(float x1, float y1, float x2, float y2, float d1, float d2);
123 extern bool gvf_segment_loop_wp1_wp2(uint8_t wp1, uint8_t wp2, float d1, float d2);
124 extern bool gvf_segment_XY1_XY2(float x1, float y1, float x2, float y2);
125 extern bool gvf_segment_wp1_wp2(uint8_t wp1, uint8_t wp2);
126 extern bool gvf_line_wp_heading(uint8_t wp, float heading);
127 
128 
129 // Ellipse
130 extern bool gvf_ellipse_wp(uint8_t wp, float a, float b, float alpha);
131 extern bool gvf_ellipse_XY(float x, float y, float a, float b, float alpha);
132 
133 // Sinusoidal
134 extern bool gvf_sin_XY_alpha(float x, float y, float alpha, float w, float off, float A);
135 extern bool gvf_sin_wp1_wp2(uint8_t wp1, uint8_t wp2, float w, float off,
136  float A);
137 extern bool gvf_sin_wp_alpha(uint8_t wp, float alpha, float w, float off,
138  float A);
139 
140 
141 #endif // GVF_H
static uint16_t d1
Definition: baro_MS5534A.c:202
static uint16_t d2
Definition: baro_MS5534A.c:202
#define A
float ke
Definition: gvf.h:48
float H13
Definition: gvf.h:104
float x1
Definition: gvf.h:87
float H12
Definition: gvf.h:103
float error
Definition: gvf.h:50
float py_dot
Definition: gvf.h:60
bool gvf_segment_XY1_XY2(float x1, float y1, float x2, float y2)
Definition: gvf.c:305
bool gvf_segment_loop_XY1_XY2(float x1, float y1, float x2, float y2, float d1, float d2)
Definition: gvf.c:265
float H23
Definition: gvf.h:107
bool gvf_ellipse_wp(uint8_t wp, float a, float b, float alpha)
Definition: gvf.c:395
float H21
Definition: gvf.h:105
int8_t s
Definition: gvf.h:52
bool gvf_line_wp1_wp2(uint8_t wp1, uint8_t wp2)
Definition: gvf.c:251
float H11
Definition: gvf.h:102
trajectories
Definition: gvf.h:65
@ SIN
Definition: gvf.h:68
@ ELLIPSE
Definition: gvf.h:67
@ LINE
Definition: gvf.h:66
@ NONE
Definition: gvf.h:69
float ny
Definition: gvf.h:97
gvf_con gvf_control
Definition: gvf.c:34
bool gvf_sin_wp1_wp2(uint8_t wp1, uint8_t wp2, float w, float off, float A)
Definition: gvf.c:431
bool gvf_segment_wp1_wp2(uint8_t wp1, uint8_t wp2)
Definition: gvf.c:327
bool gvf_sin_wp_alpha(uint8_t wp, float alpha, float w, float off, float A)
Definition: gvf.c:454
void gvf_init(void)
Definition: gvf.c:114
float nz
Definition: gvf.h:98
float nx
Definition: gvf.h:96
gvf_st gvf_state
Definition: gvf.c:37
void gvf_set_direction(int8_t s)
Definition: gvf.c:189
int seg
Definition: gvf.h:86
bool gvf_line_XY_heading(float x, float y, float heading)
Definition: gvf.c:220
bool gvf_sin_XY_alpha(float x, float y, float alpha, float w, float off, float A)
Definition: gvf.c:406
float y1
Definition: gvf.h:88
float H32
Definition: gvf.h:109
gvf_tra gvf_trajectory
Definition: gvf.c:40
float y2
Definition: gvf.h:90
float course
Definition: gvf.h:58
bool gvf_segment_loop_wp1_wp2(uint8_t wp1, uint8_t wp2, float d1, float d2)
Definition: gvf.c:289
float px_dot
Definition: gvf.h:59
void gvf_control_2D(float ke, float kn, float e, struct gvf_grad *, struct gvf_Hess *)
Definition: gvf.c:127
float x2
Definition: gvf.h:89
float H31
Definition: gvf.h:108
float kn
Definition: gvf.h:49
float H22
Definition: gvf.h:106
float H33
Definition: gvf.h:110
bool gvf_ellipse_XY(float x, float y, float a, float b, float alpha)
Definition: gvf.c:356
bool gvf_line_wp_heading(uint8_t wp, float heading)
Definition: gvf.c:341
bool gvf_line_XY1_XY2(float x1, float y1, float x2, float y2)
Definition: gvf.c:227
float omega
Definition: gvf.h:51
Definition: gvf.h:101
Definition: gvf.h:47
Definition: gvf.h:95
Definition: gvf.h:85
Definition: gvf.h:57
Definition: gvf.h:72
static float p[2][2]
static uint32_t s
float alpha
Definition: textons.c:107
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
signed char int8_t
Typedef defining 8 bit char type.
Definition: vl53l1_types.h:103
float b
Definition: wedgebug.c:202
float heading
Definition: wedgebug.c:258