Managing Systems/Vehicles (Using Plugins)

Access to drone information, telemetry and control objects are provided by a number of different plugins. For example, the Action plugin is used to arm, takeoff and land the vehicle, while the Telemetry plugin can be used to query the vehicle GPS status, flight mode, etc. A separate plugin instance must be created for each system that needs it.

All plugins are declared/used in the same way. This topic uses the Action plugin for the purposes of the demonstration.

To use a plugin first link the plugin library into the application. Do this by adding it to the target_link_libraries section of the app's cmake build definition file:

target_link_libraries(your_executable_name
    mavsdk
    ...
    mavsdk_action
   ...
)

Plugins are named using the convention mavsdk_plugin_name.so. For more information see Building C++ Apps

In the application source code:

  1. #include the header file for the plugin.
    #include <mavsdk/plugins/action/action.h>
    
  2. Create a connection to a System object (below named: system).
  3. Create the plugin instance, specifying the System it is to be used with:
    auto action = Action{system};
    
  4. The pointer can then be used to invoke actions on the specified system. For example, to takeoff you would call the API as shown:
    action.takeoff();
    
© MAVSDK Development Team 2017-2023. License: CC BY 4.0            Updated: 2023-12-27 03:10:20

results matching ""

    No results matching ""