Skip to content

Catch parameter changes done in INACTIVE#6194

Draft
doisyg wants to merge 3 commits into
ros-navigation:mainfrom
botsandus:catch_parameter_changes_in_inactive
Draft

Catch parameter changes done in INACTIVE#6194
doisyg wants to merge 3 commits into
ros-navigation:mainfrom
botsandus:catch_parameter_changes_in_inactive

Conversation

@doisyg

@doisyg doisyg commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Basic Info

Info Please fill out this column
Ticket(s) this addresses (add tickets here #1)
Primary OS tested on Ubuntu
Robotic platform tested on Dexory Robot
Does this PR contain AI generated software? (No; Yes and it is marked inline in the code)
Was this PR description generated by AI software? Out of respect for maintainers, AI for human-to-human communications are banned

Description of contribution in a few bullet points

Many Nav2 lifecycle nodes register the on-set parameter callback only in activate()/on_activate(). As a result, any set_parameters call made while a node is INACTIVE updates the parameter store but leaves the cached members stale The value isn't picked up until that same parameter is set again after the node is active. Symptom: ros2 param get reports the new value while the node keeps running on the old one.

Fix

After re-registering the callbacks on activation, replay the current parameter store through the node's existing updateParametersCallback to resync the cache. Declared but uninitialized parameters (PARAMETER_NOT_SET) are skipped, since a bulk get on those throws ParameterUninitializedException.

Description of documentation updates required from your changes

Description of how this change was tested

I first made the change to nav2_util/parameter_handler and velocity_smoother.cpp for the behavior I needed to fix. And I extensively tested these on a real robot running continuously for the last weeks.

Then I did the same for the other nodes that could be affected. And for these last ones, I did not test as extensively, so a proper second pair of eyes (and a CI run) would be appreciated.


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-*.

@doisyg
doisyg force-pushed the catch_parameter_changes_in_inactive branch from aeb7bbd to c27a4b1 Compare June 4, 2026 07:00
Comment thread nav2_amcl/src/amcl_node.cpp Outdated
@doisyg
doisyg force-pushed the catch_parameter_changes_in_inactive branch from c27a4b1 to f3a94eb Compare June 4, 2026 10:12
@SteveMacenski

Copy link
Copy Markdown
Member

This seems to cause a test to fail now:

/opt/overlay_ws/src/navigation2/nav2_graceful_controller/test/test_graceful_controller.cpp:232
Expected equality of these values:
  controller->getAllowBackward()
    Which is: true
  false

/opt/overlay_ws/src/navigation2/nav2_graceful_controller/test/test_graceful_controller.cpp:232
Expected equality of these values:
  controller->getAllowBackward()
    Which is: true
  false

@SteveMacenski

Copy link
Copy Markdown
Member

Also, does this cover all of the potential cases? Maybe I'm mistaken, but it seems to me that there are many more nodes that this may need to be added to? Maybe this should be a nav2_ros_common node utility so its more abstracted so its not so much copy/pasted boilerplate.

@doisyg
doisyg marked this pull request as draft June 4, 2026 22:31
@doisyg

doisyg commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

This seems to cause a test to fail now:

/opt/overlay_ws/src/navigation2/nav2_graceful_controller/test/test_graceful_controller.cpp:232
Expected equality of these values:
  controller->getAllowBackward()
    Which is: true
  false

/opt/overlay_ws/src/navigation2/nav2_graceful_controller/test/test_graceful_controller.cpp:232
Expected equality of these values:
  controller->getAllowBackward()
    Which is: true
  false

Let's see with the latest commit.

Also, does this cover all of the potential cases? Maybe I'm mistaken, but it seems to me that there are many more nodes that this may need to be added to? Maybe this should be a nav2_ros_common node utility so its more abstracted so its not so much copy/pasted boilerplate.

Switching to draft to think more about it and review the code base. I agree that if it is needed in more place, this probably need a utility / refactor.

@SteveMacenski

Copy link
Copy Markdown
Member

Sounds good!

That now passes

@doisyg

doisyg commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Turns out it is a bit of a can of worms, I will have to go case by case.
Leaving in draft and will push some experiments and ping you when ready again to take a look.

Guillaume Doisy added 3 commits June 5, 2026 16:50
Signed-off-by: Guillaume Doisy <guillaume@dexory.com>
Signed-off-by: Guillaume Doisy <guillaume@dexory.com>
Signed-off-by: Guillaume Doisy <guillaume@dexory.com>
@doisyg
doisyg force-pushed the catch_parameter_changes_in_inactive branch from 7fa4367 to 0a89a0d Compare June 5, 2026 15:52
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