Skip to content

Navigator/FW mode manager: fix handling of counter-clockwise loiter #25265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented Jul 22, 2025

Solved Problem

When NAV_LOITER_RAD is negative, the direction is counter-clockwise. This was not always properly handled and not reflected in the parameter description.

Solution

  • refactor: renaming of get_loiter_radius() to get_default_loiter_radius()
  • In Navigator: cleanly extract direction from parameter and pass it through PositionSetpoint.msg (has separate fields for radius and direction).
  • In FWFlightModeManager: handle negative values of NAV_LOITER_RAD correctly (in the case where the PositionSetpoint loiter_radius is not filled)
  • Fix param description of NAV_LOITER_RAD, make the limits symmetric and open them up to 10km (why not, 1km is rather preventive for some usecases)

Changelog Entry

For release notes:

Bugfix: Navigator/FW mode manager: fix handling of counter-clockwise loiter

Test coverage

Simulation tested.

Copy link

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 256 byte (0.01 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +256  +0.0%    +256    .text
  +2.0%     +68  +2.0%     +68    Navigator::run()
  +6.6%     +36  +6.6%     +36    FixedWingModeManager::control_auto_loiter()
  +2.7%     +32  +2.7%     +32    FixedWingModeManager::control_auto_landing_circular()
 -99.1%     +20 -99.1%     +20    [7 Others]
  +0.0%     +20  +0.0%     +20    g_cromfs_image
  +2.0%      +8  +2.0%      +8    MissionBase::do_abort_landing()
   +15%      +8   +15%      +8    MissionBlock::setLoiterItemFromCurrentPositionWithBraking()
  +8.3%      +8  +8.3%      +8    MissionBlock::set_idle_item()
  +5.1%      +8  +5.1%      +8    MissionBlock::set_land_item()
  +0.8%      +8  +0.8%      +8    Navigator::geofence_breach_check()
  +6.2%      +8  +6.2%      +8    Navigator::reset_position_setpoint()
  +1.2%      +8  +1.2%      +8    RtlDirectMissionLand::setActiveMissionItems()
  +1.4%      +8  +1.4%      +8    Takeoff::on_active()
  +4.8%      +4  +4.8%      +4    FlightTask
  +3.8%      +4  +3.8%      +4    Mission::handleVtolTransition()
  +1.0%      +4  +1.0%      +4    MissionBase::handleLanding()
  +1.8%      +4  +1.8%      +4    MissionBase::isLanding()
  +5.6%      +4  +5.6%      +4    MissionBlock::initialize()
  +0.2%      +4  +0.2%      +4    MissionBlock::is_mission_item_reached_or_completed()
  -0.6%      -4  -0.6%      -4    FixedWingModeManager::vehicle_attitude_poll()
  -1.4%      -4  -1.4%      -4    MissionBase::setMissionToClosestItem()
+0.0%     +54  [ = ]       0    .debug_abbrev
+0.0%      +8  [ = ]       0    .debug_frame
+0.0%    +188  [ = ]       0    .debug_info
+0.0%    +526  [ = ]       0    .debug_line
 -25.0%      -1  [ = ]       0    [Unmapped]
  +0.0%    +527  [ = ]       0    [section .debug_line]
+0.0%    +138  [ = ]       0    .debug_loclists
+0.0%    +162  [ = ]       0    .debug_rnglists
   +50%      +1  [ = ]       0    [Unmapped]
  +0.0%    +161  [ = ]       0    [section .debug_rnglists]
+0.0%    +108  [ = ]       0    .debug_str
 +47% +3.75Ki  [ = ]       0    [Unmapped]
+0.0% +5.16Ki  +0.0%    +256    TOTAL

px4_fmu-v6x [Total VM Diff: 264 byte (0.01 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +264  +0.0%    +264    .text
  +2.0%     +68  +2.0%     +68    Navigator::run()
  +6.6%     +36  +6.6%     +36    FixedWingModeManager::control_auto_loiter()
  +2.7%     +32  +2.7%     +32    FixedWingModeManager::control_auto_landing_circular()
  +0.0%     +32  +0.0%     +32    g_cromfs_image
 -99.4%     +12 -99.4%     +12    [7 Others]
  +2.0%      +8  +2.0%      +8    MissionBase::do_abort_landing()
   +15%      +8   +15%      +8    MissionBlock::setLoiterItemFromCurrentPositionWithBraking()
  +8.3%      +8  +8.3%      +8    MissionBlock::set_idle_item()
  +5.1%      +8  +5.1%      +8    MissionBlock::set_land_item()
  +0.8%      +8  +0.8%      +8    Navigator::geofence_breach_check()
  +6.2%      +8  +6.2%      +8    Navigator::reset_position_setpoint()
  +1.2%      +8  +1.2%      +8    RtlDirectMissionLand::setActiveMissionItems()
  +1.4%      +8  +1.4%      +8    Takeoff::on_active()
  +0.0%      +8  +0.0%      +8    [section .text]
  +3.8%      +4  +3.8%      +4    Mission::handleVtolTransition()
  +1.0%      +4  +1.0%      +4    MissionBase::handleLanding()
  +1.8%      +4  +1.8%      +4    MissionBase::isLanding()
  +5.6%      +4  +5.6%      +4    MissionBlock::initialize()
  +0.2%      +4  +0.2%      +4    MissionBlock::is_mission_item_reached_or_completed()
  -0.6%      -4  -0.6%      -4    FixedWingModeManager::vehicle_attitude_poll()
  -1.4%      -4  -1.4%      -4    MissionBase::setMissionToClosestItem()
+0.0%     +54  [ = ]       0    .debug_abbrev
+0.0%      +8  [ = ]       0    .debug_frame
+0.0%    +188  [ = ]       0    .debug_info
+0.0%    +534  [ = ]       0    .debug_line
  [NEW]      +7  [ = ]       0    [Unmapped]
  +0.0%    +527  [ = ]       0    [section .debug_line]
+0.0%     +80  [ = ]       0    .debug_loclists
+0.0%    +160  [ = ]       0    .debug_rnglists
 -50.0%      -1  [ = ]       0    [Unmapped]
  +0.0%    +161  [ = ]       0    [section .debug_rnglists]
+0.0%    +108  [ = ]       0    .debug_str
-3.4%    -264  [ = ]       0    [Unmapped]
+0.0% +1.11Ki  +0.0%    +264    TOTAL

Updated: 2025-07-22T11:39:11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants