# MC Setpoint Tuning (Trajectory Generator)

This document provides an overview of the multicopter tuning parameters that change the *user experience*: how fast the vehicle reacts to stick movements or direction changes in missions, the maximum allowed velocity, etc.

In other words, this topic explains how to tune the parameters that affect the value of a *desired setpoint* rather than those that affect how well the vehicle *tracks* the setpoint).

The algorithm that generates those setpoints is called a "trajectory generator".

:::warning This guide is for advanced users/experts. :::

:::tip Follow the instructions in the [Multicopter PID Tuning Guide](/px4-user-guide/airframes/frames_multicopter/config_mc/pid_tuning_guide_multicopter.md) *before* doing any of the tuning described here. Do not use these tuning parameters to fix bad tracking or vibration! :::

## Overview

The input to the P/PID controller is a *desired setpoint* that the vehicle should attempt to track. [PID Tuning](/px4-user-guide/airframes/frames_multicopter/config_mc/pid_tuning_guide_multicopter.md) ("Lower level tuning") aims to reduce the error between the desired setpoint and the estimate of the vehicle state.

The *desired setpoint* passed to the P/PID controller is itself calculated from a *demanded setpoint* based on a stick position (in RC modes) or from a mission command. The demanded setpoint can change very quickly (e.g. if a user moves stick from zero to maximum value as a "step"). Vehicle flight characteristics are better if the corresponding desired setpoint changes as a "ramp".

*Setpoint value tuning* ("higher level tuning") is used to specify the mapping between the *demanded* and the *desired* setpoints - i.e. defining the "ramp" at which the desired setpoint follows the demanded setpoint.

:::tip Poorly tuned [P/PID Gains](/px4-user-guide/airframes/frames_multicopter/config_mc/pid_tuning_guide_multicopter.md) can lead to instability. Poorly tuned *setpoint values* cannot result in instability, but may result in either very jerky or very unresponsive reactions to setpoint changes. :::

## Flight Modes Trajectory Support

[Mission mode](/px4-user-guide/flying/flight_modes/mission.md) used the [Jerk-limited](/px4-user-guide/airframes/frames_multicopter/config_mc/mc_trajectory_tuning/mc_jerk_limited_type_trajectory.md) trajectory all the time.

[Position mode](/px4-user-guide/flying/flight_modes/position_mc.md) supports the [implementations](#position-mode-implementations) listed below. It uses the acceleration based mapping by default; other types can be set using [MPC\_POS\_MODE](/px4-user-guide/advanced_config/parameter_reference.md#MPC_POS_MODE).

[Altitude mode](/px4-user-guide/flying/flight_modes/altitude_mc.md) similarly supports the [implementations](#altitude-mode-implementations) selected by [MPC\_POS\_MODE](/px4-user-guide/advanced_config/parameter_reference.md#MPC_POS_MODE), but *only* for smoothing the vertical component (i.e. when controlling the altitude).

No other modes support trajectory tuning.

## Position Mode Implementations

The following list provides an *overview* of the different implementations of how the stick input is interpreted and turned into trajectory setpoints:

* Acceleration based (Default)
  * Horizontal stick input mapped to acceleration setpoints.
  * Intuitive stick feel because it's like pushing the vehicle around.
  * No unexpected tilt changes upon reaching travel speed velocity.
  * Vertical stick input mapped with jerk-limited trajectory.
  * Set in position mode using `MPC_POS_MODE=4`.
* [Jerk-limited](/px4-user-guide/airframes/frames_multicopter/config_mc/mc_trajectory_tuning/mc_jerk_limited_type_trajectory.md)
  * Used when smooth motion is required (e.g.: filming, mapping, cargo).
  * Generates symmetric smooth S-curves where the jerk and acceleration limits are always guaranteed.
  * May not be suitable for vehicles/use-cases that require a faster response - e.g. race quads.
  * Set in position mode using `MPC_POS_MODE=3`.
* **Simple position control**
  * Sticks map directly to velocity setpoints without smoothing.
  * Useful for velocity control tuning.
  * Set in position mode using `MPC_POS_MODE=0`.

## Altitude Mode Implementations

Analogously to [position mode implementations](#position-mode-implementations) these are the implementations for interpreting vertical stick input:

* [Jerk-limited](/px4-user-guide/airframes/frames_multicopter/config_mc/mc_trajectory_tuning/mc_jerk_limited_type_trajectory.md)
  * Smoothed vertical input.
  * Set in altitude mode with `MPC_POS_MODE` 3 or 4.
* **Simple altitude control**
  * Unsmoothed vertical input.
  * Set in altitude mode only when using `MPC_POS_MODE=0`.


---

# Agent Instructions: 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://px4.gitbook.io/px4-user-guide/airframes/frames_multicopter/config_mc/mc_trajectory_tuning.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.
