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
    dronecode_sdk
    ...
    dronecode_sdk_action
   ...
)

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

In the application source code:

  1. #include the header file for the plugin.
    #include <dronecode_sdk/action.h>
    
  2. Create a connection to a System object (below named: system).
  3. Make a shared pointer to the plugin object, specifying the System it is to be used with:
    auto action = std::make_shared<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();
    
© Dronecode 2017. License: CC BY 4.0            Updated: 2018-07-12 03:09:32

results matching ""

    No results matching ""