Paparazzi UAS  v5.15_devel-88-gb3ad7fe
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
nav_rover_base.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Gautier Hattenberger <gautier.hattenberger@enac.fr>
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 
27 #ifndef NAV_ROVER_BASE_H
28 #define NAV_ROVER_BASE_H
29 
31 
34 struct RoverNavGoto {
35  struct EnuCoor_f from;
36  struct EnuCoor_f to;
37  float dist2_to_wp;
38  float leg_progress;
39  float leg_length;
40 };
41 
45  struct EnuCoor_f center;
46  float radius;
47  float qdr;
48  float radians;
49 };
50 
53 enum oval_status { OR12, OC2, OR21, OC1 };
54 struct RoverNavOval {
57 };
58 
61 struct RoverNavBase {
65 };
66 
67 extern struct RoverNavBase nav_rover_base;
68 
69 extern void nav_rover_init(void);
70 
71 
74 #define NavCircleCount() (fabsf(nav_rover_base.circle.radians) / (2*M_PI))
75 #define NavCircleQdr() ({ float qdr = DegOfRad(M_PI_2 - nav_rover_base.circle.qdr); NormCourse(qdr); qdr; })
76 
77 #define CloseDegAngles(_c1, _c2) ({ float _diff = _c1 - _c2; NormCourse(_diff); 350 < _diff || _diff < 10; })
78 #define CloseRadAngles(_c1, _c2) ({ float _diff = _c1 - _c2; NormRadAngle(_diff); fabsf(_diff) < 0.0177; })
79 
82 #define NavQdrCloseTo(x) CloseDegAngles(x, NavCircleQdr())
83 #define NavCourseCloseTo(x) CloseDegAngles(x, DegOfRad(stateGetHorizontalSpeedDir_f()))
84 
85 
86 #endif
87 
vector in East North Up coordinates Units: meters
unsigned char uint8_t
Definition: types.h:14
Rover navigation functions.