Mission

The Mission interface is based on datalink messages that dynamically add tasks (basic navigation patterns) to a queue, rather than using a static sequence like the flight plans.
Available since v5.2
== Loading the mission controller ==
The mission controller is based on a module, that holds a common part for the message parsing and a specific part for the navigation (which depend on the firmware). Currently the available modules are:
* conf/modules/mission_fw.xml
* conf/modules/mission_rotorcraft.xml
The interface provides a mission_run() function that must be called from the classic flight plan. The mission controller will gives the control back to the flight plan when their is no more tasks to do. Some sample flight plans are provided with takeoff, mission control and landing procedures:
* conf/flight_plans/mission_fw.xml
== Mission elements ==
The elements (or tasks) are basic navigation patterns that are sent to the aircraft and stored in a circular buffer. For each element, an insertion mode is required and a duration can be defined as well.
=== Insertion modes ===
The insertion modes are:
* Append: add the task at the last position of the tasks' list
* Prepend: add the task before the current element (the current one remains in the list)
* ReplaceCurrent: replace the current mission element
* ReplaceAll: remove all elements in the tasks' list and add a new one
=== Duration ===
A duration for each element can be specified. The time is a floating point value in seconds. When setting a zero (or even better a negative) value, the duration parameter is not taken into account.
Be aware that some navigation pattern (like segment) will end when reaching the end of the pattern or at the end of the duration time, but some (like circle) will not if a positive duration is not set. It is always possible the go to the next mission element with a specific message.
=== Navigation patterns ===
The navigation patterns are more or less the same than the one available from the flight plan (except user specific function). The vertical control is currently limited to altitude control.
* GOTO_WP: go to a specific waypoint
** east: local east position of the waypoint
** north: local north position of the waypoint
* GOTO_LLA: go to a specific global waypoint
** lat: latitude the waypoint
** lon: longitude of the waypoint
* CIRCLE: fly a circle around a waypoint
** east: local east position of the center
** north: local north position of the center
** radius: radius of the circle (positive to turn clockwise, negative to turn counter-clockwise)
* CIRCLE_LLA: fly a circle around a global waypoint
** lat: latitude of the center
** lon: longitude of the center
** radius: radius of the circle (positive to turn clockwise, negative to turn counter-clockwise)
* SEGMENT: fly a segment between two waypoints
** east_1: local east position of the start waypoint
** north_1: local north position of the start waypoint
** east_2: local east position of the end waypoint
** north_2: local north position of the end waypoint
* SEGMENT_LLA: fly a segment between two global waypoints
** lat_1: latitude of the start waypoint
** lon_1: longitude of the start waypoint
** lat_2: latitude of the end waypoint
** lon_2: longitude of the end waypoint
* PATH: fly a sequence of segments (max 5 waypoints)
** east_'x': local east position of waypoint 'x'
** north_'x': local north position of waypoint 'x'
** nb: number of waypoints in the path (max 5)
** note: the 5 points are always sent, but only the first nb are used
* PATH_LLA: fly a sequence of segments (max 5 global waypoints)
** lat_'x': latitude of waypoint 'x'
** lon_'x': longitude of waypoint 'x'
** nb: number of waypoints in the path (max 5)
** note: the 5 points are always sent, but only the first nb are used
* CUSTOM: fly a custom pattern that have been registered by a navigation module (see dedicated section below)
** type: string identifier of the custom (5 char max)
** params: array of float (12 max) to pass pattern parameters
=== Pattern index ===
Each pattern is sent with an index (1 byte) which is left to the user. The report message will send back the array of index. The most common usage is to send an unique value for each pattern in order to identify the elements in the task list.
== Sending tasks to the mission controller ==
The mission elements are sent as datalink messages using Ivy from the ground or directly with the binary format by an onboard CPU.
See conf/messages.xml for the exact message structure.
== Mission status report ==
The mission controller is periodically sending a report message MISSION_STATUS with the following fields:
* remaining_time : time remaining for the current element in seconds (-1. if unlimited time)
* index_list: list of the elements pending in the mission controller
** each value in this list correspond to the index of each element (see pattern index section)
** the first element in the list is the current one
** if the list is empty, a single element with the value zero (0) is sent
== Custom patterns ==
TODO