Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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 
RoverNavOval
Definition: nav_rover_base.h:54
OC1
@ OC1
Definition: nav_rover_base.h:53
RoverNavGoto::leg_progress
float leg_progress
progress over leg
Definition: nav_rover_base.h:38
RoverNavGoto::dist2_to_wp
float dist2_to_wp
squared distance to next waypoint
Definition: nav_rover_base.h:37
OR21
@ OR21
Definition: nav_rover_base.h:53
nav_rover_base
struct RoverNavBase nav_rover_base
Definition: nav_rover_base.c:29
RoverNavCircle::qdr
float qdr
qdr in radians
Definition: nav_rover_base.h:47
RoverNavGoto::from
struct EnuCoor_f from
start WP position
Definition: nav_rover_base.h:35
RoverNavOval::status
enum oval_status status
oval status
Definition: nav_rover_base.h:55
RoverNavBase
Basic Nav struct.
Definition: nav_rover_base.h:61
uint8_t
unsigned char uint8_t
Definition: types.h:14
RoverNavGoto
Waypoint and route pattern.
Definition: nav_rover_base.h:34
EnuCoor_f
vector in East North Up coordinates Units: meters
Definition: pprz_geodetic_float.h:72
OC2
@ OC2
Definition: nav_rover_base.h:53
RoverNavCircle::center
struct EnuCoor_f center
center WP position
Definition: nav_rover_base.h:45
RoverNavCircle::radians
float radians
incremental angular distance
Definition: nav_rover_base.h:48
nav_rover_init
void nav_rover_init(void)
Init and register nav functions.
Definition: nav_rover_base.c:287
RoverNavBase::circle
struct RoverNavCircle circle
Definition: nav_rover_base.h:63
oval_status
oval_status
Definition: nav.h:53
RoverNavCircle
Circle pattern.
Definition: nav_rover_base.h:44
RoverNavBase::oval
struct RoverNavOval oval
Definition: nav_rover_base.h:64
navigation.h
RoverNavGoto::leg_length
float leg_length
leg length
Definition: nav_rover_base.h:39
RoverNavOval::count
uint8_t count
number of laps
Definition: nav_rover_base.h:56
OR12
@ OR12
Definition: nav_rover_base.h:53
RoverNavBase::goto_wp
struct RoverNavGoto goto_wp
Definition: nav_rover_base.h:62
RoverNavCircle::radius
float radius
radius in meters
Definition: nav_rover_base.h:46
RoverNavGoto::to
struct EnuCoor_f to
end WP position
Definition: nav_rover_base.h:36