Flight Mode API

Related C++ Header in the Auterion SDK: <auterion_sdk/control/mode.hpp>

In order to control your drone, you have to create a Flight Mode. You can do this easily by instanting an auterion::Mode object.

class MyAppWithMode
{
private:
    auterion::Mode _mode;
public:
    MyAppWithMode(auterion::SDK &sdk) : _mode(sdk, "My Mode", {
        auterion::multicopter::LocalFrameGotoSetpoint::Config{}
    }) {};
};

The constructor of auterion::Mode has three arguments

  • Reference to the auterion SDK instance

  • A name for the mode, this is the name that will get displayed in the GCS to select the mode

  • A list of setpoint control types, that this mode intends to use

Setpoint control types

When instantiating a mode, you have to specify which control setpoint types your app will use. This is important to make sure that all safety requirements can be set up correctly before the mode gets activated.

The individual control setpoint types can have configuration options that are specific to the different types.

The following control setpoint types are available:

  • auterion::multicopter::LocalFrameGotoSetpoint::Config{}: Go-to positions that the multicopter will fly towards

  • auterion::multicopter::LocalFrameDynamicsSetpoint::Config{}: Direct dynamics velocity and acceleration control in local frame

  • auterion::multicopter::BodyFrameDynamicsSetpoint::Config{}: Direct dynamics velocity and acceleration control in body frame

  • auterion::RateSetpoint::Config{}: Direct angular rate control of the vehicle (not recommended generally)

  • auterion::AttitudeSetpoint::Config{} : Direct attitude control of the vehicle (not recommended generally)

Each mode needs to use at least one of the setpoint types. Modes can also use multiple setpoint types, if they have different control needs during their lifetime

Mode life cycle

A mode has various life cycle methods that can be added like so

_mode.onActivate([this]() {
    // Gets called when the user activates this mode by switching into it
});

_mode.onDeactivate([]() { 
    // Gets called when user or system deactives this modes by switching to another mode
});

_mode.onUpdateSetpoint([this](float dt_s) -> auterion::Setpoint {
    // Gets called regularly while mode is active. 
    // Here, any of the setpoint types specified in the constructor
    // can be returned. The vehicle will then try to follow the returned setpoints.
    return auterion::multicopter::LocalFrameGotoSetpoint{}.withVelocity(x, y, z);
});

The flight behaviour of a mode gets implemented by generating and returning the correct setpoints in the onUpdateSetpoint callback.

Last updated