mavsdk::MissionRaw Class Reference
#include: mission_raw.h
Enable raw missions as exposed by MAVLink.
Data Structures
struct MissionItem
struct MissionProgress
Public Types
Type | Description |
---|---|
enum Result | Possible results returned for action requests. |
std::function< void(Result)> ResultCallback | Callback type for asynchronous MissionRaw calls. |
std::function< void(Result, std::vector< MissionItem >)> DownloadMissionCallback | Callback type for download_mission_async. |
std::function< void(MissionProgress)> MissionProgressCallback | Callback type for subscribe_mission_progress. |
std::function< void(bool)> MissionChangedCallback | Callback type for subscribe_mission_changed. |
Public Member Functions
Type | Name | Description |
---|---|---|
MissionRaw (System & system) | Constructor. Creates the plugin for a specific System. | |
~MissionRaw () | Destructor (internal use only). | |
MissionRaw (const MissionRaw &)=delete | Copy constructor (object is not copyable). | |
void | upload_mission_async (std::vector< MissionItem > mission_items, const ResultCallback callback) | Upload a list of raw mission items to the system. |
Result | upload_mission (std::vector< MissionItem > mission_items)const | Upload a list of raw mission items to the system. |
Result | cancel_mission_upload () const | Cancel an ongoing mission upload. |
void | download_mission_async (const DownloadMissionCallback callback) | Download a list of raw mission items from the system (asynchronous). |
std::pair< Result, std::vector< MissionRaw::MissionItem > > | download_mission () const | Download a list of raw mission items from the system (asynchronous). |
Result | cancel_mission_download () const | Cancel an ongoing mission download. |
void | start_mission_async (const ResultCallback callback) | Start the mission. |
Result | start_mission () const | Start the mission. |
void | pause_mission_async (const ResultCallback callback) | Pause the mission. |
Result | pause_mission () const | Pause the mission. |
void | clear_mission_async (const ResultCallback callback) | Clear the mission saved on the vehicle. |
Result | clear_mission () const | Clear the mission saved on the vehicle. |
void | set_current_mission_item_async (int32_t index, const ResultCallback callback) | Sets the raw mission item index to go to. |
Result | set_current_mission_item (int32_t index)const | Sets the raw mission item index to go to. |
void | subscribe_mission_progress (MissionProgressCallback callback) | Subscribe to mission progress updates. |
MissionProgress | mission_progress () const | Poll for 'MissionProgress' (blocking). |
void | subscribe_mission_changed (MissionChangedCallback callback) |
Subscribes to mission changed.
Constructor & Destructor Documentation
MissionRaw()
mavsdk::MissionRaw::MissionRaw(System &system)
Constructor. Creates the plugin for a specific System.
The plugin is typically created as shown below:
auto mission_raw = std::make_shared<MissionRaw>(system);
Parameters
- System& system - The specific system associated with this plugin.
~MissionRaw()
mavsdk::MissionRaw::~MissionRaw()
Destructor (internal use only).
MissionRaw()
mavsdk::MissionRaw::MissionRaw(const MissionRaw &)=delete
Copy constructor (object is not copyable).
Parameters
- const MissionRaw& -
Member Typdef Documentation
typedef ResultCallback
using mavsdk::MissionRaw::ResultCallback = std::function<void(Result)>
Callback type for asynchronous MissionRaw calls.
typedef DownloadMissionCallback
using mavsdk::MissionRaw::DownloadMissionCallback = std::function<void(Result, std::vector<MissionItem>)>
Callback type for download_mission_async.
typedef MissionProgressCallback
using mavsdk::MissionRaw::MissionProgressCallback = std::function<void(MissionProgress)>
Callback type for subscribe_mission_progress.
typedef MissionChangedCallback
using mavsdk::MissionRaw::MissionChangedCallback = std::function<void(bool)>
Callback type for subscribe_mission_changed.
Member Enumeration Documentation
enum Result
Possible results returned for action requests.
Value | Description |
---|---|
Unknown |
Unknown result. |
Success |
Request succeeded. |
Error |
Error. |
TooManyMissionItems |
Too many mission items in the mission. |
Busy |
Vehicle is busy. |
Timeout |
Request timed out. |
InvalidArgument |
Invalid argument. |
Unsupported |
Mission downloaded from the system is not supported. |
NoMissionAvailable |
No mission available on the system. |
TransferCancelled |
Mission transfer (upload or download) has been cancelled. |
Member Function Documentation
upload_mission_async()
void mavsdk::MissionRaw::upload_mission_async(std::vector< MissionItem > mission_items, const ResultCallback callback)
Upload a list of raw mission items to the system.
The raw mission items are uploaded to a drone. Once uploaded the mission can be started and executed even if the connection is lost.
This function is non-blocking. See 'upload_mission' for the blocking counterpart.
Parameters
- std::vector< MissionItem > mission_items -
- const ResultCallback callback -
upload_mission()
Result mavsdk::MissionRaw::upload_mission(std::vector< MissionItem > mission_items) const
Upload a list of raw mission items to the system.
The raw mission items are uploaded to a drone. Once uploaded the mission can be started and executed even if the connection is lost.
This function is blocking. See 'upload_mission_async' for the non-blocking counterpart.
Parameters
- std::vector< MissionItem > mission_items -
Returns
Result - Result of request.
cancel_mission_upload()
Result mavsdk::MissionRaw::cancel_mission_upload() const
Cancel an ongoing mission upload.
This function is blocking.
Returns
Result - Result of request.
download_mission_async()
void mavsdk::MissionRaw::download_mission_async(const DownloadMissionCallback callback)
Download a list of raw mission items from the system (asynchronous).
This function is non-blocking. See 'download_mission' for the blocking counterpart.
Parameters
- const DownloadMissionCallback callback -
download_mission()
std::pair<Result, std::vector<MissionRaw::MissionItem> > mavsdk::MissionRaw::download_mission() const
Download a list of raw mission items from the system (asynchronous).
This function is blocking. See 'download_mission_async' for the non-blocking counterpart.
Returns
std::pair< Result, std::vector< MissionRaw::MissionItem > > - Result of request.
cancel_mission_download()
Result mavsdk::MissionRaw::cancel_mission_download() const
Cancel an ongoing mission download.
This function is blocking.
Returns
Result - Result of request.
start_mission_async()
void mavsdk::MissionRaw::start_mission_async(const ResultCallback callback)
Start the mission.
A mission must be uploaded to the vehicle before this can be called.
This function is non-blocking. See 'start_mission' for the blocking counterpart.
Parameters
- const ResultCallback callback -
start_mission()
Result mavsdk::MissionRaw::start_mission() const
Start the mission.
A mission must be uploaded to the vehicle before this can be called.
This function is blocking. See 'start_mission_async' for the non-blocking counterpart.
Returns
Result - Result of request.
pause_mission_async()
void mavsdk::MissionRaw::pause_mission_async(const ResultCallback callback)
Pause the mission.
Pausing the mission puts the vehicle into HOLD mode. A multicopter should just hover at the spot while a fixedwing vehicle should loiter around the location where it paused.
This function is non-blocking. See 'pause_mission' for the blocking counterpart.
Parameters
- const ResultCallback callback -
pause_mission()
Result mavsdk::MissionRaw::pause_mission() const
Pause the mission.
Pausing the mission puts the vehicle into HOLD mode. A multicopter should just hover at the spot while a fixedwing vehicle should loiter around the location where it paused.
This function is blocking. See 'pause_mission_async' for the non-blocking counterpart.
Returns
Result - Result of request.
clear_mission_async()
void mavsdk::MissionRaw::clear_mission_async(const ResultCallback callback)
Clear the mission saved on the vehicle.
This function is non-blocking. See 'clear_mission' for the blocking counterpart.
Parameters
- const ResultCallback callback -
clear_mission()
Result mavsdk::MissionRaw::clear_mission() const
Clear the mission saved on the vehicle.
This function is blocking. See 'clear_mission_async' for the non-blocking counterpart.
Returns
Result - Result of request.
set_current_mission_item_async()
void mavsdk::MissionRaw::set_current_mission_item_async(int32_t index, const ResultCallback callback)
Sets the raw mission item index to go to.
By setting the current index to 0, the mission is restarted from the beginning. If it is set to a specific index of a raw mission item, the mission will be set to this item.
This function is non-blocking. See 'set_current_mission_item' for the blocking counterpart.
Parameters
- int32_t index -
- const ResultCallback callback -
set_current_mission_item()
Result mavsdk::MissionRaw::set_current_mission_item(int32_t index) const
Sets the raw mission item index to go to.
By setting the current index to 0, the mission is restarted from the beginning. If it is set to a specific index of a raw mission item, the mission will be set to this item.
This function is blocking. See 'set_current_mission_item_async' for the non-blocking counterpart.
Parameters
- int32_t index -
Returns
Result - Result of request.
subscribe_mission_progress()
void mavsdk::MissionRaw::subscribe_mission_progress(MissionProgressCallback callback)
Subscribe to mission progress updates.
Parameters
- MissionProgressCallback callback -
mission_progress()
MissionProgress mavsdk::MissionRaw::mission_progress() const
Poll for 'MissionProgress' (blocking).
Returns
MissionProgress - One MissionProgress update.
subscribe_mission_changed()
void mavsdk::MissionRaw::subscribe_mission_changed(MissionChangedCallback callback)
Subscribes to mission changed.
This notification can be used to be informed if a ground station has been uploaded or changed by a ground station or companion computer.
Parameters
- MissionChangedCallback callback - Callback to notify about change.
operator=()
const MissionRaw& mavsdk::MissionRaw::operator=(const MissionRaw &)=delete
Equality operator (object is not copyable).
Parameters
- const MissionRaw& -
Returns
const MissionRaw & -