> For the complete documentation index, see [llms.txt](https://docs.auterion.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.auterion.com/app-development/auterion-sdk/flight-mode-api/fixed-wing-modes/dynamics-control.md).

# Dynamics Control

{% hint style="info" %}
Requires APX4 3.3 or newer
{% endhint %}

Fixed Wing Dynamics Mode allows you to control a Fixed Wing by supplying acceleration and velocity setpoints to the controller in the vehicle's body frame.

{% hint style="info" %}
For a detailed explanation of the implementation of this setpoint in PX4, see the [upstream documentation](https://docs.px4.io/main/en/ros2/px4_ros2_control_interface.html#fixed-wing-lateral-and-longitudinal-setpoint-fwlaterallongitudinalsetpointtype).
{% endhint %}

## Set up mode

In order to prepare your flight mode to accept `DynamicsSetpoint`, you need to supply the `auterion::fixedwing::DynamicsSetpoint::Config` object to your mode constructor like so:

```cpp
auterion::Mode my_mode(sdk, "My Mode", {
    auterion::fixedwing::DynamicsSetpoint::Config{}
});
```

## Create setpoints

`DynamicsSetpoint` setpoints can take height rate, equivalent airspeed and lateral acceleration as arguments.

The equivalent airspeed setpoint will only be used when the vehicle is equipped with an airspeed sensor.

To create a setpoint, you can use the builder pattern like so:

```cpp
auto setpoint = auterion::fixedwing::DynamicsSetpoint{}
    .withHeightRate(h_dot)
    .withEquivalentAirspeed(equivalent_airspeed)
    .withLateralAcceleration(a_lat)
```

To ensure the drone follows your setpoints, return these setpoints in the `onUpdateSetpoint` callback method of your mode.

<br>
