Skip to content

TECS: added descent rate control - #33864

Open
tridge wants to merge 6 commits into
ArduPilot:masterfrom
tridge:pr-tecs-descent-rate
Open

TECS: added descent rate control#33864
tridge wants to merge 6 commits into
ArduPilot:masterfrom
tridge:pr-tecs-descent-rate

Conversation

@tridge

@tridge tridge commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

For some missions you want to descend at a very specific rate. This particular feature was developed by @priseborough for a high altitude glider for atmospheric sampling.

Classification & Testing (check all that apply and add your own)

  • Checked by a human programmer
  • Non-functional change
  • No-binary change
  • Infrastructure change (e.g. unit tests, helper scripts)
  • Automated test(s) verify changes (e.g. unit test, autotest)
  • Tested manually, description below (e.g. SITL)
  • Tested on hardware
  • Logs attached
  • Logs available on request

Only tested in SITL so far, pending flight test on a real vehicle

Description

I've set this up to be disabled by default as this type of control is rarely needed, but when it is needed it is hard to do accurately outside of TECS.

priseborough and others added 6 commits July 28, 2026 18:25
Adds set_descent_rate_override(), which makes the height controller track
a commanded sink rate instead of the mission height profile. The demanded
rate must lie between -TECS_CLMB_MAX and TECS_SINK_MAX, and lapses after
the requested duration so that loss of the commanding link reverts to
normal height control. A landing approach or flare drops the request.

Gated on AP_TECS_DESCENT_RATE_ENABLED, which defaults on for boards with
more than 2048k of flash. The TECS log flags field gains a ninth bit and
so widens from B to H on all builds, including those with the feature
compiled out, to keep the log schema the same everywhere.

Co-authored-by: Andrew Tridgell <andrew@tridgell.net>
Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
Only accepted when the current mode uses auto-throttle, except for a
cancel, which is always allowed through.

Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
Adds vehicle:set_tecs_descent_rate_override() plus an example script
which commands a fixed sink rate while flying a LOITER_TO_ALT item.

Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
Flies the glider up under a balloon, releases at 15km, and then checks
that the descent rate override achieves and holds each of a range of
demanded sink rates on the way down, before confirming that releasing
the override hands height control back to TECS.

Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
@tridge tridge added the Plane label Jul 28, 2026
@IamPete1

Copy link
Copy Markdown
Member

A rate input would be usefull. But having it as a override is a little odd. I would like to see TECS behave a little more like the VTOL controllers where you can input either a height, a rate, or a height and a rate. For example in FBWB we have to do the integration of a rate to a height in plane.

I'm also not really a fan of scripting reaching in and messing with the stuff other modes are doing. If scripting wants to do something it should be in a scripting mode.

@timtuxworth

timtuxworth commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

I'm also not really a fan of scripting reaching in and messing with the stuff other modes are doing. If scripting wants to do something it should be in a scripting mode.

It would be nice if we had scripted modes in plane ;-)

@tridge

tridge commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

If scripting wants to do something it should be in a scripting mode.

I think that would be a massive overkill for this functionality. Right now we have just one user who wants this functionality (a high altitude glider doing atmospheric sampling where descent rate matters for the instrument) and for that user this lua override is exactly what they want. The new mode capability is a cool trick but it doesn't mean we have to use it everywhere. This application does want all of the other AUTO features, but just wants to change one thing, the ability to switch TECS to a descent rate.
The pattern we have in TECS is to use these one loop overrides. See set_pitch_min() and set_pitch_max() for example.
Once we have this maths in TECS we can think about using it for other use cases. We could use it in CRUISE/FBWA for example, but that is out of scope for this PR.

@IamPete1

Copy link
Copy Markdown
Member

We do already have a scripting mode, Guided. My concern here is that this new binding allows a script to mess about with TECS in safety critical modes such as RTL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants