Paparazzi UAS  v5.18.0_stable
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 
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 {
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
gvf_con::s
int8_t s
Definition: gvf.h:46
gvf_Hess::H22
float H22
Definition: gvf.h:92
gvf_con
Definition: gvf.h:42
gvf_Hess::H32
float H32
Definition: gvf.h:95
gvf_line_wp1_wp2
bool gvf_line_wp1_wp2(uint8_t wp1, uint8_t wp2)
Definition: gvf.c:274
gvf_Hess::H13
float H13
Definition: gvf.h:90
d1
static uint16_t d1
Definition: baro_MS5534A.c:202
gvf_segment_loop_XY1_XY2
bool gvf_segment_loop_XY1_XY2(float x1, float y1, float x2, float y2, float d1, float d2)
Definition: gvf.c:284
gvf_ellipse_XY
bool gvf_ellipse_XY(float x, float y, float a, float b, float alpha)
Definition: gvf.c:361
b
float b
Definition: wedgebug.c:202
gvf_sin_wp_alpha
bool gvf_sin_wp_alpha(uint8_t wp, float alpha, float w, float off, float A)
Definition: gvf.c:447
gvf_grad::nz
float nz
Definition: gvf.h:84
s
static uint32_t s
Definition: light_scheduler.c:33
NONE
@ NONE
Definition: gvf.h:55
alpha
float alpha
Definition: textons.c:107
gvf_set_direction
void gvf_set_direction(int8_t s)
Definition: gvf.c:222
SIN
@ SIN
Definition: gvf.h:54
gvf_sin_wp1_wp2
bool gvf_sin_wp1_wp2(uint8_t wp1, uint8_t wp2, float w, float off, float A)
Definition: gvf.c:428
trajectories
trajectories
Definition: gvf.h:51
gvf_con::kn
float kn
Definition: gvf.h:44
gvf_tra
Definition: gvf.h:58
gvf_grad::ny
float ny
Definition: gvf.h:83
std.h
LINE
@ LINE
Definition: gvf.h:52
gvf_seg
Definition: gvf.h:71
gvf_line_XY_heading
bool gvf_line_XY_heading(float x, float y, float heading)
Definition: gvf.c:250
gvf_line_wp_heading
bool gvf_line_wp_heading(uint8_t wp, float heading)
Definition: gvf.c:349
gvf_Hess::H33
float H33
Definition: gvf.h:96
gvf_seg::x2
float x2
Definition: gvf.h:75
gvf_grad::nx
float nx
Definition: gvf.h:82
gvf_con::error
float error
Definition: gvf.h:45
gvf_control_2D
void gvf_control_2D(float ke, float kn, float e, struct gvf_grad *, struct gvf_Hess *)
Definition: gvf.c:154
A
#define A
Definition: pprz_geodetic_utm.h:44
gvf_line_XY1_XY2
bool gvf_line_XY1_XY2(float x1, float y1, float x2, float y2)
Definition: gvf.c:257
gvf_seg::seg
int seg
Definition: gvf.h:72
gvf_seg::y2
float y2
Definition: gvf.h:76
uint8_t
unsigned char uint8_t
Definition: types.h:14
gvf_Hess::H31
float H31
Definition: gvf.h:94
gvf_init
void gvf_init(void)
Definition: gvf.c:139
gvf_control
gvf_con gvf_control
Definition: gvf.c:37
gvf_Hess::H23
float H23
Definition: gvf.h:93
gvf_Hess::H12
float H12
Definition: gvf.h:89
gvf_Hess
Definition: gvf.h:87
int8_t
signed char int8_t
Definition: types.h:15
gvf_ellipse_wp
bool gvf_ellipse_wp(uint8_t wp, float a, float b, float alpha)
Definition: gvf.c:397
gvf_segment_loop_wp1_wp2
bool gvf_segment_loop_wp1_wp2(uint8_t wp1, uint8_t wp2, float d1, float d2)
Definition: gvf.c:307
type
timer subsystem type(config options) --------------------------------------------(advanced timers using RCC_APB1) TIM1 adc(if USE_AD_TIM1) radio_control/ppm(if USE_PPM_TIM1
gvf_seg::y1
float y1
Definition: gvf.h:74
gvf_Hess::H11
float H11
Definition: gvf.h:88
gvf_grad
Definition: gvf.h:81
ELLIPSE
@ ELLIPSE
Definition: gvf.h:53
gvf_trajectory
gvf_tra gvf_trajectory
Definition: gvf.c:40
gvf_Hess::H21
float H21
Definition: gvf.h:91
gvf_segment_wp1_wp2
bool gvf_segment_wp1_wp2(uint8_t wp1, uint8_t wp2)
Definition: gvf.c:339
gvf_seg::x1
float x1
Definition: gvf.h:73
p
static float p[2][2]
Definition: ins_alt_float.c:268
d2
static uint16_t d2
Definition: baro_MS5534A.c:202
gvf_segment_XY1_XY2
bool gvf_segment_XY1_XY2(float x1, float y1, float x2, float y2)
Definition: gvf.c:317
gvf_sin_XY_alpha
bool gvf_sin_XY_alpha(float x, float y, float alpha, float w, float off, float A)
Definition: gvf.c:405
heading
float heading
Definition: wedgebug.c:258
gvf_con::ke
float ke
Definition: gvf.h:43