I-Seed drone's onboard service  0.0.9
Public Member Functions | List of all members
mission Class Reference

Drone's mission control. More...

#include <mission.h>

Public Member Functions

 mission () noexcept
 
 ~mission ()
 
void mission_path_ready (std::vector< lat_lon > mission_path, int32_t event_id)
 The mission path is ready. It is constructed based on an input polygon. More...
 
void mission_path_cancel (int32_t event_id)
 A user request to clear the current mission path. More...
 
const std::vector< lat_longet_mission_path () const
 Get the costructred mission path. More...
 
void init ()
 'MISSION_START' command received from user More...
 
bool upload_mission_and_start (int32_t event_id)
 Upload and start mission. More...
 
std::pair< waypoint_action, std::size_t > waypoint_reached (float laser_range)
 Ask for an action when waypoint reached. More...
 
waypoint get_waypoint_copy (std::size_t index) const
 Waypoint copy by index. More...
 
void save_detection (std::size_t index, const detection_result &result)
 Save the detected objects to waypoint data. More...
 
void set_backward ()
 The forward mission is finished, now set the current mission status to backward. More...
 
bool is_forward () const
 Check if mission is forward. More...
 
bool is_finished () const
 Flag to indicate that mission is finished. More...
 
bool is_ready () const
 Flag to indicate that mission is ready to be started. More...
 
bool is_paused () const
 Flag to indicate that execution of mission is paused. More...
 
bool user_cmd_accepted () const
 Flag to indicate that mission is in the stable state and is ready to accept the user commands pause/resume/abort. More...
 
void update_event_id (int32_t event_id)
 Update mission event_id. More...
 
bool update (T_DjiWaypointV2MissionEventPush event_data)
 Process mission event received from Payload SDK. More...
 
std::pair< bool, bool > update (T_DjiWaypointV2MissionStatePush state_data)
 Process state update event received from Payload SDK. More...
 
void abort (int32_t event_id)
 Abort the mission. More...
 
void pause (int32_t event_id)
 Pause the mission. More...
 
void stop (home_altitude &h)
 Stop the mission. More...
 
void resume (int32_t event_id)
 Resume the mission. More...
 
std::pair< int32_t, interconnection::drone_info::state_t > get_state ()
 Periodically send the current state to the drone control Android application. More...
 

Detailed Description

Drone's mission control.

Note
Class is thread-safe

Constructor & Destructor Documentation

◆ mission()

mission::mission ( )
defaultnoexcept

◆ ~mission()

mission::~mission ( )
default

Member Function Documentation

◆ mission_path_ready()

void mission::mission_path_ready ( std::vector< lat_lon mission_path,
int32_t  event_id 
)

The mission path is ready. It is constructed based on an input polygon.

◆ mission_path_cancel()

void mission::mission_path_cancel ( int32_t  event_id)

A user request to clear the current mission path.

Here is the call graph for this function:

◆ get_mission_path()

auto mission::get_mission_path ( ) const

Get the costructred mission path.

Here is the call graph for this function:

◆ init()

void mission::init ( )

'MISSION_START' command received from user

Note
Thread: receive data
Here is the call graph for this function:

◆ upload_mission_and_start()

auto mission::upload_mission_and_start ( int32_t  event_id)

Upload and start mission.

◆ waypoint_reached()

auto mission::waypoint_reached ( float  laser_range)

Ask for an action when waypoint reached.

Parameters
[in]laser_rangeUse the laser range to determine the real drone height
Returns
[waypoint_action, waypoint index]
Note
Thread: action

◆ get_waypoint_copy()

auto mission::get_waypoint_copy ( std::size_t  index) const

Waypoint copy by index.

Returns
waypoint
Note
Thread: action

◆ save_detection()

void mission::save_detection ( std::size_t  index,
const detection_result result 
)

Save the detected objects to waypoint data.

Parameters
[in]indexWaypoint index
[in]resultDetection result
Note
Thread: inference

◆ set_backward()

void mission::set_backward ( )

The forward mission is finished, now set the current mission status to backward.

Note
Thread: action (called from drone ::next_mission)
Here is the call graph for this function:

◆ is_forward()

auto mission::is_forward ( ) const

Check if mission is forward.

Note
Thread: action
Here is the call graph for this function:

◆ is_finished()

auto mission::is_finished ( ) const

Flag to indicate that mission is finished.

Note
This is a first flag that is checked when then action thread is notified
Thread: action
Here is the call graph for this function:

◆ is_ready()

auto mission::is_ready ( ) const

Flag to indicate that mission is ready to be started.

Here is the call graph for this function:

◆ is_paused()

auto mission::is_paused ( ) const

Flag to indicate that execution of mission is paused.

Here is the call graph for this function:

◆ user_cmd_accepted()

auto mission::user_cmd_accepted ( ) const

Flag to indicate that mission is in the stable state and is ready to accept the user commands pause/resume/abort.

Here is the call graph for this function:

◆ update_event_id()

void mission::update_event_id ( int32_t  event_id)

Update mission event_id.

Apply new value without affecting the state because the state is no longer actual. E.g., trying to abort a mission that is already finished.

Here is the call graph for this function:

◆ update() [1/2]

auto mission::update ( T_DjiWaypointV2MissionEventPush  event_data)

Process mission event received from Payload SDK.

Note
Thread: Payload SDK callback
Returns
true if action thread need to be notified

◆ update() [2/2]

auto mission::update ( T_DjiWaypointV2MissionStatePush  state_data)

Process state update event received from Payload SDK.

Note
Thread: Payload SDK callback
Returns
auto [mission_started, notify]

◆ abort()

void mission::abort ( int32_t  event_id)

Abort the mission.

Here is the call graph for this function:

◆ pause()

void mission::pause ( int32_t  event_id)

Pause the mission.

Here is the call graph for this function:

◆ stop()

void mission::stop ( home_altitude h)

Stop the mission.

Here is the call graph for this function:

◆ resume()

void mission::resume ( int32_t  event_id)

Resume the mission.

Triggered when MISSION_CONTINUE received from user

Note
Thread: receive data
Here is the call graph for this function:

◆ get_state()

auto mission::get_state ( )

Periodically send the current state to the drone control Android application.

Note
Thread: send data
Returns
auto [event_id, state]

The documentation for this class was generated from the following files: