Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
mission_common.c File Reference

messages parser for mission interface More...

#include "modules/mission/mission_common.h"
#include <string.h>
#include "generated/flight_plan.h"
#include "generated/airframe.h"
#include "modules/datalink/datalink.h"
#include "modules/datalink/downlink.h"
+ Include dependency graph for mission_common.c:

Go to the source code of this file.

Macros

#define MISSION_CHECK_UNIQUE_ID   TRUE
 

Functions

void mission_init (void)
 Init mission structure. More...
 
bool mission_insert (enum MissionInsertMode insert, struct _mission_element *element)
 Insert a mission element according to the insertion mode. More...
 
bool mission_register (mission_custom_cb cb, char *type)
 Register a new navigation or action callback function. More...
 
static struct _mission_registeredmission_get_registered (char *type)
 
struct _mission_elementmission_get_from_index (uint8_t index)
 Get mission element by index. More...
 
bool mission_element_convert (struct _mission_element *el)
 Convert mission element's points format if needed. More...
 
struct _mission_elementmission_get (void)
 Get current mission element. More...
 
void mission_status_report (void)
 Report mission status. More...
 
int mission_parse_GOTO_WP (uint8_t *buf)
 Parsing functions called when a mission message is received. More...
 
int mission_parse_GOTO_WP_LLA (uint8_t *buf)
 
int mission_parse_CIRCLE (uint8_t *buf)
 
int mission_parse_CIRCLE_LLA (uint8_t *buf)
 
int mission_parse_SEGMENT (uint8_t *buf)
 
int mission_parse_SEGMENT_LLA (uint8_t *buf)
 
int mission_parse_PATH (uint8_t *buf)
 
int mission_parse_PATH_LLA (uint8_t *buf)
 
int mission_parse_CUSTOM (uint8_t *buf)
 
int mission_parse_UPDATE (uint8_t *buf)
 
int mission_parse_GOTO_MISSION (uint8_t *buf)
 
int mission_parse_NEXT_MISSION (uint8_t *buf)
 
int mission_parse_END_MISSION (uint8_t *buf)
 

Variables

struct _mission mission = { 0 }
 

Detailed Description

messages parser for mission interface

Definition in file mission_common.c.

Macro Definition Documentation

◆ MISSION_CHECK_UNIQUE_ID

#define MISSION_CHECK_UNIQUE_ID   TRUE

Definition at line 37 of file mission_common.c.

Function Documentation

◆ mission_element_convert()

bool mission_element_convert ( struct _mission_element el)

Convert mission element's points format if needed.

Parameters
elpointer to the mission element
Returns
return TRUE if conversion is succesful, FALSE otherwise

Definition at line 158 of file mission_common.c.

Referenced by mission_insert().

+ Here is the caller graph for this function:

◆ mission_get()

struct _mission_element* mission_get ( void  )

Get current mission element.

Returns
return a pointer to the next mission element or NULL if no more elements

Definition at line 162 of file mission_common.c.

References _mission::current_idx, _mission::elements, _mission::insert_idx, and mission.

Referenced by mission_run().

+ Here is the caller graph for this function:

◆ mission_get_from_index()

struct _mission_element* mission_get_from_index ( uint8_t  index)

Get mission element by index.

Returns
return a pointer to the mission element or NULL if no more elements

Definition at line 142 of file mission_common.c.

References _mission::current_idx, _mission::elements, _mission_element::index, _mission::insert_idx, mission, and MISSION_ELEMENT_NB.

Referenced by mission_insert(), and mission_parse_UPDATE().

+ Here is the caller graph for this function:

◆ mission_get_registered()

static struct _mission_registered* mission_get_registered ( char *  type)
static

Definition at line 131 of file mission_common.c.

References mission, MISSION_REGISTER_NB, _mission::registered, type(), and _mission_registered::type.

Referenced by mission_parse_CUSTOM().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mission_init()

void mission_init ( void  )

Init mission structure.

Definition at line 42 of file mission_common.c.

References _mission::current_idx, _mission::element_time, _mission::insert_idx, and mission.

◆ mission_insert()

bool mission_insert ( enum MissionInsertMode  insert,
struct _mission_element element 
)

Insert a mission element according to the insertion mode.

Parameters
insertinsertion mode
elementmission element structure
Returns
return TRUE if insertion is succesful, FALSE otherwise

Definition at line 60 of file mission_common.c.

References Append, _mission::current_idx, _mission::element_time, _mission::elements, _mission_element::index, _mission::insert_idx, mission, mission_element_convert(), MISSION_ELEMENT_NB, mission_get_from_index(), Prepend, ReplaceAll, ReplaceCurrent, and ReplaceNexts.

Referenced by mission_parse_CIRCLE(), mission_parse_CIRCLE_LLA(), mission_parse_CUSTOM(), mission_parse_GOTO_WP(), mission_parse_GOTO_WP_LLA(), mission_parse_PATH(), mission_parse_PATH_LLA(), mission_parse_SEGMENT(), and mission_parse_SEGMENT_LLA().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mission_parse_CIRCLE()

int mission_parse_CIRCLE ( uint8_t buf)

Definition at line 235 of file mission_common.c.

References _mission_element::duration, _mission_element::element, _mission_element::index, mission_insert(), MissionCircle, and _mission_element::type.

+ Here is the call graph for this function:

◆ mission_parse_CIRCLE_LLA()

int mission_parse_CIRCLE_LLA ( uint8_t buf)

◆ mission_parse_CUSTOM()

int mission_parse_CUSTOM ( uint8_t buf)

◆ mission_parse_END_MISSION()

int mission_parse_END_MISSION ( uint8_t buf)

◆ mission_parse_GOTO_MISSION()

int mission_parse_GOTO_MISSION ( uint8_t buf)

◆ mission_parse_GOTO_WP()

int mission_parse_GOTO_WP ( uint8_t buf)

Parsing functions called when a mission message is received.

Definition at line 197 of file mission_common.c.

References _mission_element::duration, _mission_element::element, _mission_element::index, mission_insert(), MissionWP, and _mission_element::type.

+ Here is the call graph for this function:

◆ mission_parse_GOTO_WP_LLA()

int mission_parse_GOTO_WP_LLA ( uint8_t buf)

◆ mission_parse_NEXT_MISSION()

int mission_parse_NEXT_MISSION ( uint8_t buf)

◆ mission_parse_PATH()

int mission_parse_PATH ( uint8_t buf)

◆ mission_parse_PATH_LLA()

◆ mission_parse_SEGMENT()

int mission_parse_SEGMENT ( uint8_t buf)

Definition at line 275 of file mission_common.c.

References _mission_element::duration, _mission_element::element, _mission_element::index, mission_insert(), MissionSegment, and _mission_element::type.

+ Here is the call graph for this function:

◆ mission_parse_SEGMENT_LLA()

int mission_parse_SEGMENT_LLA ( uint8_t buf)

◆ mission_parse_UPDATE()

int mission_parse_UPDATE ( uint8_t buf)

◆ mission_register()

bool mission_register ( mission_custom_cb  cb,
char *  type 
)

Register a new navigation or action callback function.

Parameters
cbcallback f(nb, param array)
typestring identifier with 5 characters max (+ 1 '\0' char)
Returns
return TRUE if register is succesful, FALSE otherwise

Definition at line 115 of file mission_common.c.

References _mission_registered::cb, mission, MISSION_REGISTER_NB, MISSION_TYPE_SIZE, _mission::registered, type(), and _mission_registered::type.

Referenced by nav_flower_init(), nav_lace_init(), nav_line_init(), nav_rosette_init(), nav_spiral_3D_init(), and nav_trinity_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mission_status_report()

void mission_status_report ( void  )

Variable Documentation

◆ mission