Repository navigation
Conversation
Previous review (2026-10-21)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head The tilt update now uses the final throttle, so the THR_MAX fix works and the new tests fail on master as they should, but the move also places the tilt update after the ICE throttle override. Blocking
Minor (1)
|
Global Size Summary (Total Flash delta in bytes)Built from fa476e8 rebased onto 3d24375
|
3f2c92b to
96b663d
Compare
Previous review (2026-10-22)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head The tiltrotor THR_MAX fix looks good at 96b663d, with one small PR-description update suggested. Since the last review, the tilt update was moved before the disarmed and ICE throttle overrides (ArduPlane/servos.cpp:930), the redundant motor-test check was removed, and the new TiltrotorICEThrottleLimits test fails on the previous head and passes now. Minor (1)
|
Run the tiltrotor output update after Plane has completed its normal throttle processing. This makes direct tilt-motor forward thrust consume the same battery-compensated, limited and suppressed throttle value as the fixed-wing throttle output without caching limits or adding a tiltrotor-specific limiter. Update the tiltrotor before the disarmed throttle outputs and the ICE engine throttle override. Those only apply to the fixed-wing throttle output, and the ICE override holds it at zero while the engine is not running, which would remove tilt-motor forward thrust. Only apply the ICE idle throttle as a minimum throttle limit while the engine is running. When it is not running the ICE override replaces the engine's throttle anyway, and the idle minimum would otherwise drive the electric tilt motors with zero throttle demand. This also stops TECS from assuming idle thrust from a stopped engine. Keep tiltrotor updates disabled during motor tests, matching the previous early return from QuadPlane::update(). This makes the motor test check in continuous_update() redundant, so remove it.
Exercise continuous and binary tiltrotors in FBWA with full pilot throttle and THR_MAX set to 60 percent. Check the mean tilt-motor PWM remains at the configured limit while allowing differential rudder output to cancel in the average. Set Q_TILT_TYPE explicitly for the binary case because the tilt-tricopter model defaults to continuous tilt. Repeat the vectored case with ICE_ENABLE set and the engine never started, so the ICE throttle override holds the fixed-wing throttle at zero. The tilt motors must still provide forward thrust and honour THR_MAX. Also check that with ICE_IDLE_PCT set and the engine never started, the tilt motors follow zero pilot throttle rather than the engine idle throttle.
96b663d to
fa476e8
Compare
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head The tiltrotor THR_MAX fix still works at fa476e8; one new minor behaviour question and the description update remain. Since the last review, the ICE idle floor is now applied only while the engine is running, and the new TiltrotorICEIdleThrottle test passes at head and fails on the previous head. Minor
Not fully reviewed: CI at fa476e8 was still running (plane-tests1b, Durandal, linux base); the RPM idle governor and in-flight engine stop/restart were not exercised. |
|
Re the ICE idle floor on the tilt motors with the engine running: that is intended. The tilt motors now follow every fixed-wing throttle limit, |
|
This is still on my list, changing the ordering of operations likes this makes me very nervous. I plan to tidy up how we do throttle outputs (#34351 is part of that) in the hope that we can do a smaller re-order that is more clearly correct. The bug that this addresses has been in tiltrotor forever as far as I can tell so I don't think we need to rush out a fix, but I would like to fix this before the 4.8 |
Summary
Finalize Plane's forward throttle output before the tiltrotor consumes it, so tilting motors in fixed-wing flight honour the same throttle limits as the normal fixed-wing throttle output.
This is an alternative implementation to #34277 and fixes #34274.
Classification & Testing (check all that apply and add your own)
Tested in SITL at
fa476e8e67:Tools/autotest/autotest.py build.PlaneTools/autotest/autotest.py test.QuadPlane.TiltrotorThrottleLimitsTools/autotest/autotest.py test.QuadPlane.TiltrotorBinaryThrottleLimitsTools/autotest/autotest.py test.QuadPlane.TiltrotorICEThrottleLimitsTools/autotest/autotest.py test.QuadPlane.TiltrotorICEIdleThrottleTools/autotest/autotest.py test.QuadPlane.TiltrotorVectoringRollTools/scripts/check_branch_conventions.py --base-branch upstream/masterAll passed. The throttle-limit tests set
THR_MAX=60, command full pilot throttle in FBWA, and check the mean tilt-motor PWM remains at the configured limit. The binary test explicitly setsQ_TILT_TYPE=1; thequadplane-tilttrimodel otherwise defaults to continuous tilt.The two ICE tests use
quadplane-tilthvecwithICE_ENABLE=1and the engine never started.TiltrotorICEThrottleLimitschecks the tilt motors still give forward thrust and honourTHR_MAXwhile the ICE override holds the engine throttle at zero.TiltrotorICEIdleThrottlesetsICE_IDLE_PCT=20and checks the tilt motors follow zero pilot throttle, not the engine idle.Description
Plane::set_servos()currently callsquadplane.update()beforeset_throttle().quadplane.update()callstiltrotor.update(), which readsk_throttleand immediately writes the tilting motors throughoutput_motor_mask(). In manual-throttle fixed-wing modes this happens beforeset_throttle()applies battery compensation, throttle limits and suppression, so the direct motor output can bypassTHR_MAXeven though the subsequently limited throttle channel andCTUN.ThOlook correct.Difference from #34277
#34277 leaves the tiltrotor output in its current position, splits throttle-limit calculation from application, caches the calculated limits, and applies the previous loop's cached values at the tiltrotor reads.
This PR changes the ordering instead:
quadplane.update()updates transition state and, in VTOL modes, writes the forward-throttle demand.set_throttle()performs the existing battery compensation, min/max limiting, watt limiting, reverse-thrust gating and suppression without modification.throttle_slew_limit()applies the existing slew limit.tiltrotor.update()consumes that finalized current-loop throttle and writes the tilt-motor output.throttle_override()are applied to the engine throttle channel, thenservos_output()writes the remaining outputs.This avoids a second throttle-limit application path, cached state, invalid-cache fallbacks and a one-loop stale-limit window. The existing limit calculation remains in its original location, so the watt limiter, forward battery compensation and TECS limit setters keep their current ordering and inputs.
THR_PASS_STABalso retains its existing behaviour because the tiltrotor consumes whatever the normal Plane throttle pipeline produces.tiltrotor.update()deliberately runs before the disarmed and ICE overrides. Those overrides only apply to the engine throttle output. While the engine is not running, the ICE override holds that output at zero (orICE_START_PCTwhile cranking), which would otherwise remove all tilt-motor forward thrust.ICE idle throttle
apply_throttle_limits()now only adds the ICE idle throttle (ICE_IDLE_PCTor the RPM idle governor) to the minimum throttle while the engine is in the running state. When the engine is not running, the ICE override replaces the engine throttle anyway, and the idle minimum would otherwise drive the electric tilt motors with zero throttle demand. It also stops TECS from assuming idle thrust from a stopped engine.While the engine is running, the tilt motors follow the same limited throttle as the engine, including the idle floor. This is intentional: the tilt motors honour every fixed-wing throttle limit,
THR_MINincluded, and the ICE idle is part of that limit set, which TECS also plans with.Motor test
Moving the call outside
quadplane.update()would otherwise make it run during a motor test, wherequadplane.update()currently returns early. A motor-test early return intiltrotor.update()preserves that behaviour, so the now-redundant motor-test check incontinuous_update()is removed. The check inbicopter_output()stays.The regression tests cover both continuous/vectored and actual binary tiltrotor output paths. The existing vectoring-roll test is also run to check that moving the update later in
set_servos()does not change tilt-vectoring direction.AI assistance
This contribution was AI-assisted.