30 #include "generated/flight_plan.h"
31 #include "generated/airframe.h"
71 if (tmp == mission.
insert_idx) {
return false; }
149 if (j == 0) { index_list[j++] = 0; }
151 float remaining_time = -1.;
167 if (DL_MISSION_GOTO_WP_ac_id(
dl_buffer) != AC_ID) {
return false; }
184 if (DL_MISSION_GOTO_WP_LLA_ac_id(
dl_buffer) != AC_ID) {
return false; }
205 if (DL_MISSION_CIRCLE_ac_id(
dl_buffer) != AC_ID) {
return false; }
209 me.
element.mission_circle.center.center_f.x = DL_MISSION_CIRCLE_center_east(
dl_buffer);
210 me.
element.mission_circle.center.center_f.y = DL_MISSION_CIRCLE_center_north(
dl_buffer);
211 me.
element.mission_circle.center.center_f.z = DL_MISSION_CIRCLE_center_alt(
dl_buffer);
223 if (DL_MISSION_CIRCLE_LLA_ac_id(
dl_buffer) != AC_ID) {
return false; }
245 if (DL_MISSION_SEGMENT_ac_id(
dl_buffer) != AC_ID) {
return false; }
249 me.
element.mission_segment.from.from_f.x = DL_MISSION_SEGMENT_segment_east_1(
dl_buffer);
250 me.
element.mission_segment.from.from_f.y = DL_MISSION_SEGMENT_segment_north_1(
dl_buffer);
251 me.
element.mission_segment.from.from_f.z = DL_MISSION_SEGMENT_segment_alt(
dl_buffer);
252 me.
element.mission_segment.to.to_f.x = DL_MISSION_SEGMENT_segment_east_2(
dl_buffer);
253 me.
element.mission_segment.to.to_f.y = DL_MISSION_SEGMENT_segment_north_2(
dl_buffer);
254 me.
element.mission_segment.to.to_f.z = DL_MISSION_SEGMENT_segment_alt(
dl_buffer);
265 if (DL_MISSION_SEGMENT_LLA_ac_id(
dl_buffer) != AC_ID) {
return false; }
268 from_lla.
lat = DL_MISSION_SEGMENT_LLA_segment_lat_1(
dl_buffer);
269 from_lla.
lon = DL_MISSION_SEGMENT_LLA_segment_lon_1(
dl_buffer);
270 from_lla.
alt = DL_MISSION_SEGMENT_LLA_segment_alt(
dl_buffer);
271 to_lla.
lat = DL_MISSION_SEGMENT_LLA_segment_lat_2(
dl_buffer);
272 to_lla.
lon = DL_MISSION_SEGMENT_LLA_segment_lon_2(
dl_buffer);
273 to_lla.
alt = DL_MISSION_SEGMENT_LLA_segment_alt(
dl_buffer);
290 if (DL_MISSION_PATH_ac_id(
dl_buffer) != AC_ID) {
return false; }
294 me.
element.mission_path.path.path_f[0].x = DL_MISSION_PATH_point_east_1(
dl_buffer);
295 me.
element.mission_path.path.path_f[0].y = DL_MISSION_PATH_point_north_1(
dl_buffer);
296 me.
element.mission_path.path.path_f[0].z = DL_MISSION_PATH_path_alt(
dl_buffer);
297 me.
element.mission_path.path.path_f[1].x = DL_MISSION_PATH_point_east_2(
dl_buffer);
298 me.
element.mission_path.path.path_f[1].y = DL_MISSION_PATH_point_north_2(
dl_buffer);
299 me.
element.mission_path.path.path_f[1].z = DL_MISSION_PATH_path_alt(
dl_buffer);
300 me.
element.mission_path.path.path_f[2].x = DL_MISSION_PATH_point_east_3(
dl_buffer);
301 me.
element.mission_path.path.path_f[2].y = DL_MISSION_PATH_point_north_3(
dl_buffer);
302 me.
element.mission_path.path.path_f[2].z = DL_MISSION_PATH_path_alt(
dl_buffer);
303 me.
element.mission_path.path.path_f[3].x = DL_MISSION_PATH_point_east_4(
dl_buffer);
304 me.
element.mission_path.path.path_f[3].y = DL_MISSION_PATH_point_north_4(
dl_buffer);
305 me.
element.mission_path.path.path_f[3].z = DL_MISSION_PATH_path_alt(
dl_buffer);
306 me.
element.mission_path.path.path_f[4].x = DL_MISSION_PATH_point_east_5(
dl_buffer);
307 me.
element.mission_path.path.path_f[4].y = DL_MISSION_PATH_point_north_5(
dl_buffer);
308 me.
element.mission_path.path.path_f[4].z = DL_MISSION_PATH_path_alt(
dl_buffer);
311 me.
element.mission_path.path_idx = 0;
322 if (DL_MISSION_PATH_LLA_ac_id(
dl_buffer) != AC_ID) {
return false; }
325 lla[0].
lat = DL_MISSION_PATH_LLA_point_lat_1(
dl_buffer);
326 lla[0].
lon = DL_MISSION_PATH_LLA_point_lon_1(
dl_buffer);
328 lla[1].
lat = DL_MISSION_PATH_LLA_point_lat_2(
dl_buffer);
329 lla[1].
lon = DL_MISSION_PATH_LLA_point_lon_2(
dl_buffer);
331 lla[2].
lat = DL_MISSION_PATH_LLA_point_lat_3(
dl_buffer);
332 lla[2].
lon = DL_MISSION_PATH_LLA_point_lon_3(
dl_buffer);
334 lla[3].
lat = DL_MISSION_PATH_LLA_point_lat_4(
dl_buffer);
335 lla[3].
lon = DL_MISSION_PATH_LLA_point_lon_4(
dl_buffer);
337 lla[4].
lat = DL_MISSION_PATH_LLA_point_lat_5(
dl_buffer);
338 lla[4].
lon = DL_MISSION_PATH_LLA_point_lon_5(
dl_buffer);
346 for (i = 0; i < me.
element.mission_path.nb; i++) {
350 me.
element.mission_path.path_idx = 0;
361 if (DL_MISSION_CUSTOM_ac_id(
dl_buffer) != AC_ID) {
return false; }
366 if (me.
element.mission_custom.reg == NULL) {
370 for (
int i = 0; i < me.
element.mission_custom.nb; i++) {
371 me.
element.mission_custom.params[i] = DL_MISSION_CUSTOM_params(
dl_buffer)[i];
383 if (DL_GOTO_MISSION_ac_id(
dl_buffer) != AC_ID) {
return false; }
388 }
else {
return false; }
395 if (DL_NEXT_MISSION_ac_id(
dl_buffer) != AC_ID) {
return false; }
406 if (DL_END_MISSION_ac_id(
dl_buffer) != AC_ID) {
return false; }
int mission_parse_NEXT_MISSION(void)
replace the next element and remove all the others
int mission_parse_CUSTOM(void)
int mission_parse_SEGMENT(void)
char type[MISSION_TYPE_SIZE]
mission element identifier (5 char max + 1 \0)
bool(* mission_custom_cb)(uint8_t nb, float *params, bool init)
custom mission element callback
struct _mission_element * mission_get(void)
Get current mission element.
struct _mission_registered registered[MISSION_REGISTER_NB]
Handling of messages coming from ground and other A/Cs.
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.
bool mission_element_convert(struct _mission_element *el)
Convert mission element's points format if needed.
bool mission_register(mission_custom_cb cb, char *type)
Register a new navigation or action callback function.
void mission_status_report(void)
Report mission status.
remove all elements and add the new one
union _mission_element::@289 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_GOTO_WP(void)
Parsing functions called when a mission message is received.
int mission_parse_CIRCLE(void)
int32_t alt
in millimeters above WGS84 reference ellipsoid
float element_time
time in second spend in the current element
int mission_parse_GOTO_WP_LLA(void)
#define MISSION_ELEMENT_NB
Max number of elements in the tasks' list can be redefined.
mission_custom_cb cb
navigation/action function callback
int mission_parse_PATH(void)
int32_t lon
in degrees*1e7
uint8_t insert_idx
inserstion index
int mission_parse_SEGMENT_LLA(void)
#define MISSION_TYPE_SIZE
int mission_parse_GOTO_MISSION(void)
uint8_t index
index of mission element
uint8_t current_idx
current mission element index
Common code for AP and FBW telemetry.
uint8_t dl_buffer[MSG_SIZE]
struct _mission_element elements[MISSION_ELEMENT_NB]
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.
int32_t lat
in degrees*1e7
static struct _mission_registered * mission_get_registered(char *type)
int mission_parse_PATH_LLA(void)
int mission_parse_CIRCLE_LLA(void)
int mission_parse_END_MISSION(void)