Skip to content

cross navigator preemption#6018

Open
avanmalleghem wants to merge 9 commits intoros-navigation:mainfrom
avanmalleghem:fix/cross-navigator-preemption
Open

cross navigator preemption#6018
avanmalleghem wants to merge 9 commits intoros-navigation:mainfrom
avanmalleghem:fix/cross-navigator-preemption

Conversation

@avanmalleghem
Copy link

@avanmalleghem avanmalleghem commented Mar 8, 2026


Basic Info

Info Please fill out this column
Ticket(s) this addresses #5886
Primary OS tested on Ubuntu
Robotic platform tested on /
Does this PR contain AI generated software? Claude code was used as a peer reviewer
Was this PR description generated by AI software? No

Description of contribution in a few bullet points

  • allow_navigator_preemption parameter allows you to start another navigator while another one is running. It will cancel the first one, wait until it is cancelled and then start the new one. Parameter set to false by default so that you keep the current behavior (reject).
  • Had to add a flag for internal cancel request (when inside the server you want to cancel the goal). internal_cancel_requested_
  • had to swap NavigatorBase and Mutex classes order to create getCurrentNavigator
  • In the muxer, current_navigator_ is now a navigator type and not only a string containing its name.

Description of documentation updates required from your changes

  • allow_navigator_preemption parameter added
bt_navigator:
  ros__parameters:
    allow_navigator_preemption: true

Description of how this change was tested

  • Tested it in simulation (using "navigate_to_pose" and "navigate_through_poses" navigators)

Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
  • Should this be backported to current distributions? If so, tag with backport-*.

When a new navigation goal arrives while a different navigator is
already running, stop the current navigator and wait for it to fully
complete before accepting the new goal, instead of rejecting it.

Signed-off-by: avanmalleghem <antoine.vanmalleghem@botronics.be>
Signed-off-by: avanmalleghem <antoine.vanmalleghem@botronics.be>
@avanmalleghem avanmalleghem force-pushed the fix/cross-navigator-preemption branch from 5bedd2a to 19c79b1 Compare March 8, 2026 19:35
@avanmalleghem avanmalleghem changed the title Fix/cross navigator preemption cross navigator preemption Mar 8, 2026
@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 15 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...core/include/nav2_core/behavior_tree_navigator.hpp 48.27% 15 Missing ⚠️
Files with missing lines Coverage Δ
...ee/include/nav2_behavior_tree/bt_action_server.hpp 83.33% <ø> (ø)
...clude/nav2_behavior_tree/bt_action_server_impl.hpp 89.04% <100.00%> (-1.43%) ⬇️
...core/include/nav2_core/behavior_tree_navigator.hpp 73.97% <48.27%> (-15.32%) ⬇️

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SteveMacenski
Copy link
Member

@avanmalleghem do you want me to review?

@avanmalleghem
Copy link
Author

@SteveMacenski not yet, would like to go deeper in testing before :) I keep you in touch

@avanmalleghem
Copy link
Author

parameter.to.true.webm

@SteveMacenski a small video of the expected result :) This PR can be reviewed now... I made a lot of tests in simulation but don't see how I could integrate UT without refactoring code.

@avanmalleghem avanmalleghem marked this pull request as ready for review March 15, 2026 20:23
Signed-off-by: avanmalleghem <antoine.vanmalleghem@botronics.be>
avanmalleghem and others added 5 commits March 18, 2026 14:33
Co-authored-by: Steve Macenski <stevenmacenski@gmail.com>
Signed-off-by: Antoine Van Malleghem <a.vanmalleghem@gmail.com>
…when starting executing instead of after

Signed-off-by: avanmalleghem <antoine.vanmalleghem@botronics.be>
Signed-off-by: avanmalleghem <antoine.vanmalleghem@botronics.be>
Signed-off-by: avanmalleghem <antoine.vanmalleghem@botronics.be>
Signed-off-by: avanmalleghem <antoine.vanmalleghem@botronics.be>
Signed-off-by: avanmalleghem <antoine.vanmalleghem@botronics.be>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants