I-Seed drone's onboard service
0.0.9
|
Class to watch the global mission state that will be sent over interconnection. More...
#include <mission_state.h>
Public Member Functions | |
void | mission_path_ready (int32_t event_id) |
The mission path is constructed and ready to be sent to a user for confirmation. More... | |
void | mission_path_cancel (int32_t event_id) |
A user request to clear the current mission path. Either the path is invalid, or the user wants to change it. More... | |
bool | mission_path_available () const |
The mission path is available in current state. More... | |
void | init () |
Initial fetch of the path before running forward/backward missions. More... | |
void | start (int32_t event_id) |
Start mission (either forward or backward). Update events can be processed. More... | |
void | pause (int32_t event_id) |
Pause mission. More... | |
void | stop () |
Stop the global mission execution. More... | |
void | abort (int32_t event_id) |
Abort mission. Ignore update events. More... | |
void | resume (int32_t event_id) |
Resume mission. More... | |
void | update_event_id (int32_t event_id) |
Update mission event_id. More... | |
void | waypoint_reached () const |
Verify state correctness when waypoint reached. More... | |
bool | is_forward () const |
Forward mission is in progress. More... | |
void | set_backward () |
Switch to backward mission. More... | |
bool | is_finished () const |
Check if forward/backward mission finished. More... | |
bool | is_ready () const |
Check if mission is ready to start. More... | |
bool | is_paused () const |
Check if global mission is paused. More... | |
bool | user_cmd_accepted () const |
Check if state accepts user's command pause/resume/abort. 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... | |
std::pair< int32_t, interconnection::drone_info::state_t > | get_state () |
Current drone's state to sent to the drone control Android application. More... | |
Static Public Attributes | |
static constexpr int32_t | internal_event_id {-1} |
Class to watch the global mission state that will be sent over interconnection.
Since it's thread-safe and used in Payload SDK callbacks, all the methods should return flow control quickly, avoid long wait. Any Payload SDK API related to WaypointV2 mission should be called in mission. Waypoints information should be saved in mission too. Argument event_id indicates a user command.
void mission_state::mission_path_ready | ( | int32_t | event_id | ) |
The mission path is constructed and ready to be sent to a user for confirmation.
ready -> path_data
void mission_state::mission_path_cancel | ( | int32_t | event_id | ) |
A user request to clear the current mission path. Either the path is invalid, or the user wants to change it.
path_data -> ready
auto mission_state::mission_path_available | ( | ) | const |
The mission path is available in current state.
void mission_state::init | ( | ) |
Initial fetch of the path before running forward/backward missions.
path -> forward_wait_start
void mission_state::start | ( | int32_t | event_id | ) |
Start mission (either forward or backward). Update events can be processed.
forward_wait_start -> forward_wait_update
backward_wait_start -> backward_wait_update
void mission_state::pause | ( | int32_t | event_id | ) |
Pause mission.
forward_executing or backward_executing
void mission_state::stop | ( | ) |
Stop the global mission execution.
forward_wait_start -> ready (abort execution)
backward_wait_start -> ready (no objects detected - no backward mission, aborted execution)
backward_finished -> ready (success)
void mission_state::abort | ( | int32_t | event_id | ) |
Abort mission. Ignore update events.
backward_executing -> backward_wait_start
forward_executing -> forward_wait_start
void mission_state::resume | ( | int32_t | event_id | ) |
Resume mission.
forward_executing or backward_executing
void mission_state::update_event_id | ( | int32_t | event_id | ) |
Update mission event_id.
void mission_state::waypoint_reached | ( | ) | const |
Verify state correctness when waypoint reached.
forward_executing or backward_executing
auto mission_state::is_forward | ( | ) | const |
Forward mission is in progress.
void mission_state::set_backward | ( | ) |
Switch to backward mission.
forward_wait_start -> backward_wait_start (last fake waypoint)
forward_finished -> backward_wait_start (forward success)
auto mission_state::is_finished | ( | ) | const |
Check if forward/backward mission finished.
auto mission_state::is_ready | ( | ) | const |
Check if mission is ready to start.
auto mission_state::is_paused | ( | ) | const |
Check if global mission is paused.
auto mission_state::user_cmd_accepted | ( | ) | const |
Check if state accepts user's command pause/resume/abort.
auto mission_state::update | ( | T_DjiWaypointV2MissionEventPush | event_data | ) |
Process mission event received from Payload SDK.
auto mission_state::update | ( | T_DjiWaypointV2MissionStatePush | state_data | ) |
Process state update event received from Payload SDK.
auto mission_state::get_state | ( | ) |
Current drone's state to sent to the drone control Android application.
|
staticconstexpr |