MAVLink mission transfer state machine#11716
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Restores the branch's protocol-service layer on top of the multi-port core: - PING and TIMESYNC replies - REQUEST_DATA_STREAM handling and per-message SET/GET_MESSAGE_INTERVAL command surface over the existing override storage - MAV_CMD_REQUEST_MESSAGE (incl. MESSAGE_INTERVAL query), REQUEST_PROTOCOL_VERSION, REQUEST_AUTOPILOT_CAPABILITIES, GET_HOME_POSITION - UBlox ellipsoid altitude, speed and heading accuracy retained in the GPS solution and emitted in GPS_RAW_INT when valid - Arming-disable reasons broadcast as STATUSTEXT once a MAVLink port is active; INAV flight-mode change notices incl. GCS NAV enter/exit - Per-port OSD-derived STATUSTEXT de-spam (changed text immediately, notice 30s / warning 10s / critical 5s repeat intervals) Unit slice: 38/38 passing.
6857a38 to
bbc962b
Compare
|
This is an AI-generated draft of things to check on — flagged for the author's judgment, not a formal review verdict. Reviewed this part in isolation ( 1. LAND-terminated missions may never report completion. This PR wires the new "waypoint reached" latch ( 2. 3. Legacy 4. Minor, bundled:
Aside, spanning the stack rather than specific to this PR: by #11717 there are now four independent |
A port that becomes active after the global arming-disable transition fired (GCS reconnecting, second radio joining later) never saw the current arming-block reason, and stale per-port STATUSTEXT de-spam state could suppress resends for up to 30s after a reconnect. - factor the duplicated per-port runtime reset in mavlink_ports.c into resetMAVLinkPortRuntimeState() and include the STATUSTEXT de-spam fields that were missing from it - add mavlinkSendArmingStatusTextToPort(): snapshot send of the current arming-disable reason to one port, without touching the global lastArmingDisableFlags edge detector - add mavlinkPortReconnected(): clears de-spam state and sends the snapshot; fired on the shared-port enable transition and on a remote HEARTBEAT that is the first on a port or follows a >5s gap
Rewritten mission protocol replacing the old ad-hoc counters (absent since the modular split): owned transfers tracking initiating system, component and ingress port; upload retries and timeouts; one-item retransmission; final MISSION_ACK; out-of-sequence recovery; explicit cancellation; legacy MISSION_REQUEST answered with MISSION_ITEM_INT. Uploads are staged and committed only on success, QGC planned-home item 0 is skipped, modifier items (speed/delay/altitude) fold onto the correct INAV waypoint, and persistence failures restore the previous mission. Successful uploads and clears update nonvolatile storage. Adds 1 Hz MISSION_CURRENT, active-item download flags, and MISSION_ITEM_REACHED broadcast from a navigation-side reached latch. Includes the live SITL mission test rig (src/test/mavlink/missions) and routing compliance harness (src/test/mavlink/routing). Unit slice: 58/58 passing. Mission translation to INAV's MSP waypoint model is lossy; downloads are best-effort reconstruction, not canonical mission backups.
Standalone 8-check pass/fail rig against a self-started SITL with the known-good multiport serial layout: MSP on UART1, MAVLink receiver telemetry and RC override on UART2, GCS heartbeat, mission upload and readback, stream-rate and message-rate control on UART3. Previously lived only in the development workspace and was never committed.
bbc962b to
05e8ec5
Compare
Part 5/7 of the mavlink_multiport2 stack.
Rewritten MAVLink mission protocol, replacing the old ad-hoc counter-based implementation (absent since part 3/7) with an owned transfer state machine. The transfer design is adapted from Betaflight's GPLv3
mavlink_mission.c(commit87d4bd63) and reshaped for INAV's routed multi-port runtime.Transfer robustness
MAV_MISSION_OPERATION_CANCELLEDreturns the transfer to idle.MISSION_REQUESTdownloads are answered withMISSION_ITEM_INT, per the current MAVLink mission service.Translation (MAVLink ↔ INAV waypoints)
DO_CHANGE_SPEED→ pending leg speed;CONDITION_DELAY→ previous waypoint becomes/updatesPOSHOLD_TIME; altitude modifiers update the previous geographic waypoint while preserving INAV'sp3bitfield semantics (bit 0 = AMSL reference, bits 1–4 = user actions).NAV_WAYPOINT→ WAYPOINT or POSHOLD_TIME (hold time set),NAV_LOITER_TIME→ POSHOLD_TIME,NAV_LAND→ LAND (retaining supplied coordinates),DO_JUMP→ JUMP with remapped target.Persistence and reporting
MISSION_CURRENT(count, current item, execution mode, state); active-item flags on downloads.MISSION_ITEM_REACHEDbroadcast to all active MAVLink ports from a navigation-side reached latch (hold-time waypoints, altitude-enforced holds, and waypoint-next transitions).Caveats
Mission translation to INAV's MSP waypoint model is lossy (leg speed, LAND elevation, RTH land flag,
p3user-action bits). MAVLink mission downloads are best-effort reconstruction from the stored MSP waypoint list — not a canonical mission backup. Documented indocs/Mavlink.md(part 7/7).Testing
mavlink_unittest).src/test/mavlink/missions/, 8 scenario cases incl. planned-home skip, modifier folding, JUMP remap, failed-upload preservation, legacy download) and the routing compliance harness (src/test/mavlink/routing/).src/test/mavlink/sanity/): 8-check pass/fail rig covering MSP, MAVLink telemetry, RC override, GCS heartbeat, mission upload/readback, and stream/message-rate control.