Files
PX4-Autopilot/docs/assets/diagrams
Silvan Fuhrer b4134d75f2 feat(tecs): don't trade altitude for speed above trim airspeed (#29009)
* fix(tecs): don't trade altitude for speed above trim airspeed

With an airspeed setpoint above trim and the throttle at `FW_THR_MAX`, TECS pitches down to
keep chasing the setpoint and settles below the altitude setpoint.
Accelerating above trim should be the throttle's job; losing altitude at high speed is not wanted.

The pitch loop now sees the airspeed setpoint capped at max(trim, current airspeed);
the throttle loop still tracks the full setpoint. Below trim, pitch still trades height for speed, up to trim.
Overspeed above the setpoint is still corrected with pitch.
The cap fades out as the effective `FW_T_SPDWEIGHT` goes from 1 to 2, so gliders (weight 2),
fast descend and underspeed recovery keep using pitch to reach their airspeed.
The behaviour is documented in the TECS docs and the `FW_T_SPDWEIGHT` description.

Signed-off-by: Silvan <silvan@auterion.com>

* fix(tecs): use tas and not tas_sp for the pitch loop

Signed-off-by: Silvan <silvan@auterion.com>

* fix(tecs): don't counter throttle acceleration with pitch above trim

Capping the pitch loop's airspeed setpoint at max(trim, airspeed) keeps
pitch from diving to gain speed, but between trim and the setpoint the
throttle's acceleration still shows up in the kinetic energy rate
estimate. Against a kinetic energy rate setpoint of zero, the pitch loop
then pitches up and turns the throttle's energy into height. At a speed
weight of 1 this halves the acceleration and lifts the vehicle above the
altitude setpoint while accelerating.

Remove the kinetic term, setpoint and estimate, from the pitch loop
between trim and the setpoint, so pitch controls height only there. As
for the cap, this fades out with speed priority.

Point-mass simulation with the TECS defaults, speed step from 15 m/s:
- to 20 m/s: 95% of the step in 21 s instead of 37 s, 1.2 m instead of
  2.4 m above the altitude setpoint
- to 28 m/s, above the 24.7 m/s the vehicle can reach: 2.2 m instead of
  5.2 m above the altitude setpoint, still no altitude loss
- deceleration, climbs, a speed weight of 2 and cruise at trim are
  unchanged; in turbulent cruise above trim the pitch rate RMS is 6%
  higher, as the kinetic term switches when the airspeed crosses the
  setpoint

The remaining rise comes from the lift gained with speed at constant
pitch, which only altitude feedback corrects.

Assisted-by: Claude:claude-opus-5-5

* fix(tecs): fade the pitch loop's kinetic setpoint only once

Between trim airspeed and the airspeed setpoint, the capped pitch loop
setpoint already fades the kinetic energy rate setpoint in with the
speed weight between 1 and 2. Scaling it by the same fade factor again
faded the setpoint quadratically but the estimate only linearly, so at a
speed weight of 1.5 the pitch loop countered acceleration it should only
half ignore. Scale only the estimate.

Speed weights up to 1 and of 2 are unaffected. In a point-mass
simulation at a speed weight of 1.5, a step from 15 to 20 m/s now takes
30 s instead of 37 s and rises 1.6 m instead of 2.4 m, between the
results at weights 1 and 2 instead of worse than both.

Assisted-by: Claude:claude-opus-5-5

* docs(tecs): show the pitch and throttle speed roles in a diagram

The paragraph on how pitch and throttle share speed control above trim
was hard to follow. Show the three regions of measured airspeed (below
trim, between trim and the setpoint, above the setpoint) with what the
pitch and throttle loops do in each, and describe each region in its own
bullet. Also state that there is no middle region with a setpoint at or
below trim.

Assisted-by: Claude:claude-opus-5-5

---------

Signed-off-by: Silvan <silvan@auterion.com>
2026-10-15 08:33:02 +02:00
..