Repository navigation
feat(plugins): add control surface setup plugin for planes and tilt-rotors - #2437
Allister779 wants to merge 8 commits into
Conversation
Coverage Report for CI Build 46657757621Warning No base build found for commit Coverage: 96.186%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats💛 - Coveralls |
636c70b to
bd976f1
Compare
bd976f1 to
101dc0d
Compare
amilcarlucas
left a comment
There was a problem hiding this comment.
"Save to flight controller" is misleading. The controls write edits immediately. The button reads back only parameters edited in the plugin, then stages those and cached values in the current step. Once it reads every value it stages, I’d use "Read from flight controller" and keep the tooltip’s explanation of where the values go. The success dialog needs the same correction. Button label (line 179) · Success message (line 189)
AI Findings, use with care:
- [P1] Tilt setup can guide users to calibrate the wrong endpoint. The hover UI always presents MIN or MAX as the vertical adjustment. ArduPlane uses an interior position for vectored yaw when Q_TILT_YAW_ANGLE is nonzero, and uses TRIM as vertical for bicopters. The guidance can lead users to shift the physical travel limits while trying to center the mechanism. Endpoint selection (line 569) · ArduPlane 4.6 vectored yaw · ArduPlane 4.6 bicopter
- [P1] A mode change can go through before the plugin knows the original mode. The mode buttons check battery voltage, and the model checks for a connection. With no heartbeat yet, a successful command leaves _initial_mode unset and cleanup skips restoration. The same path permits commands while armed. Require a fresh heartbeat from the selected controller and a known disarmed state before sending bench-test commands. Mode button handler (line 441) · Mode capture and restoration (line 420)
- [P2] Readback can report success with stale values. If the controller has changed since the last download, clicking the button on an untouched tab can stage the old values and report success with zero reads. Fetch every parameter the action will stage and report mismatches against pending live edits. Staging loop (line 279)
- [P2] A readback timeout aborts the action without a result dialog. fetch_param() raises TimeoutError, which escapes the loop and the Tk callback. Earlier values may already be staged, and the remaining parameters are skipped. Report the failed read in the result and make any partial staging visible. Staging loop (line 292) · Backend timeout (line 432)
- [P2] Leaving an untouched numeric field sends a parameter write. _LiveSpinbox calls its write handler on every focus loss, including when the displayed value is unchanged. Moving through fields can silently write cached values back to the controller. Track whether the user actually edited the field before sending a write. Spinbox bindings (line 60)
|
Thanks for the review. Changes are in 978ddaa, and I've tested them on a tilt-tri VTOL (Q_TILT_TYPE 2, Plane 4.7.3 and Plane 4.6.0). Your review points
Found during hardware testing
|
…otors Add a control_surface_setup plugin to ArduPlane step 23 (general configuration) that guides the user through: 1. Servo direction in FBWA: move the airframe and live-toggle SERVOx_REVERSED for aileron, elevator, rudder, elevon and V-tail outputs. 2. Stick direction: live-toggle RCx_REVERSED for the RCMAP roll/pitch/yaw channels. 3. Trim and travel in MANUAL: live SERVOx_TRIM/MIN/MAX editing with a warning beyond 1500 +/- 50 us, and roll/pitch/yaw sliders that simulate stick input with RC_CHANNELS_OVERRIDE (center and release buttons). 4. Tilt rotors (Q_TILT_ENABLE=1, Q_TILT_MASK>0): verify Q_TILT_TYPE, Q_TILT_YAW_ANGLE and Q_TILT_FIX_ANGLE, then set tilt servo reversal and forward (MANUAL) and hover (QSTABILIZE) end points. Flight-mode changes require battery voltage above BATT_ARM_VOLT. Save reads the live values back from the FC and stages them in the current step. Leaving the step releases overrides and restores the original flight mode. The flight controller backend gains set_flight_mode (MAV_CMD_DO_SET_MODE), send_rc_channels_override and request_servo_output_messages. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Allister779 <[email protected]>
…d sticks - Stick direction tab: add a "Switch to MANUAL" button beside FBWA so the user can check RC stick directions in either mode. - Trim and travel tab: remove the simulated stick sliders. The user moves the transmitter sticks to drive the surfaces to their limits instead. - Remove the now unused RC_CHANNELS_OVERRIDE support from the model and the flight controller backend, along with the GCS system id warning. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Allister779 <[email protected]>
… servo telemetry Pylint duplicate-code flagged the servo telemetry backend and a test assertion. The RC telemetry backend now exposes stream request and restore hooks, so the servo backend overrides them and filters the shared bounded read instead of copying it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Allister779 <[email protected]>
…rchitecture index Add the control surface setup plugin to the plugin list in ARCHITECTURE.md and give the tilt-rotor "Acknowledge settings" button and "Reversed" check boxes mouse-over tooltips, as COMPLIANCE.md requires for all GUI elements. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Allister779 <[email protected]>
…ndings Review feedback: - Replace "Save to flight controller" with "Read from flight controller": every value is fetched fresh from the FC, live edits must read back unchanged, and nothing is staged unless every read succeeds. - Require a recent HEARTBEAT with the vehicle disarmed before mode switches and live writes; disable the mode buttons and say why. - Follow the ArduPilot tilt-rotor setup procedure: set the tilt angles first, set REVERSED so motors tilt forward in MANUAL and up in QSTABILIZE, then adjust both end points and repeat. Handle bicopter tilt servos (hover at TRIM) and point vectored-yaw users to Q_OPTIONS bit 10. Bench-test findings: - Write typed but unconfirmed values before any button acts. - Refresh the parameter table's current FC value on every read-back, not only when the parameter is first added to the step. - Allow tilt servo end points outside the documented range with a warning, since reaching the tilt angles often needs this. - Add Q_OPTIONS to the tilt tab as one checkbox per bit, named from the firmware metadata, and read it back with the tilt settings. - Label both tilt-tab read-back buttons "Read from flight controller". Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Allister779 <[email protected]>
978ddaa to
042da87
Compare
Previous review (2026-12-01)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Thanks for the thorough update. At 978ddaa the earlier points are fixed: the readback relabel and all-or-none staging, timeout handling, change-only spinbox writes, bicopter TRIM, and the disarmed/heartbeat gate on the buttons. Two safety gaps remain. Blocking
Should fix
Not fully reviewed: commits after 978ddaa (the PR head is now 042da87), plus hardware, real-Tk and bicopter/Plane 4.6 behaviour. Head moved during review: observed |
- Restore the original flight mode on close only when a fresh heartbeat shows the vehicle disarmed; otherwise skip it and log a warning. - Treat Q_TILT_TYPE as reboot-required (Tiltrotor::setup reads it only at boot): after a change, lock the tilt end points, Reversed boxes and tilt mode buttons until the FC reconnects, and list it in the reboot prompt. - Drop scheduled field writes on suspend and deactivate, and refuse all writes and read-backs until the plugin is active again. - On resume, forget the plugin's own writes that a new parameter download superseded, and read Q_OPTIONS fresh from the FC before each bit change so other bits are never dropped. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Allister779 <[email protected]>
Previous review (2026-12-01)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Still changes requested at 042da87. Blocking
Should fix
|
Previous review (2026-12-01)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head Still changes requested at edb70d2; one blocker remains. Blocking
Minor (1)
|
…ter an FC reboot The boot Q_TILT_TYPE lived in the model and was reset on every new link, so reopening the step or a connection recovery unlocked tilt calibration without a reboot. Keep it per flight controller and move it only when the FC uptime in SERVO_OUTPUT_RAW shows a reboot: the uptime went backwards, or is shorter than the time since the last reading. A possible 32-bit uptime wrap keeps the lock. Also list Q_TILT_TYPE for reboot whenever the lock stands, and make the tilt mode buttons re-check the lock after writing a value typed into a field. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Allister779 <[email protected]>
|
Thanks. Fixed in 70f5b6e, and tested on hardware (Windows build, Plane 4.7.3).
A "Reboot flight controller" button on the tilt tab will follow in a separate PR. |
Previous review (2026-12-02)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head No blockers remain at 70f5b6e. Three smaller issues are left, all from telemetry queued during a pause or from a stale parameter cache. Should fix
Minor (1)
|
Packets queued while the plugin was not reading looked current when it resumed. A disarmed HEARTBEAT from before a pause could enable bench commands on a vehicle armed since, and an old SERVO_OUTPUT_RAW could look like an FC reboot and clear the Q_TILT_TYPE lock. Discard the queue and forget the last heartbeat on activation; if the queue cannot be emptied, drop the FC uptime baseline too, so no reboot is assumed. The parameter cache does not follow live writes, so read Q_TILT_TYPE from the FC on activation and when accepting a reboot. Reopening the step after a change then still shows the new type and the reboot request, and a reboot records the saved type instead of a stale one. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Allister779 <[email protected]>
|
Thanks. Fixed in ff53260. I tested the heartbeat case in SITL (
|
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head No blockers at ff53260. Three smaller issues remain: a failed Q_TILT_TYPE read, a very deep telemetry backlog, and servo functions changed while the step is paused. Should fix
Minor (1)
|
Description
Adds a control surface setup plugin to ArduPlane step
23_general_configuration.param. It guides the user through setting up the physical flight controls of a plane, and the tilt servos of a tilt-rotor QuadPlane. Every adjustment is written to the flight controller immediately, so the surfaces move while the user edits them. Save to flight controller reads each value back from the FC and records it, with a change reason, in the current step file.The plugin assumes that the RC inputs, the board orientation and the
SERVOx_FUNCTIONoutputs were set up in earlier steps.Tabs
SERVOx_REVERSED: move the airframe by hand. The surfaces must oppose the motion, following the four channel plane guideRCx_REVERSEDfor theRCMAP_ROLL/PITCH/YAWchannelsSERVOx_TRIM/MIN/MAX, with a warning when trim is more than 50 µs from 1500Q_TILT_ENABLE=1)Q_TILT_TYPE,Q_TILT_YAW_ANGLE,Q_TILT_FIX_ANGLE, and tilt-servo reversal and forward/hover end points (tilt-rotor setup)Primary flight-control functions: 4, 19, 21 and 77–80. Several outputs can share a function, for example one per aileron. Tilt functions: 41, 45, 46, 47, 75 and 76.
Safety
BATT_ARM_VOLT. The plugin can command FBWA, MANUAL or QSTABILIZE even when they are not configured inFLTMODEx.Q_TILT_MASK > 0. A warning is shown whenKFF_RDDRMIX = 0, because the rudder then does not respond when the plane is rolled in FBWA.MIN <= TRIM <= MAXmust hold.RebootRequiredparameters that were changed.Backend
FlightControllergainsset_flight_mode()(MAV_CMD_DO_SET_MODEwith a custom mode) andrequest_servo_output_messages()(SERVO_OUTPUT_RAWinterval). A plugin-localServoTelemetryBackendreadsSERVO_OUTPUT_RAWandHEARTBEATfor the live PWM and flight-mode display. The design notes are inARCHITECTURE_control_surface_setup.md.Checklist
git commit --signoff)Testing
The local pre-push
mypyhook was skipped. It reports 3 Windows-only errors on Linux (backend_internet.py,frontend_tkinter_base_window.py), and those files are not touched by this PR.🤖 Generated with Claude Code