Paparazzi UAS  v5.15_devel-81-gd13dafb
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mission_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Paparazzi Team
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 
30 #ifndef MISSION_COMMON_H
31 #define MISSION_COMMON_H
32 
33 #include "std.h"
35 #include "math/pprz_geodetic_int.h"
36 
38  MissionWP = 1,
43 };
44 
51 };
52 
53 struct _mission_wp {
54  union {
55  struct EnuCoor_f wp_f;
56  struct EnuCoor_i wp_i;
57  } wp;
58 };
59 
61  union {
62  struct EnuCoor_f center_f;
63  struct EnuCoor_i center_i;
64  } center;
65 
66  float radius;
67 };
68 
70  union {
71  struct EnuCoor_f from_f;
72  struct EnuCoor_i from_i;
73  } from;
74 
75  union {
76  struct EnuCoor_f to_f;
77  struct EnuCoor_i to_i;
78  } to;
79 };
80 
81 #define MISSION_PATH_NB 5
82 struct _mission_path {
83  union {
84  struct EnuCoor_f path_f[MISSION_PATH_NB];
85  struct EnuCoor_i path_i[MISSION_PATH_NB];
86  } path;
87 
90 };
91 
92 #define MISSION_CUSTOM_MAX 12 // maximum number of parameters
93 #define MISSION_TYPE_SIZE 6
94 
101 typedef bool (*mission_custom_cb)(uint8_t nb, float *params, bool init);
102 
106 };
107 
112 };
113 
116  union {
117  struct _mission_wp mission_wp;
118  struct _mission_circle mission_circle;
119  struct _mission_segment mission_segment;
120  struct _mission_path mission_path;
121  struct _mission_custom mission_custom;
122  } element;
123 
124  float duration;
126 };
127 
131 #ifndef MISSION_ELEMENT_NB
132 #define MISSION_ELEMENT_NB 20
133 #endif
134 
138 #ifndef MISSION_REGISTER_NB
139 #define MISSION_REGISTER_NB 6
140 #endif
141 
142 struct _mission {
145  float element_time;
148 };
149 
150 extern struct _mission mission;
151 
154 extern void mission_init(void);
155 
161 extern bool mission_insert(enum MissionInsertMode insert, struct _mission_element *element);
162 
168 extern bool mission_register(mission_custom_cb cb, char *type);
169 
174 extern bool mission_element_convert(struct _mission_element *el);
175 
179 extern struct _mission_element *mission_get(void);
180 
187 extern bool mission_point_of_lla(struct EnuCoor_f *point, struct LlaCoor_i *lla);
188 
198 extern int mission_run(void);
199 
204 extern void mission_status_report(void);
205 
208 extern int mission_parse_GOTO_WP(void);
209 extern int mission_parse_GOTO_WP_LLA(void);
210 extern int mission_parse_CIRCLE(void);
211 extern int mission_parse_CIRCLE_LLA(void);
212 extern int mission_parse_SEGMENT(void);
213 extern int mission_parse_SEGMENT_LLA(void);
214 extern int mission_parse_PATH(void);
215 extern int mission_parse_PATH_LLA(void);
216 extern int mission_parse_CUSTOM(void);
217 extern int mission_parse_GOTO_MISSION(void);
218 extern int mission_parse_NEXT_MISSION(void);
219 extern int mission_parse_END_MISSION(void);
220 
221 #endif // MISSION_COMMON_H
222 
int mission_parse_CIRCLE_LLA(void)
replace the next element and remove all the others
int mission_parse_NEXT_MISSION(void)
char type[MISSION_TYPE_SIZE]
mission element identifier (5 char max + 1 \0)
int mission_parse_SEGMENT_LLA(void)
bool mission_element_convert(struct _mission_element *el)
Convert mission element's points format if needed.
int mission_parse_GOTO_WP(void)
Parsing functions called when a mission message is received.
bool(* mission_custom_cb)(uint8_t nb, float *params, bool init)
custom mission element callback
MissionType
vector in East North Up coordinates Units: meters
struct _mission_registered registered[MISSION_REGISTER_NB]
union _mission_circle::@291 center
MissionInsertMode
remove all elements and add the new one
union _mission_element::@295 element
float duration
time to spend in the element (<= 0 to disable)
add before the current element
vector in Latitude, Longitude and Altitude
#define MISSION_REGISTER_NB
Max number of registered nav/action callbacks can be redefined.
int mission_parse_PATH(void)
replace current element
void mission_init(void)
Init mission structure.
bool mission_insert(enum MissionInsertMode insert, struct _mission_element *element)
Insert a mission element according to the insertion mode.
int mission_parse_PATH_LLA(void)
struct _mission_registered * reg
pointer to a registered custom mission element
void mission_status_report(void)
Report mission status.
int mission_parse_GOTO_WP_LLA(void)
union _mission_segment::@293 to
Paparazzi floating point math for geodetic calculations.
struct _mission_element * mission_get(void)
Get current mission element.
float element_time
time in second spend in the current element
#define MISSION_ELEMENT_NB
Max number of elements in the tasks' list can be redefined.
uint8_t path_idx
#define MISSION_CUSTOM_MAX
add at the last position
union _mission_path::@294 path
mission_custom_cb cb
navigation/action function callback
Paparazzi fixed point math for geodetic calculations.
uint8_t insert_idx
inserstion index
uint8_t nb
number of parameters
#define MISSION_TYPE_SIZE
vector in East North Up coordinates
unsigned char uint8_t
Definition: types.h:14
uint8_t index
index of mission element
int mission_parse_END_MISSION(void)
uint8_t current_idx
current mission element index
int mission_parse_CIRCLE(void)
int mission_parse_GOTO_MISSION(void)
int mission_run(void)
Run mission.
bool mission_register(mission_custom_cb cb, char *type)
Register a new navigation or action callback function.
union _mission_wp::@290 wp
struct _mission_element elements[MISSION_ELEMENT_NB]
float params[MISSION_CUSTOM_MAX]
list of parameters
bool mission_point_of_lla(struct EnuCoor_f *point, struct LlaCoor_i *lla)
Get the ENU component of LLA mission point This function is firmware specific.
struct _mission mission
int mission_parse_SEGMENT(void)
union _mission_segment::@292 from
int mission_parse_CUSTOM(void)
enum MissionType type