Paparazzi UAS  v6.2_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 
33 #include "std.h"
34 
42 typedef struct {
43  float ke;
44  float kn;
45  float error;
46  float omega;
48 } gvf_con;
49 
50 extern gvf_con gvf_control;
51 
52 typedef struct {
53  float course;
54  float px_dot;
55  float py_dot;
56 } gvf_st;
57 
58 extern gvf_st gvf_state;
59 
61  LINE = 0,
63  SIN,
64  NONE = 255,
65 };
66 
67 typedef struct {
69  float p[16];
70 } gvf_tra;
71 
80 typedef struct {
81  int seg;
82  float x1;
83  float y1;
84  float x2;
85  float y2;
86 } gvf_seg;
87 
88 extern gvf_tra gvf_trajectory;
89 
90 struct gvf_grad {
91  float nx;
92  float ny;
93  float nz;
94 };
95 
96 struct gvf_Hess {
97  float H11;
98  float H12;
99  float H13;
100  float H21;
101  float H22;
102  float H23;
103  float H31;
104  float H32;
105  float H33;
106 };
107 
108 extern void gvf_init(void);
109 void gvf_control_2D(float ke, float kn, float e,
110  struct gvf_grad *, struct gvf_Hess *);
111 extern void gvf_set_direction(int8_t s);
112 
113 // Straigh line
114 extern bool gvf_line_XY_heading(float x, float y, float heading);
115 extern bool gvf_line_XY1_XY2(float x1, float y1, float x2, float y2);
116 extern bool gvf_line_wp1_wp2(uint8_t wp1, uint8_t wp2);
117 extern bool gvf_segment_loop_XY1_XY2(float x1, float y1, float x2, float y2, float d1, float d2);
118 extern bool gvf_segment_loop_wp1_wp2(uint8_t wp1, uint8_t wp2, float d1, float d2);
119 extern bool gvf_segment_XY1_XY2(float x1, float y1, float x2, float y2);
120 extern bool gvf_segment_wp1_wp2(uint8_t wp1, uint8_t wp2);
121 extern bool gvf_line_wp_heading(uint8_t wp, float heading);
122 
123 
124 // Ellipse
125 extern bool gvf_ellipse_wp(uint8_t wp, float a, float b, float alpha);
126 extern bool gvf_ellipse_XY(float x, float y, float a, float b, float alpha);
127 
128 // Sinusoidal
129 extern bool gvf_sin_XY_alpha(float x, float y, float alpha, float w, float off, float A);
130 extern bool gvf_sin_wp1_wp2(uint8_t wp1, uint8_t wp2, float w, float off,
131  float A);
132 extern bool gvf_sin_wp_alpha(uint8_t wp, float alpha, float w, float off,
133  float A);
134 
135 
136 #endif // GVF_H
gvf_con::s
int8_t s
Definition: gvf.h:47
gvf_Hess::H22
float H22
Definition: gvf.h:101
gvf_con
Definition: gvf.h:42
int8_t
signed char int8_t
Typedef defining 8 bit char type.
Definition: vl53l1_types.h:103
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
gvf_con::omega
float omega
Definition: gvf.h:46
gvf_Hess::H32
float H32
Definition: gvf.h:104
gvf_line_wp1_wp2
bool gvf_line_wp1_wp2(uint8_t wp1, uint8_t wp2)
Definition: gvf.c:269
gvf_Hess::H13
float H13
Definition: gvf.h:99
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:279
gvf_ellipse_XY
bool gvf_ellipse_XY(float x, float y, float a, float b, float alpha)
Definition: gvf.c:357
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:444
gvf_st::py_dot
float py_dot
Definition: gvf.h:55
gvf_grad::nz
float nz
Definition: gvf.h:93
s
static uint32_t s
Definition: light_scheduler.c:33
NONE
@ NONE
Definition: gvf.h:64
alpha
float alpha
Definition: textons.c:107
gvf_set_direction
void gvf_set_direction(int8_t s)
Definition: gvf.c:216
SIN
@ SIN
Definition: gvf.h:63
gvf_sin_wp1_wp2
bool gvf_sin_wp1_wp2(uint8_t wp1, uint8_t wp2, float w, float off, float A)
Definition: gvf.c:425
trajectories
trajectories
Definition: gvf.h:60
gvf_con::kn
float kn
Definition: gvf.h:44
gvf_tra
Definition: gvf.h:67
gvf_grad::ny
float ny
Definition: gvf.h:92
gvf_state
gvf_st gvf_state
Definition: gvf.c:37
std.h
LINE
@ LINE
Definition: gvf.h:61
gvf_seg
Definition: gvf.h:80
gvf_line_XY_heading
bool gvf_line_XY_heading(float x, float y, float heading)
Definition: gvf.c:245
gvf_line_wp_heading
bool gvf_line_wp_heading(uint8_t wp, float heading)
Definition: gvf.c:345
gvf_Hess::H33
float H33
Definition: gvf.h:105
gvf_seg::x2
float x2
Definition: gvf.h:84
gvf_grad::nx
float nx
Definition: gvf.h:91
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:252
gvf_seg::seg
int seg
Definition: gvf.h:81
gvf_seg::y2
float y2
Definition: gvf.h:85
gvf_Hess::H31
float H31
Definition: gvf.h:103
gvf_st
Definition: gvf.h:52
gvf_init
void gvf_init(void)
Definition: gvf.c:139
gvf_st::px_dot
float px_dot
Definition: gvf.h:54
gvf_control
gvf_con gvf_control
Definition: gvf.c:34
gvf_Hess::H23
float H23
Definition: gvf.h:102
gvf_Hess::H12
float H12
Definition: gvf.h:98
gvf_Hess
Definition: gvf.h:96
gvf_st::course
float course
Definition: gvf.h:53
gvf_ellipse_wp
bool gvf_ellipse_wp(uint8_t wp, float a, float b, float alpha)
Definition: gvf.c:394
gvf_segment_loop_wp1_wp2
bool gvf_segment_loop_wp1_wp2(uint8_t wp1, uint8_t wp2, float d1, float d2)
Definition: gvf.c:303
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:83
gvf_Hess::H11
float H11
Definition: gvf.h:97
gvf_grad
Definition: gvf.h:90
ELLIPSE
@ ELLIPSE
Definition: gvf.h:62
gvf_trajectory
gvf_tra gvf_trajectory
Definition: gvf.c:40
gvf_Hess::H21
float H21
Definition: gvf.h:100
gvf_segment_wp1_wp2
bool gvf_segment_wp1_wp2(uint8_t wp1, uint8_t wp2)
Definition: gvf.c:335
gvf_seg::x1
float x1
Definition: gvf.h:82
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:313
gvf_sin_XY_alpha
bool gvf_sin_XY_alpha(float x, float y, float alpha, float w, float off, float A)
Definition: gvf.c:402
heading
float heading
Definition: wedgebug.c:258
gvf_con::ke
float ke
Definition: gvf.h:43