Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
mission planner library More...
Go to the source code of this file.
Data Structures | |
struct | _mission_wp |
struct | _mission_circle |
struct | _mission_segment |
struct | _mission_path |
struct | _mission_registered |
struct | _mission_custom |
struct | _mission_element |
struct | _mission |
union | _mission_element.element |
Macros | |
#define | MISSION_PATH_NB 5 |
#define | MISSION_CUSTOM_MAX 12 |
#define | MISSION_TYPE_SIZE 6 |
#define | MISSION_ELEMENT_NB 20 |
Max number of elements in the tasks' list can be redefined. More... | |
#define | MISSION_REGISTER_NB 6 |
Max number of registered nav/action callbacks can be redefined. More... | |
Typedefs | |
typedef bool(* | mission_custom_cb) (uint8_t nb, float *params, enum MissionRunFlag flag) |
custom mission element callback More... | |
Enumerations | |
enum | MissionType { MissionWP = 1 , MissionCircle = 2 , MissionSegment = 3 , MissionPath = 4 , MissionCustom = 5 } |
enum | MissionInsertMode { Append , Prepend , ReplaceCurrent , ReplaceAll , ReplaceNexts } |
enum | MissionRunFlag { MissionRun = 0 , MissionInit = 1 , MissionUpdate = 2 } |
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... | |
struct _mission_element * | mission_get (void) |
Get current mission element. More... | |
struct _mission_element * | mission_get_from_index (uint8_t index) |
Get mission element by index. More... | |
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. More... | |
int | mission_run (void) |
Run mission. 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 |
mission planner library
Provide the generic interface for the mission control Handle the parsing of datalink messages
Definition in file mission_common.h.
struct _mission_wp |
Definition at line 59 of file mission_common.h.
Data Fields | ||
---|---|---|
struct EnuCoor_f | wp |
struct _mission_circle |
Definition at line 63 of file mission_common.h.
Data Fields | ||
---|---|---|
struct EnuCoor_f | center | |
float | radius |
struct _mission_segment |
Definition at line 68 of file mission_common.h.
Data Fields | ||
---|---|---|
struct EnuCoor_f | from | |
struct EnuCoor_f | to |
struct _mission_path |
Definition at line 74 of file mission_common.h.
Data Fields | ||
---|---|---|
uint8_t | nb | |
struct EnuCoor_f | path[MISSION_PATH_NB] | |
uint8_t | path_idx |
struct _mission_registered |
Definition at line 91 of file mission_common.h.
Data Fields | ||
---|---|---|
mission_custom_cb | cb | navigation/action function callback |
char | type[MISSION_TYPE_SIZE] | mission element identifier (5 char max + 1 \0) |
struct _mission_custom |
Definition at line 96 of file mission_common.h.
Data Fields | ||
---|---|---|
uint8_t | nb | number of parameters |
float | params[MISSION_CUSTOM_MAX] | list of parameters |
struct _mission_registered * | reg | pointer to a registered custom mission element |
struct _mission_element |
Definition at line 102 of file mission_common.h.
Data Fields | ||
---|---|---|
float | duration | time to spend in the element (<= 0 to disable) |
union _mission_element | element | |
uint8_t | index | index of mission element |
enum MissionType | type |
struct _mission |
Definition at line 130 of file mission_common.h.
Data Fields | ||
---|---|---|
uint8_t | current_idx | current mission element index |
float | element_time | time in second spend in the current element |
struct _mission_element | elements[MISSION_ELEMENT_NB] | |
uint8_t | insert_idx | inserstion index |
struct _mission_registered | registered[MISSION_REGISTER_NB] |
union _mission_element.element |
Definition at line 104 of file mission_common.h.
Data Fields | ||
---|---|---|
struct _mission_circle | mission_circle | |
struct _mission_custom | mission_custom | |
struct _mission_path | mission_path | |
struct _mission_segment | mission_segment | |
struct _mission_wp | mission_wp |
#define MISSION_CUSTOM_MAX 12 |
Definition at line 80 of file mission_common.h.
#define MISSION_ELEMENT_NB 20 |
Max number of elements in the tasks' list can be redefined.
Definition at line 120 of file mission_common.h.
#define MISSION_PATH_NB 5 |
Definition at line 73 of file mission_common.h.
#define MISSION_REGISTER_NB 6 |
Max number of registered nav/action callbacks can be redefined.
Definition at line 127 of file mission_common.h.
#define MISSION_TYPE_SIZE 6 |
Definition at line 81 of file mission_common.h.
typedef bool(* mission_custom_cb) (uint8_t nb, float *params, enum MissionRunFlag flag) |
custom mission element callback
[in] | nb | number of params |
[in] | params | array of params with a maximum of 12 |
[in] | init | true if the function is called for the first time |
Definition at line 89 of file mission_common.h.
enum MissionInsertMode |
Definition at line 45 of file mission_common.h.
enum MissionRunFlag |
Enumerator | |
---|---|
MissionRun | normal run |
MissionInit | first exec |
MissionUpdate | param update |
Definition at line 53 of file mission_common.h.
enum MissionType |
Enumerator | |
---|---|
MissionWP | |
MissionCircle | |
MissionSegment | |
MissionPath | |
MissionCustom |
Definition at line 37 of file mission_common.h.
struct _mission_element* mission_get | ( | void | ) |
Get current mission element.
Definition at line 178 of file mission_common.c.
References _mission::current_idx, _mission::elements, _mission::insert_idx, and mission.
Referenced by mission_run().
struct _mission_element* mission_get_from_index | ( | uint8_t | index | ) |
Get mission element by index.
Definition at line 162 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().
void mission_init | ( | void | ) |
Init mission structure.
Definition at line 65 of file mission_common.c.
References _mission_registered::cb, _mission::current_idx, DefaultPeriodic, _mission::element_time, _mission::insert_idx, mission, MISSION_REGISTER_NB, MISSION_TYPE_SIZE, register_periodic_telemetry(), _mission::registered, send_mission_status(), and _mission_registered::type.
bool mission_insert | ( | enum MissionInsertMode | insert, |
struct _mission_element * | element | ||
) |
Insert a mission element according to the insertion mode.
insert | insertion mode |
element | mission element structure |
Definition at line 83 of file mission_common.c.
References Append, _mission::current_idx, _mission::element_time, _mission::elements, _mission_element::index, _mission::insert_idx, mission, 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().
int mission_parse_CIRCLE | ( | uint8_t * | buf | ) |
Definition at line 236 of file mission_common.c.
References _mission_element::duration, _mission_element::element, _mission_element::index, mission_insert(), MissionCircle, and _mission_element::type.
int mission_parse_CIRCLE_LLA | ( | uint8_t * | buf | ) |
Definition at line 254 of file mission_common.c.
References LlaCoor_i::alt, _mission_element::duration, _mission_element::element, _mission_element::index, LlaCoor_i::lat, LlaCoor_i::lon, mission_insert(), mission_point_of_lla(), MissionCircle, and _mission_element::type.
int mission_parse_CUSTOM | ( | uint8_t * | buf | ) |
Definition at line 392 of file mission_common.c.
References _mission_element::duration, _mission_element::element, _mission_element::index, mission_get_registered(), mission_insert(), MissionCustom, and _mission_element::type.
int mission_parse_END_MISSION | ( | uint8_t * | buf | ) |
Definition at line 474 of file mission_common.c.
References _mission::current_idx, _mission::element_time, _mission::insert_idx, and mission.
int mission_parse_GOTO_MISSION | ( | uint8_t * | buf | ) |
Definition at line 446 of file mission_common.c.
References _mission::current_idx, _mission::element_time, mission, and MISSION_ELEMENT_NB.
int mission_parse_GOTO_WP | ( | uint8_t * | buf | ) |
Parsing functions called when a mission message is received.
Definition at line 198 of file mission_common.c.
References _mission_element::duration, _mission_element::element, _mission_element::index, mission_insert(), MissionWP, and _mission_element::type.
int mission_parse_GOTO_WP_LLA | ( | uint8_t * | buf | ) |
Definition at line 215 of file mission_common.c.
References LlaCoor_i::alt, _mission_element::duration, _mission_element::element, _mission_element::index, LlaCoor_i::lat, LlaCoor_i::lon, mission_insert(), mission_point_of_lla(), MissionWP, and _mission_element::type.
int mission_parse_NEXT_MISSION | ( | uint8_t * | buf | ) |
Definition at line 461 of file mission_common.c.
References _mission::current_idx, _mission::element_time, _mission::insert_idx, mission, and MISSION_ELEMENT_NB.
int mission_parse_PATH | ( | uint8_t * | buf | ) |
Definition at line 321 of file mission_common.c.
References _mission_element::duration, _mission_element::element, _mission_element::index, mission_insert(), MISSION_PATH_NB, MissionPath, and _mission_element::type.
int mission_parse_PATH_LLA | ( | uint8_t * | buf | ) |
Definition at line 353 of file mission_common.c.
References LlaCoor_i::alt, _mission_element::duration, _mission_element::element, _mission_element::index, LlaCoor_i::lat, LlaCoor_i::lon, mission_insert(), MISSION_PATH_NB, mission_point_of_lla(), MissionPath, and _mission_element::type.
int mission_parse_SEGMENT | ( | uint8_t * | buf | ) |
Definition at line 276 of file mission_common.c.
References _mission_element::duration, _mission_element::element, _mission_element::index, mission_insert(), MissionSegment, and _mission_element::type.
int mission_parse_SEGMENT_LLA | ( | uint8_t * | buf | ) |
Definition at line 296 of file mission_common.c.
References LlaCoor_i::alt, _mission_element::duration, _mission_element::element, _mission_element::index, LlaCoor_i::lat, LlaCoor_i::lon, mission_insert(), mission_point_of_lla(), MissionSegment, and _mission_element::type.
int mission_parse_UPDATE | ( | uint8_t * | buf | ) |
Definition at line 414 of file mission_common.c.
References _mission_element::duration, _mission_element::element, MISSION_CUSTOM_MAX, mission_get_from_index(), MissionCircle, MissionCustom, MissionPath, MissionSegment, MissionUpdate, MissionWP, and _mission_element::type.
Get the ENU component of LLA mission point This function is firmware specific.
point | pointer to the output ENU point (float) |
lla | pointer to the input LLA coordinates (int) |
Get the ENU component of LLA mission point This function is firmware specific.
TODO: don't convert to float, either use double or do completely in fixed point
Definition at line 38 of file mission_fw_nav.c.
References LlaCoor_f::alt, LlaCoor_i::alt, BUFFER_ZONE_DIST, UtmCoor_f::east, enu_of_lla_point_i(), float_vect2_norm(), LLA_FLOAT_OF_BFP, max_dist_from_home, nav_utm_east0, nav_utm_north0, nav_utm_zone0, State::ned_initialized_i, UtmCoor_f::north, state, stateGetHmslOrigin_i(), stateGetLlaOrigin_i(), stateGetNedOrigin_i(), utm_of_lla_f(), VECT2_DIFF, VECT2_SMUL, VECT2_SUM, VECT3_SMUL, waypoint_get_x(), waypoint_get_y(), waypoints, FloatVect2::x, point::x, FloatVect2::y, point::y, EnuCoor_f::z, and UtmCoor_f::zone.
Referenced by mission_parse_CIRCLE_LLA(), mission_parse_GOTO_WP_LLA(), mission_parse_PATH_LLA(), and mission_parse_SEGMENT_LLA().
bool mission_register | ( | mission_custom_cb | cb, |
char * | type | ||
) |
Register a new navigation or action callback function.
cb | callback f(nb, param array) |
type | string identifier with 5 characters max (+ 1 '\0' char) |
Definition at line 135 of file mission_common.c.
References _mission_registered::cb, mission, MISSION_REGISTER_NB, MISSION_TYPE_SIZE, _mission::registered, and _mission_registered::type.
Referenced by nav_lace_init(), nav_line_init(), nav_rosette_init(), nav_spiral_3D_init(), nav_survey_hybrid_init(), nav_takeoff_and_landing_init(), and nav_trinity_init().
int mission_run | ( | void | ) |
Run mission.
This function should be implemented into a dedicated file since navigation functions are different for different firmwares
Currently, this function should be called from the flight plan
Definition at line 192 of file mission_fw_nav.c.
References _mission::current_idx, dt_navigation, _mission_element::duration, _mission_element::element, _mission::element_time, mission, MISSION_ELEMENT_NB, mission_get(), mission_nav_circle(), mission_nav_custom(), mission_nav_path(), mission_nav_segment(), mission_nav_wp(), mission_wait_pattern(), mission_wait_started, MissionCircle, MissionCustom, MissionPath, MissionSegment, MissionWP, and _mission_element::type.
void mission_status_report | ( | void | ) |
Report mission status.
Send mission status over datalink
Definition at line 188 of file mission_common.c.
References DefaultChannel, DefaultDevice, and send_mission_status().
|
extern |
Definition at line 1 of file mission_common.c.
Referenced by mission_get(), mission_get_from_index(), mission_get_registered(), mission_init(), mission_insert(), mission_nav_circle(), mission_parse_END_MISSION(), mission_parse_GOTO_MISSION(), mission_parse_NEXT_MISSION(), mission_register(), mission_run(), and send_mission_status().