Paparazzi UAS  v7.0_unstable
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 
29 #include "modules/nav/common_nav.h"
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_con gvf_parametric_control
gvf_parametric_tra gvf_parametric_trajectory
Guiding vector field algorithm for 2D and 3D parametric trajectories.
#define GVF_PARAMETRIC_3D_ELLIPSE_KX
#define GVF_PARAMETRIC_3D_ELLIPSE_KY
#define GVF_PARAMETRIC_3D_ELLIPSE_ZH
#define GVF_PARAMETRIC_3D_ELLIPSE_ALPHA
#define GVF_PARAMETRIC_3D_ELLIPSE_KZ
void gvf_parametric_3d_ellipse_info(float *f1, float *f2, float *f3, float *f1d, float *f2d, float *f3d, float *f1dd, float *f2dd, float *f3dd)
#define GVF_PARAMETRIC_3D_ELLIPSE_ZL
#define GVF_PARAMETRIC_3D_ELLIPSE_R
gvf_par_3d_ell_par gvf_parametric_3d_ellipse_par
Guiding vector field algorithm for 2D and 3D complex trajectories.