You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automatic fixed-wing P/I/D tuning: scope and approach before implementation
#12023
Follow-up to #12013, which was a proposal rather than a PR. The goal here is to agree on scope and approach before more code is written. Target branch for any code would be maintenance-11.x.
Problem
Fixed-wing setup today needs three separate in-flight modes (AUTO TUNE, SERVO AUTOTRIM or the FW_AUTOTRIM feature, AUTO LEVEL TRIM), and none of them sets P, I or D:
flight/pid_autotune.c learns FF and, depending on fw_autotune_rate_adjustment, the maximum rates. P/I/D stay at defaults or at whatever the pilot enters.
servo trim -> roll identification -> pitch identification -> rate gains -> check -> shared fw_p_level -> level trim -> servo trim re-check -> final check -> result held until landing -> pilot accepts or discards on the ground
Roll and pitch only by default, so a two-servo flying wing is covered. No yaw.
Stick input, the switch, failsafe/RTH or loss of eligibility end the experiment on the next control cycle and roll the settings back.
No in-flight flash write. An unrelated config save must not persist trial gains.
Navigation keeps the aircraft in bounded straight legs with recovery turns instead of an unbounded straight run.
fw_i_level (filter cutoff) and fw_d_level (HORIZON transition) stay untouched.
Out of scope for a first version: VTOL, tailsitters, rudder-only roll, stall or max-speed search, TECS-style energy control, automatic TPA/APA schedule changes.
Closed-loop bias. The unit tests feed the excitation directly into an open-loop, noise-free plant, which is the one case where least-squares ARX is unbiased. In flight the PID is active, so u depends on gyro noise and the estimate is biased. Plan: use the injected excitation as instrument (IV or two-stage), plus a closed-loop test with a PID and measurement noise that shows the remaining bias at the intended SNR.
Replay against real logs. Blackbox already logs gyroADC, axisP/I/D/F, rcCommand and servo[] (when servo logging is enabled). The estimator should run offline against real fixed-wing logs before anything runs onboard. Open: which logging rate is realistic on F4/F7, and whether logged servo[] (after mixing and limits) or the PID sum is the better plant input.
Excitation, gain synthesis and acceptance thresholds are not defined. They need flight data first.
Questions
Is P/I/D identification for fixed wing wanted at all, or should AUTO TUNE stay FF/rate-only?
If yes: offline first (estimator as a log-analysis tool, with pilot-flown doublets) or onboard with automatic excitation from the start?
Excitation: pilot-flown doublets, injection on the rate setpoint, or injection on the PID output? Setpoint injection gives a clean instrument, but the plant input then passes through the controller.
Synthesis: design against a target closed-loop response, or keep INAV's FF-dominant structure (FF from the existing autotune, P/I/D only for disturbance rejection)?
Is the one-switch sequence the right unit, or should the first deliverable only add P/I/D to the existing AUTO TUNE mode?
Not done
No flight, no hardware-in-the-loop, no SITL flight with the estimator. All results are unit tests against a synthetic two-lag plant.
Excitation amplitudes and thresholds need input from people who tune fixed wings regularly before anything is proposed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Follow-up to #12013, which was a proposal rather than a PR. The goal here is to agree on scope and approach before more code is written. Target branch for any code would be
maintenance-11.x.Problem
Fixed-wing setup today needs three separate in-flight modes (AUTO TUNE, SERVO AUTOTRIM or the
FW_AUTOTRIMfeature, AUTO LEVEL TRIM), and none of them sets P, I or D:flight/pid_autotune.clearns FF and, depending onfw_autotune_rate_adjustment, the maximum rates. P/I/D stay at defaults or at whatever the pilot enters.Proposed end state
After takeoff, one switch starts one sequence:
servo trim -> roll identification -> pitch identification -> rate gains -> check -> shared
fw_p_level-> level trim -> servo trim re-check -> final check -> result held until landing -> pilot accepts or discards on the groundfw_i_level(filter cutoff) andfw_d_level(HORIZON transition) stay untouched.Full requirements (state machine, session ownership, persistence, validation gates): fixed-wing-automatic-tuning.md @ a14677c
Estimator prototype
Kept on the fork branch
fixed-wing-tuning-10x, not built into firmware (source, tests):y[k] = -a1*y[k-1] - a2*y[k-2] + b1*u[k-1] + b2*u[k-2] + b3*u[k-3] + offsetKnown gaps (from the review of #12013)
udepends on gyro noise and the estimate is biased. Plan: use the injected excitation as instrument (IV or two-stage), plus a closed-loop test with a PID and measurement noise that shows the remaining bias at the intended SNR.gyroADC,axisP/I/D/F,rcCommandandservo[](when servo logging is enabled). The estimator should run offline against real fixed-wing logs before anything runs onboard. Open: which logging rate is realistic on F4/F7, and whether loggedservo[](after mixing and limits) or the PID sum is the better plant input.Questions
Not done
Related
All reactions