feat(fw_mode_manager): Do first-order-hold altitude ramp also for go-to (#27747)

Instead of climbing/descending with max speed first and then fly straight, fly diagonally to new waypoint.
This aligns the behavior between Mission and Hold modes.
This commit is contained in:
Silvan Fuhrer
2026-07-23 15:00:54 +02:00
committed by GitHub
parent f1bedda6fe
commit 8424463102
10 changed files with 396 additions and 38 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@@ -77,6 +77,23 @@ You can test it in [Gazebo](../sim_gazebo_gz/index.md) using a fixed wing frame:
make px4_sitl gz_rc_cessna
```
## Altitude Ramp on Reposition (Go-to)
When you command the vehicle to a new loiter location at a different altitude — for example a QGroundControl _Go to location_ / [reposition](https://mavlink.io/en/messages/common.html#MAV_CMD_DO_REPOSITION) while in Hold mode — PX4 does not change the altitude setpoint in a single step.
Instead it ramps the altitude setpoint linearly (a first order hold, FOH) from the vehicle's **current altitude** to the new target altitude, reaching the target by the time the vehicle arrives at the loiter circle around the new location.
The result is a smooth diagonal climb or descent along the transit to the new location, rather than an immediate climb/descent followed by level flight.
![Fixed-wing altitude profile for a climbing go-to in Hold mode](../../assets/flight_modes/fw_goto_altitude_foh.png)
The ramp is anchored at the altitude the vehicle is at when the new target is received, and its progress is measured by the vehicle's horizontal approach to the target (not by time).
If the vehicle cannot follow the ramp (for example when the required climb or sink rate exceeds what the aircraft can achieve), the altitude setpoint still reaches the full target altitude at the loiter circle.
Any remaining altitude error is then removed by climbing or sinking once the vehicle reaches the horizontal position of the new location.
::: info
The ramp is (re)started whenever the target altitude changes; a reposition that keeps the same altitude does not change the vehicle's altitude.
:::
## Parameters
Hold mode behaviour can be configured using the parameters below.

View File

@@ -217,6 +217,23 @@ The equation is:
$$L_{1_{distance}}=\frac{1}{\pi}L_{1_{damping}}L_{1_{period}}\left \| \vec{v}_{ {xy}_{ground} } \right \|$$
## Altitude Changes Between Waypoints
When the target altitude changes from one waypoint to the next, PX4 does not change the altitude setpoint in a single step.
Instead it ramps the altitude setpoint linearly (a first order hold, FOH) from the vehicle's **current altitude** to the new target altitude, reaching the target by the time the vehicle arrives at the acceptance radius of the current waypoint.
The result is a smooth diagonal climb or descent along the leg, rather than an immediate climb/descent followed by level flight.
![Fixed-wing altitude profile for a climbing mission leg](../../assets/flight_modes/fw_waypoint_altitude_foh.png)
The ramp is anchored at the altitude the vehicle is at when the new target is received, and its progress is measured by the vehicle's horizontal approach to the waypoint (not by time).
If the vehicle cannot follow the ramp (for example when the required climb or sink rate exceeds what the aircraft can achieve), the altitude setpoint still reaches the full target altitude at the acceptance radius.
Any remaining altitude error is then removed by climbing or sinking once the vehicle reaches the horizontal position of the waypoint.
::: info
The ramp is (re)started whenever the target altitude changes; consecutive waypoints at the same altitude are held level.
:::
## Mission Takeoff
Starting flights with mission takeoff (and landing using a mission landing) is the recommended way of operating a plane autonomously.