> 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/multicopter-modes/go-to-in-local-frame.md).

# Go-To in Local Frame

{% hint style="info" %}
Related C++ Header in the Auterion SDK:`<auterion_sdk/control/control.hpp>`
{% endhint %}

Local Frame Goto Mode allows you to control a multicopter by continuously supplying a target position value where you want the vehicle to go to. The multicopter automatically does a smooth acceleration and deceleration trajectory to arrive at the specified target, or will change course to keep following a moving target.

## Set up mode

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

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

## Create setpoints

`LocalFrameGotoSetpoint` setpoints take either a 3D position, or a 2D position + altitude as well as desired heading value. The vehicle then does a smooth trajectory towards the specified position.

Additionally, `LocalFrameGotoSetpoint` setpoints may take speed limits for horizontal, vertical, and heading rate. These specifications determine the maximum allowable speeds when moving towards the setpoint.

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

```cpp
auto setpoint = auterion::multicopter::LocalFrameGotoSetpoint{}
    .withPosition({x, y})  // possible overload: withPosition({x, y, z})
    .withAltitude(z)
    .withHeading(h)
    .withMaxHorizontalSpeed(max_xy)
    .withMaxVerticalSpeed(max_z)
    .withMaxHeadingRate(max_h);
```

Also any subset of these values is permitted. In order to make the drone follow your setpoints, return these setpoints in the `onUpdateSetpoint` callback method of your mode.

### Setting default speed limits

While you can specify the speed limit for each setpoint, you can also specify **default limits** to be respected by every goto setpoint defined in your mode. You can still provide a speed limit for specific setpoints, which will overwrite the corresponding default speed limit.

To achieve this, you need to supply a `auterion::multicopter::GotoControlLimits` to your goto setpoint configurator like so:

<pre class="language-cpp"><code class="lang-cpp">auto goto_limits = auterion::multicopter::GotoControlLimits{}
    .withMaxHorizontalSpeed(max_xy)
    .withMaxVerticalSpeed(max_z)
    .withMaxHeadingRate(max_h);

// Instantiate your mode to control goto setpoints
// configured with the default speed limits above  
auterion::Mode my_mode(sdk, "My Mode", {
<strong>    auterion::multicopter::LocalFrameGotoSetpoint::Config{goto_limits}
</strong>});
</code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.auterion.com/app-development/auterion-sdk/flight-mode-api/multicopter-modes/go-to-in-local-frame.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
