Skip to content

docs(autotune): fix fixed-wing autotune docs to match actual behavior#11677

Open
sensei-hacker wants to merge 1 commit into
iNavFlight:release/9.1from
sensei-hacker:fix-autotune-docs
Open

docs(autotune): fix fixed-wing autotune docs to match actual behavior#11677
sensei-hacker wants to merge 1 commit into
iNavFlight:release/9.1from
sensei-hacker:fix-autotune-docs

Conversation

@sensei-hacker

Copy link
Copy Markdown
Member

The fixed-wing AUTOTUNE documentation no longer matched the current implementation in src/main/flight/pid_autotune.c. A user reported confusion after their rates changed significantly during an AUTOTUNE flight, which they didn't expect based on the docs.

Changes
Corrected the pre-flight parameter table: roll_rate/pitch_rate/yaw_rate are described as fixed limits AUTOTUNE respects, but by default (fw_autotune_rate_adjustment = AUTO) AUTOTUNE actively rewrites them while flying. Documented all three fw_autotune_* settings that control this.
Removed the claim that AUTOTUNE sets P and I gains - that formula (P/I/D derived from FF) was removed from the code in 2021 (9dcf985, "Don't change P, I and D during autotune"). AUTOTUNE only ever tunes FeedForward gain and, conditionally, rate.
Added yaw to the flying instructions - the code tunes yaw identically to roll/pitch (own FF, own rate, own minimum rate floor), but the doc only described roll/pitch maneuvers.
Documented the flight-mode dependency: rate is tuned in ACRO/HORIZON but not ANGLE mode (FF still is), and AUTOTUNE has no effect at all - not even FeedForward - while flying in MANUAL mode (pid.c:881).

Roll/pitch/yaw rates are described as a fixed ceiling autotune
respects; in reality, with the default fw_autotune_rate_adjustment
setting, autotune actively rewrites roll_rate/pitch_rate/yaw_rate
while flying. The doc also claimed autotune sets P and I gains,
which hasn't been true since gain the P/I/D-from-FF formula was
removed in 2021. Neither yaw nor the MANUAL-mode no-op were
mentioned.

Rewrites the pre-flight parameter table and flying instructions to
describe what the code actually does: FeedForward is tuned on all
three axes, P/I are never touched, rate tuning depends on flight
mode and fw_autotune_rate_adjustment, and AUTOTUNE has no effect at
all in MANUAL mode.
@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Fix fixed-wing AUTOTUNE docs to match current tuning behavior

📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Document that AUTOTUNE tunes FF on all axes, never P/I gains.
• Clarify when/why AUTOTUNE rewrites roll/pitch/yaw rates during flight.
• Add yaw and flight-mode constraints, including MANUAL-mode no-op.
High-Level Assessment

The PR correctly aligns the documentation with current AUTOTUNE behavior (FF-only tuning, conditional rate adjustment, and MANUAL-mode no-op). For a docs-only fix, this direct rewrite is the most effective approach; alternatives like partial notes or addendums would likely preserve confusion.

Files changed (1) +20 / -11

Documentation (1) +20 / -11
Autotune - fixedwing.mdAlign fixed-wing AUTOTUNE docs with actual tuning logic +20/-11

Align fixed-wing AUTOTUNE docs with actual tuning logic

• Updates the AUTOTUNE description to reflect that it tunes FeedForward on roll/pitch/yaw, never P/I gains. Clarifies that rate tuning depends on flight mode and 'fw_autotune_rate_adjustment', and adds missing guidance about yaw maneuvers and MANUAL-mode having no effect.

docs/Autotune - fixedwing.md

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. LIMIT rate can rebound 🐞 Bug ≡ Correctness
Description
The docs say fw_autotune_rate_adjustment=LIMIT "only ever lowers" rates, but the implementation
can also increase a previously-lowered rate again (while still capping it at the initial rate).
Users may therefore still observe roll_rate/pitch_rate/yaw_rate increases during a LIMIT
autotune flight, contradicting the doc.
Code

docs/Autotune - fixedwing.md[27]

+fw_autotune_rate_adjustment | Controls whether/how AUTOTUNE changes `roll_rate`/`pitch_rate`/`yaw_rate` while tuning. `AUTO` (default) raises or lowers rates to match what the plane can achieve. `LIMIT` only ever lowers them, never above what you started with. `FIXED` leaves rates untouched - use this if you want AUTOTUNE to tune FeedForward only
Evidence
In the fixed-wing autotune algorithm, maxRateSetting is adjusted both upward and downward based on
rateFullStick. In non-AUTO modes (including LIMIT), the final applied rate is constrained to a
maximum of MAX(initialRate, minRate), which allows increases back up to the initial rate even if
the rate was previously reduced.

src/main/flight/pid_autotune.c[214-224]
src/main/flight/pid_autotune.c[118-123]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`docs/Autotune - fixedwing.md` currently states that `fw_autotune_rate_adjustment=LIMIT` "only ever lowers" the rates. In the code, rate adjustment can step up or down by 10 dps based on measured capability; in LIMIT mode it is merely *capped* at the starting rate (and can rise back toward that cap).

## Issue Context
This is documentation-only, but it can still mislead users who choose LIMIT expecting a strictly one-way decrease.

## Fix Focus Areas
- docs/Autotune - fixedwing.md[27-27]

Suggested wording example:
- Replace "LIMIT only ever lowers them" with something like "LIMIT will not increase rates above the starting values (but may raise a previously-lowered rate back up to that cap)."

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

roll_rate | Starting roll rate for your airplane. Unless you set `fw_autotune_rate_adjustment` to `FIXED` (see below), AUTOTUNE will change this value while you fly - it's a starting point, not a ceiling it respects
pitch_rate | Starting pitch rate for your airplane. Same caveat as `roll_rate`
yaw_rate | Starting yaw rate for your airplane. Same caveat as `roll_rate`
fw_autotune_rate_adjustment | Controls whether/how AUTOTUNE changes `roll_rate`/`pitch_rate`/`yaw_rate` while tuning. `AUTO` (default) raises or lowers rates to match what the plane can achieve. `LIMIT` only ever lowers them, never above what you started with. `FIXED` leaves rates untouched - use this if you want AUTOTUNE to tune FeedForward only

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Limit rate can rebound 🐞 Bug ≡ Correctness

The docs say fw_autotune_rate_adjustment=LIMIT "only ever lowers" rates, but the implementation
can also increase a previously-lowered rate again (while still capping it at the initial rate).
Users may therefore still observe roll_rate/pitch_rate/yaw_rate increases during a LIMIT
autotune flight, contradicting the doc.
Agent Prompt
## Issue description
`docs/Autotune - fixedwing.md` currently states that `fw_autotune_rate_adjustment=LIMIT` "only ever lowers" the rates. In the code, rate adjustment can step up or down by 10 dps based on measured capability; in LIMIT mode it is merely *capped* at the starting rate (and can rise back toward that cap).

## Issue Context
This is documentation-only, but it can still mislead users who choose LIMIT expecting a strictly one-way decrease.

## Fix Focus Areas
- docs/Autotune - fixedwing.md[27-27]

Suggested wording example:
- Replace "LIMIT only ever lowers them" with something like "LIMIT will not increase rates above the starting values (but may raise a previously-lowered rate back up to that cap)."

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant