Auterion App SDK
Auterion SDK is a library that can be used by AuterionOS apps to communicate with the system.
|
Defines a mode to control the vehicle using a (set) of setpoint types. More...
#include <auterion_sdk/control/mode.hpp>
Public Member Functions | |
Mode (SDK &sdk, const std::string &mode_name, const std::vector< ModalityConfig > &controls, ModeConfiguration config=ModeConfiguration{}) | |
Constructor to initialize a mode. More... | |
void | onActivate (const std::function< void()> &callback) |
Sets a callback function to be called when the mode is activated. More... | |
void | onDeactivate (const std::function< void()> &callback) |
Sets a callback function to be called when the mode is deactivated. More... | |
void | onUpdateSetpoint (const std::function< Setpoint(float)> &callback) |
Sets a callback function to be called at periodically at the update frequency of the mode. More... | |
auterion::ManualControlInput | lastManualControlInput () const |
Defines a mode to control the vehicle using a (set) of setpoint types.
Example usage:
To create your own flight mode:
To register callbacks to specific events in the mode life cycle:
auterion::Mode::Mode | ( | SDK & | sdk, |
const std::string & | mode_name, | ||
const std::vector< ModalityConfig > & | controls, | ||
ModeConfiguration | config = ModeConfiguration{} |
||
) |
Constructor to initialize a mode.
sdk | Reference to the SDK instance. |
mode_name | Name of the mode. |
controls | Vector of ModalityConfig objects specifying which setpoints types the mode will output. |
config | Optional ModeConfiguration specifying mode requirements and capabilities. |
void auterion::Mode::onActivate | ( | const std::function< void()> & | callback | ) |
Sets a callback function to be called when the mode is activated.
callback | Function to call on mode activation. |
void auterion::Mode::onDeactivate | ( | const std::function< void()> & | callback | ) |
Sets a callback function to be called when the mode is deactivated.
callback | Function to call on mode deactivation. |
void auterion::Mode::onUpdateSetpoint | ( | const std::function< Setpoint(float)> & | callback | ) |
Sets a callback function to be called at periodically at the update frequency of the mode.
The ModalityConfig(s) used to instantiate the mode determine the update frequency of the mode, as well as the expected return Setpoint types of the callback function passed to this method.
callback | Function to call to update setpoints. |