Skip to content

fix(navigator): honor NAV_LAND mission item abort altitude (param1)#27454

Merged
dakejahl merged 2 commits into
PX4:mainfrom
anoshyn:fix/land-abort-altitude
Jun 3, 2026
Merged

fix(navigator): honor NAV_LAND mission item abort altitude (param1)#27454
dakejahl merged 2 commits into
PX4:mainfrom
anoshyn:fix/land-abort-altitude

Conversation

@anoshyn

@anoshyn anoshyn commented May 24, 2026

Copy link
Copy Markdown
Contributor

A MAV_CMD_NAV_LAND mission item carries a param1 "minimum abort altitude" (the height above the landing point to climb to if the landing is aborted; 0 = use the system default). PX4 parsed and dropped it — there was a long-standing // TODO: abort alt param1 — so an aborted landing always climbed to the global MIS_LND_ABRT_ALT, ignoring the per-item value.

This carries param1 in the otherwise-unused time_inside field on upload (nothing reads time_inside for a LAND item), and in MissionBase::do_abort_landing() uses it as the climb-above-landing-point height when set (> 0), falling back to MIS_LND_ABRT_ALT otherwise. The value also round-trips on mission download (the reverse format_mavlink_mission_item() TODO is resolved too).

  • Items with param1 = 0, including missions stored by older firmware (parsed into a zero-initialized item), keep using the MIS_LND_ABRT_ALT default — no behavior change for existing missions.
  • Normal (non-aborted) landings are unaffected; time_inside is not consumed for LAND items elsewhere.
  • Scope is fixed-wing NAV_CMD_LAND aborts, matching the existing abort behavior; VTOL_LAND is unchanged.
  • MIS_LND_ABRT_ALT parameter docs now note it is the default when the item doesn't specify its own abort altitude.

Fixes #27290

A NAV_CMD_LAND mission item's param1 (minimum abort altitude above the
landing point) was parsed and dropped with a long-standing TODO, so an
aborted landing always climbed to the global MIS_LND_ABRT_ALT regardless
of the per-item value.

Carry param1 in the otherwise-unused time_inside field on upload, and in
do_abort_landing() use it as the climb-above-landing-point height when
set (> 0), falling back to MIS_LND_ABRT_ALT otherwise. The value also now
round-trips on mission download. Items without a specified abort altitude
(param1 = 0), including missions stored by older firmware, keep using the
parameter default.

Fixes PX4#27290

Signed-off-by: Andrii Anoshyn <anoshyn.andrii@gmail.com>
@github-actions github-actions Bot added kind:bug Something is broken or behaving incorrectly. risk:safety-critical May affect arming, failsafe, control, navigation, or flight safety. scope:navigation Missions, RTL, geofence, takeoff, landing, or navigator behavior. scope:mavlink MAVLink module, streams, commands, or protocol handling. scope:parameters Parameter definitions, metadata, migration, or defaults. labels May 24, 2026
@github-actions

github-actions Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 104 byte (0.01 %)]
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +104  +0.0%    +104    .text
     +12%     +48   +12%     +48    MissionBase::do_abort_landing()
    +0.0%     +40  +0.0%     +40    g_cromfs_image
    +1.1%      +8  +1.1%      +8    MavlinkMissionManager::format_mavlink_mission_item()
    +0.0%      +8  +0.0%      +8    [section .text]
  +0.0%     +54  [ = ]       0    .debug_abbrev
  +0.0%    +255  [ = ]       0    .debug_info
  +0.0%    +107  [ = ]       0    .debug_line
   -83.3%      -5  [ = ]       0    [Unmapped]
    +0.0%    +112  [ = ]       0    [section .debug_line]
  +0.0%     +24  [ = ]       0    .debug_loclists
  +0.0%     +29  [ = ]       0    .debug_rnglists
   -50.0%      -1  [ = ]       0    [Unmapped]
    +0.0%     +30  [ = ]       0    [section .debug_rnglists]
  +0.0%     +19  [ = ]       0    .debug_str
  -1.0%    -104  [ = ]       0    [Unmapped]
  +0.0%    +488  +0.0%    +104    TOTAL

px4_fmu-v6x [Total VM Diff: 136 byte (0.01 %)]
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +136  +0.0%    +136    .text
    +0.0%     +76  +0.0%     +76    g_cromfs_image
     +12%     +48   +12%     +48    MissionBase::do_abort_landing()
    +1.1%      +8  +1.1%      +8    MavlinkMissionManager::format_mavlink_mission_item()
    +4.8%      +4  +4.8%      +4    FlightTask
  +0.0%     +54  [ = ]       0    .debug_abbrev
  +0.0%    +255  [ = ]       0    .debug_info
  +0.0%    +107  [ = ]       0    .debug_line
   -83.3%      -5  [ = ]       0    [Unmapped]
    +0.0%    +112  [ = ]       0    [section .debug_line]
  +0.0%     +60  [ = ]       0    .debug_loclists
  +0.0%     +33  [ = ]       0    .debug_rnglists
    [NEW]      +3  [ = ]       0    [Unmapped]
    +0.0%     +30  [ = ]       0    [section .debug_rnglists]
  +0.0%     +19  [ = ]       0    .debug_str
  -2.0%    -136  [ = ]       0    [Unmapped]
  +0.0%    +528  +0.0%    +136    TOTAL

Updated: 2026-05-30T12:45:40

@dakejahl
dakejahl requested review from julianoes, ryanjAA and sfuhrer May 27, 2026 03:19
Comment thread src/modules/navigator/mission_base.cpp Outdated
@julianoes
julianoes requested a review from hamishwillee May 28, 2026 00:28
Comment thread src/modules/mavlink/mavlink_mission.cpp Outdated

Copilot AI left a comment

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.

Pull request overview

Fixes a long-standing TODO so that MAV_CMD_NAV_LAND's param1 (per-item minimum abort altitude above the landing point) is no longer silently dropped. The value is stashed in the unused mission_item_s::time_inside slot on upload, read back in MissionBase::do_abort_landing() (falling back to MIS_LND_ABRT_ALT when zero/unset), and round-tripped on mission download.

Changes:

  • Parse param1 from MAV_CMD_NAV_LAND into mission_item->time_inside and emit it back from format_mavlink_mission_item().
  • Use _mission_item.time_inside (when > FLT_EPSILON) as the abort climb-above-landing-point height in MissionBase::do_abort_landing().
  • Clarify the MIS_LND_ABRT_ALT parameter description as the default when LAND param1 is unspecified.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/modules/mavlink/mavlink_mission.cpp Stores/restores MAV_CMD_NAV_LAND param1 via mission_item.time_inside; removes both abort-alt TODOs.
src/modules/navigator/mission_base.cpp Uses the per-item abort altitude (from time_inside) when computing the abort loiter altitude, falling back to MIS_LND_ABRT_ALT.
src/modules/navigator/mission_params.yaml Documents MIS_LND_ABRT_ALT as the default when the LAND mission item doesn't specify its own abort altitude.

@hamishwillee hamishwillee left a comment

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.

@julianoes FWIW the problem here isn't that this doesn't implement this param, it's that we don't support it and we don't fail the upload with MAV_MISSION_INVALID_PARAM1.

But anyhow, would appeciate your thoughts on #27483

EDIT - because it would be nice to also reject a non-NAN param3, or any values of PRECISION_LAND_MODE that we don't support.

@julianoes

Copy link
Copy Markdown
Contributor

Yes, we should fail the upload, I agree there.

Comment thread src/modules/mavlink/mavlink_mission.cpp Outdated
@anoshyn

anoshyn commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

I’ll keep unsupported-param rejection as a follow-up. This PR now only preserves and uses NAV_LAND param1 for the abort altitude, with a named land_abort_min_alt alias and a finite-value guard before consuming it.

Rejecting unsupported NAV_LAND params like non-NaN param3 or unsupported precision-land modes is the right direction, but it is broader mission-upload validation work and fits better under #27483

@julianoes

Copy link
Copy Markdown
Contributor

Looks good. Any objections before I merge?

@hamishwillee

Copy link
Copy Markdown
Contributor

Looks great to me (assuming latest version tested). We should update #27541 to note the change so that it doesn't get rejected.

@dakejahl
dakejahl merged commit ca39d83 into PX4:main Jun 3, 2026
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug Something is broken or behaving incorrectly. risk:safety-critical May affect arming, failsafe, control, navigation, or flight safety. scope:mavlink MAVLink module, streams, commands, or protocol handling. scope:navigation Missions, RTL, geofence, takeoff, landing, or navigator behavior. scope:parameters Parameter definitions, metadata, migration, or defaults.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MAV_CMD_NAV_LAND mission item silently ignores the abort-altitude parameter (param1)

6 participants