MAVLink and MSP command-control parity - #11717
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? |
57cb25b to
fd1233f
Compare
fd1233f to
b25bb9f
Compare
0cc2e89 to
3362dca
Compare
- MAV_CMD_COMPONENT_ARM_DISARM and MSP2_INAV_ARM_DISARM through the normal arming path, succeeding only when the requested state is reached - RTH via a temporary BOXNAVRTH source on the RC mode selector (activateRTHMode) instead of the failsafe/geozone forced-RTH latch; wired to MAV_CMD_NAV_RETURN_TO_LAUNCH, ArduPilot DO_SET_MODE RTL, MSP2_INAV_ACTIVATE_RTH, and Programming Framework operation 61. Cleared by a pilot flight-mode change or disarm - QGC/ArduPilot pause: DO_SET_MODE Loiter/PosHold/Brake enters normal PosHold at the current position via a temporary BOXNAVPOSHOLD source - Normal current-position LAND (transient waypoint, uploaded mission untouched) via MAV_CMD_NAV_LAND, MSP2_INAV_ACTIVATE_LANDING, PF op 62 - MAV_CMD_DO_SET_HOME through the native waypoint-0 backend - MSP2_INAV_TIMESYNC returning the MAVLink TIMESYNC boot clock - Temporary fixed-wing loiter-radius override: DO_REPOSITION.param3 (meters) or int32 loiterRadius appended to MSP2_INAV_SET_GLOBAL_TARGET (cm); volatile, cleared on disarm/reboot, only active in PosHold - SET_POSITION_TARGET_GLOBAL_INT / _LOCAL_NED guided handling - MAV_CMD_CONDITION_YAW; explicit unsupported MAV_CMD_NAV_TAKEOFF stub - GCSN OSD flight-mode element while GCS navigation is active Unit slice: 81/81 passing.
A command-triggered landing (MAV_CMD_NAV_LAND / MSP direct land) borrows NAV_STATE_WAYPOINT_RTH_LAND and the FW autoland FSM with a transient waypoint, while activeWaypointIndex still points at whatever mission item was last active. The unconditional reached-marking added for mission LAND items would emit MISSION_ITEM_REACHED for that stale index and could mark a loaded mission complete. Capture forcedLandingActivated before the existing clears and skip the marking for commanded landings at both finish sites.
3362dca to
3efee9d
Compare
|
Test firmware build ready — commit Download firmware for PR #11717 244 targets built. Find your board's
|
|
While reviewing this part, I noticed Digging a bit further: the existing GCS-assisted guided-position commands ( Is that intentional — i.e. is this feature designed so |
|
A few more things I noticed while going through this part — flagging as questions since I may be missing context on the intended design:
Minor, non-blocking:
None of this is meant as a blocker dump — mostly trying to understand the intended design on a couple of these (especially the override-clearing order and the landing-abort fallback) before suggesting specific changes. |
That's a good question because it calls into question the whole purpose of BOXGCSNAV as a user-switched mode-but-not-really thing, it's a legacy concept that doesn't really make a whole lot of sense now that there are multiple types of modes and actions that can be triggered by a GCS. This PR doesn't change the existing GCS NAV semantics, but a follow-up is going to look into using the (currently used by Geozone) SEND_TO FSM path into a generic external GOTO primitive shared by MSP and MAVLink, and i think we're going to do away with the GCS NAV switch completely. |
Gentle reminder — outstanding review itemsFollowing up on the review from 2026-08-03 above. Thanks for the reply on the The rest of that review is still open, in particular two items that look safety-relevant and haven't had a response yet:
Three more from that same comment, no response needed on these if they're intentional — just flagging so they don't get lost: No pressure on timeline, just want to make sure these didn't slip through given the gap since the last update. Happy to help narrow down a fix for #1/#2 if useful. |
|
Sorry, i had written up a response but apparently i forgot to actually send it... The PR is on the workbench, i'll address and respond tomorrow |
|
Sorry for the delay
agreed, that was missed. I’ll add that validation.
Yes, this should preserve the previous temporary nav override if the requested replacement is rejected by the FSM. I’ll fix this so a failed RTH/PosHold transition can’t silently drop an existing override and fall back to raw RC.
greed this should not fall to
this one is intentional. Commanded LAND needs to be able to break into the landing path from arbitrary nav states, including RTH. I had trouble using the table-driven transition because it made it so RTH couldn't be exited/aborted once entered. So the cross-state
that could be worth adding later, telemetry logging would cover this case in the meanwhile the other minor ones i'll keep in mind for 10.x improvements |
Part 6/7 of the mavlink_multiport2 stack.
Command-control parity between MAVLink, MSP, and the Programming Framework, so GCS and companion software can arm, navigate, and land through standard commands.
Arming
MAV_CMD_COMPONENT_ARM_DISARMandMSP2_INAV_ARM_DISARM(0x2227) go through the normal INAV arming/disarming path and ACK success only when the requested state is actually reached.RTH
MAV_CMD_NAV_RETURN_TO_LAUNCH, the ArduPilot-styleMAV_CMD_DO_SET_MODERTL request,MSP2_INAV_ACTIVATE_RTH(0x2225), and Programming Framework operation 61 all enter the normal INAV RTH mode path viaactivateRTHMode(), which adds a temporaryBOXNAVRTHsource to the RC mode selector. This deliberately does not use the failsafe/geozone forced-RTH latch — live testing showedactivateForcedRTH()is not equivalent to switching into RTH mode. The temporary source clears on a pilot RC flight-mode change or disarm, so a command-triggered RTH cannot survive into a later arming attempt.Pause / position hold
MAV_CMD_DO_SET_MODEalso accepts ArduPilot pause-style modes (PLANE_MODE_LOITER,COPTER_MODE_LOITER,COPTER_MODE_POSHOLD,COPTER_MODE_BRAKE) and enters normal INAV PosHold at the current position/altitude/heading via a temporaryBOXNAVPOSHOLDsource (this is what QGC's Pause button sends). Other GCS mode changes remainUNSUPPORTED.Landing
MAV_CMD_NAV_LAND,MSP2_INAV_ACTIVATE_LANDING(0x2224), and PF operation 62 perform a normal waypoint-style landing at the current position through a transient waypoint — the uploaded mission is not modified, and this is not emergency landing. Mission LAND items keep their supplied coordinates; direct LAND commands ignore coordinate fields.Home, time, guided
MAV_CMD_DO_SET_HOMEuses the existing waypoint-0 backend (param1 = 1= current GNSS position; explicit global location otherwise) and retains all native WP#0 safety gates. MSP set-home remainsMSP_SET_WPwaypoint 0 — no duplicate command added.MSP2_INAV_TIMESYNC(0x2228) returns the same monotonic nanosecond boot clock as MAVLinkTIMESYNC.SET_POSITION_TARGET_GLOBAL_INT/_LOCAL_NEDguided handling (waypoint 255 / altitude-only requests, gated on valid GCS navigation).MAV_CMD_CONDITION_YAWheading changes while the nav state has yaw control.MAV_CMD_DO_REPOSITION.param3in meters, orint32 loiterRadius(cm) appended toMSP2_INAV_SET_GLOBAL_TARGET(17-byte payload; 13-byte payload = no change; 0 clears).MSP2_INAV_NAV_TARGETreports the active override. Volatile: cleared on disarm/reboot, applied only while the nav FSM is in PosHold so RTH/mission/autoland loiter keeps configured defaults.MAV_CMD_NAV_TAKEOFFstub returningUNSUPPORTED(foundation for later takeoff work, no behavior introduced).GCSNwhile GCS-assisted navigation is actually active.All float command parameters are validated (finite/range) before integer conversion.
Companion PR:
mspapi2:mavlink_multiport2(synchronized message metadata + arm/RTH/land/timesync helpers).Testing
mavlink_unittest).