30 #include "generated/flight_plan.h"
31 #include "generated/airframe.h"
113 if (j == 0) { index_list[j++] = 0; }
115 float remaining_time = -1.;
131 if (DL_MISSION_GOTO_WP_ac_id(
dl_buffer) != AC_ID) {
return false; }
148 if (DL_MISSION_GOTO_WP_LLA_ac_id(
dl_buffer) != AC_ID) {
return false; }
169 if (DL_MISSION_CIRCLE_ac_id(
dl_buffer) != AC_ID) {
return false; }
173 me.
element.mission_circle.center.center_f.x = DL_MISSION_CIRCLE_center_east(
dl_buffer);
174 me.
element.mission_circle.center.center_f.y = DL_MISSION_CIRCLE_center_north(
dl_buffer);
175 me.
element.mission_circle.center.center_f.z = DL_MISSION_CIRCLE_center_alt(
dl_buffer);
187 if (DL_MISSION_CIRCLE_LLA_ac_id(
dl_buffer) != AC_ID) {
return false; }
209 if (DL_MISSION_SEGMENT_ac_id(
dl_buffer) != AC_ID) {
return false; }
213 me.
element.mission_segment.from.from_f.x = DL_MISSION_SEGMENT_segment_east_1(
dl_buffer);
214 me.
element.mission_segment.from.from_f.y = DL_MISSION_SEGMENT_segment_north_1(
dl_buffer);
215 me.
element.mission_segment.from.from_f.z = DL_MISSION_SEGMENT_segment_alt(
dl_buffer);
216 me.
element.mission_segment.to.to_f.x = DL_MISSION_SEGMENT_segment_east_2(
dl_buffer);
217 me.
element.mission_segment.to.to_f.y = DL_MISSION_SEGMENT_segment_north_2(
dl_buffer);
218 me.
element.mission_segment.to.to_f.z = DL_MISSION_SEGMENT_segment_alt(
dl_buffer);
229 if (DL_MISSION_SEGMENT_LLA_ac_id(
dl_buffer) != AC_ID) {
return false; }
232 from_lla.
lat = DL_MISSION_SEGMENT_LLA_segment_lat_1(
dl_buffer);
233 from_lla.
lon = DL_MISSION_SEGMENT_LLA_segment_lon_1(
dl_buffer);
234 from_lla.
alt = DL_MISSION_SEGMENT_LLA_segment_alt(
dl_buffer);
235 to_lla.
lat = DL_MISSION_SEGMENT_LLA_segment_lat_2(
dl_buffer);
236 to_lla.
lon = DL_MISSION_SEGMENT_LLA_segment_lon_2(
dl_buffer);
237 to_lla.
alt = DL_MISSION_SEGMENT_LLA_segment_alt(
dl_buffer);
254 if (DL_MISSION_PATH_ac_id(
dl_buffer) != AC_ID) {
return false; }
258 me.
element.mission_path.path.path_f[0].x = DL_MISSION_PATH_point_east_1(
dl_buffer);
259 me.
element.mission_path.path.path_f[0].y = DL_MISSION_PATH_point_north_1(
dl_buffer);
260 me.
element.mission_path.path.path_f[0].z = DL_MISSION_PATH_path_alt(
dl_buffer);
261 me.
element.mission_path.path.path_f[1].x = DL_MISSION_PATH_point_east_2(
dl_buffer);
262 me.
element.mission_path.path.path_f[1].y = DL_MISSION_PATH_point_north_2(
dl_buffer);
263 me.
element.mission_path.path.path_f[1].z = DL_MISSION_PATH_path_alt(
dl_buffer);
264 me.
element.mission_path.path.path_f[2].x = DL_MISSION_PATH_point_east_3(
dl_buffer);
265 me.
element.mission_path.path.path_f[2].y = DL_MISSION_PATH_point_north_3(
dl_buffer);
266 me.
element.mission_path.path.path_f[2].z = DL_MISSION_PATH_path_alt(
dl_buffer);
267 me.
element.mission_path.path.path_f[3].x = DL_MISSION_PATH_point_east_4(
dl_buffer);
268 me.
element.mission_path.path.path_f[3].y = DL_MISSION_PATH_point_north_4(
dl_buffer);
269 me.
element.mission_path.path.path_f[3].z = DL_MISSION_PATH_path_alt(
dl_buffer);
270 me.
element.mission_path.path.path_f[4].x = DL_MISSION_PATH_point_east_5(
dl_buffer);
271 me.
element.mission_path.path.path_f[4].y = DL_MISSION_PATH_point_north_5(
dl_buffer);
272 me.
element.mission_path.path.path_f[4].z = DL_MISSION_PATH_path_alt(
dl_buffer);
275 me.
element.mission_path.path_idx = 0;
286 if (DL_MISSION_PATH_LLA_ac_id(
dl_buffer) != AC_ID) {
return false; }
289 lla[0].
lat = DL_MISSION_PATH_LLA_point_lat_1(
dl_buffer);
290 lla[0].
lon = DL_MISSION_PATH_LLA_point_lon_1(
dl_buffer);
292 lla[1].
lat = DL_MISSION_PATH_LLA_point_lat_2(
dl_buffer);
293 lla[1].
lon = DL_MISSION_PATH_LLA_point_lon_2(
dl_buffer);
295 lla[2].
lat = DL_MISSION_PATH_LLA_point_lat_3(
dl_buffer);
296 lla[2].
lon = DL_MISSION_PATH_LLA_point_lon_3(
dl_buffer);
298 lla[3].
lat = DL_MISSION_PATH_LLA_point_lat_4(
dl_buffer);
299 lla[3].
lon = DL_MISSION_PATH_LLA_point_lon_4(
dl_buffer);
301 lla[4].
lat = DL_MISSION_PATH_LLA_point_lat_5(
dl_buffer);
302 lla[4].
lon = DL_MISSION_PATH_LLA_point_lon_5(
dl_buffer);
310 for (i = 0; i < me.
element.mission_path.nb; i++) {
314 me.
element.mission_path.path_idx = 0;
325 if (DL_GOTO_MISSION_ac_id(
dl_buffer) != AC_ID) {
return false; }
330 }
else {
return false; }
337 if (DL_NEXT_MISSION_ac_id(
dl_buffer) != AC_ID) {
return false; }
348 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_SEGMENT(void)
struct _mission_element * mission_get(void)
Get current mission element.
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.
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
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.
int mission_parse_PATH(void)
int32_t lon
in degrees*1e7
uint8_t insert_idx
inserstion index
int mission_parse_SEGMENT_LLA(void)
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
int mission_parse_PATH_LLA(void)
int mission_parse_CIRCLE_LLA(void)
int mission_parse_END_MISSION(void)