Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
gvf_parametric_3d_ellipse.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Hector Garcia de Marina <hgarciad@ucm.es>
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, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
32 
34 #ifndef GVF_PARAMETRIC_3D_ELLIPSE_KX
35 #define GVF_PARAMETRIC_3D_ELLIPSE_KX 0.001
36 #endif
37 
39 #ifndef GVF_PARAMETRIC_3D_ELLIPSE_KY
40 #define GVF_PARAMETRIC_3D_ELLIPSE_KY 0.001
41 #endif
42 
44 #ifndef GVF_PARAMETRIC_3D_ELLIPSE_KZ
45 #define GVF_PARAMETRIC_3D_ELLIPSE_KZ 0.001
46 #endif
47 
49 #ifndef GVF_PARAMETRIC_3D_ELLIPSE_R
50 #define GVF_PARAMETRIC_3D_ELLIPSE_R 80
51 #endif
52 
54 #ifndef GVF_PARAMETRIC_3D_ELLIPSE_ZL
55 #define GVF_PARAMETRIC_3D_ELLIPSE_ZL 40
56 #endif
57 
59 #ifndef GVF_PARAMETRIC_3D_ELLIPSE_ZH
60 #define GVF_PARAMETRIC_3D_ELLIPSE_ZH 40
61 #endif
62 
64 #ifndef GVF_PARAMETRIC_3D_ELLIPSE_ALPHA
65 #define GVF_PARAMETRIC_3D_ELLIPSE_ALPHA 0
66 #endif
67 
70  };
71 
72 void gvf_parametric_3d_ellipse_info(float *f1, float *f2, float *f3, float *f1d, float *f2d, float *f3d,
73  float *f1dd, float *f2dd, float *f3dd)
74 {
80  float alpha_rad = gvf_parametric_trajectory.p_parametric[5]*M_PI/180;
81 
82  float w = gvf_parametric_control.w;
84 
85  // Parametric equations of the trajectory and the partial derivatives w.r.t. 'w'
86  *f1 = r * cosf(wb) + xo;
87  *f2 = r * sinf(wb) + yo;
88  *f3 = 0.5 * (zh + zl + (zl - zh) * sinf(alpha_rad - wb));
89 
90  *f1d = -r * sinf(wb);
91  *f2d = r * cosf(wb);
92  *f3d = -0.5 * (zl - zh) * cosf(alpha_rad - wb);
93 
94  *f1dd = -r * cosf(wb);
95  *f2dd = -r * sinf(wb);
96  *f3dd = -0.5 * (zl - zh) * sinf(alpha_rad - wb);
97 }
98 
gvf_parametric_3d_ellipse_par
gvf_par_3d_ell_par gvf_parametric_3d_ellipse_par
Definition: gvf_parametric_3d_ellipse.c:68
GVF_PARAMETRIC_3D_ELLIPSE_ZL
#define GVF_PARAMETRIC_3D_ELLIPSE_ZL
Definition: gvf_parametric_3d_ellipse.c:55
GVF_PARAMETRIC_3D_ELLIPSE_KX
#define GVF_PARAMETRIC_3D_ELLIPSE_KX
Definition: gvf_parametric_3d_ellipse.c:35
common_nav.h
gvf_parametric_tra::p_parametric
float p_parametric[16]
Definition: gvf_parametric.h:97
gvf_parametric_control
gvf_parametric_con gvf_parametric_control
Definition: gvf_parametric.cpp:44
gvf_par_3d_ell_par
Definition: gvf_parametric_3d_ellipse.h:46
gvf_parametric_3d_ellipse.h
gvf_parametric.h
GVF_PARAMETRIC_3D_ELLIPSE_KZ
#define GVF_PARAMETRIC_3D_ELLIPSE_KZ
Definition: gvf_parametric_3d_ellipse.c:45
gvf_parametric_con::w
float w
Definition: gvf_parametric.h:75
GVF_PARAMETRIC_3D_ELLIPSE_R
#define GVF_PARAMETRIC_3D_ELLIPSE_R
Definition: gvf_parametric_3d_ellipse.c:50
gvf_parametric_3d_ellipse_info
void gvf_parametric_3d_ellipse_info(float *f1, float *f2, float *f3, float *f1d, float *f2d, float *f3d, float *f1dd, float *f2dd, float *f3dd)
Definition: gvf_parametric_3d_ellipse.c:72
GVF_PARAMETRIC_3D_ELLIPSE_ALPHA
#define GVF_PARAMETRIC_3D_ELLIPSE_ALPHA
Definition: gvf_parametric_3d_ellipse.c:65
gvf_parametric_trajectory
gvf_parametric_tra gvf_parametric_trajectory
Definition: gvf_parametric.cpp:47
gvf_parametric_con::s
int8_t s
Definition: gvf_parametric.h:77
GVF_PARAMETRIC_3D_ELLIPSE_KY
#define GVF_PARAMETRIC_3D_ELLIPSE_KY
Definition: gvf_parametric_3d_ellipse.c:40
gvf_parametric_con::beta
float beta
Definition: gvf_parametric.h:82
GVF_PARAMETRIC_3D_ELLIPSE_ZH
#define GVF_PARAMETRIC_3D_ELLIPSE_ZH
Definition: gvf_parametric_3d_ellipse.c:60