Skip to content

Use the new declare_or_get_parameter API for nav2_costmap_2d #5867

Merged
SteveMacenski merged 6 commits intoros-navigation:mainfrom
mini-1235:feat/costmap_parameters
Jan 16, 2026
Merged

Use the new declare_or_get_parameter API for nav2_costmap_2d #5867
SteveMacenski merged 6 commits intoros-navigation:mainfrom
mini-1235:feat/costmap_parameters

Conversation

@mini-1235
Copy link
Collaborator


Basic Info

Info Please fill out this column
Ticket(s) this addresses Supersedes #5659 Partially fixes ##5299
Primary OS tested on (Ubuntu, MacOS, Windows)
Robotic platform tested on (Steve's Robot, gazebo simulation of Tally, hardware turtlebot)
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

Description of documentation updates required from your changes

Description of how this change was tested


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

Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
node->get_parameter("inscribed_obstacle_cost_value", inscribed_obstacle_cost_value_);
node->get_parameter("unknown_cost_value", unknown_cost_value_);
node->get_parameter("trinary_costmap", trinary_costmap_);
use_maximum_ = node->declare_or_get_parameter(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am moving a few parameters from costmap2dros to the static layer, since that's the only place they are actually used, do you agree with me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep them global - seems silly to make people migrate these parameters if we don't have to.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ Something like this could possibly cause other packages' tests to fail if the config files weren't updated respectively. I think its best to leave this alone.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will revert

@mini-1235
Copy link
Collaborator Author

Wow, I didn't realize that a lot of tests are failing in other packages. I'll take a look

Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
@mini-1235
Copy link
Collaborator Author

The test updates are mostly due to moving declare_parameter from the constructor to on_configure

I can also spend ~10 mins updating stvl + npvl tomorrow

@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
nav2_costmap_2d/include/nav2_costmap_2d/layer.hpp 100.00% <ø> (ø)
...stmap_2d/plugins/costmap_filters/binary_filter.cpp 94.52% <100.00%> (-0.15%) ⬇️
...tmap_2d/plugins/costmap_filters/costmap_filter.cpp 87.69% <100.00%> (-0.37%) ⬇️
...tmap_2d/plugins/costmap_filters/keepout_filter.cpp 77.69% <100.00%> (-0.16%) ⬇️
...ostmap_2d/plugins/costmap_filters/speed_filter.cpp 95.12% <100.00%> (ø)
nav2_costmap_2d/plugins/denoise_layer.cpp 95.77% <100.00%> (-0.33%) ⬇️
nav2_costmap_2d/plugins/inflation_layer.cpp 88.11% <100.00%> (-11.40%) ⬇️
nav2_costmap_2d/plugins/obstacle_layer.cpp 79.93% <100.00%> (-1.74%) ⬇️
nav2_costmap_2d/plugins/plugin_container_layer.cpp 85.18% <100.00%> (-13.70%) ⬇️
nav2_costmap_2d/plugins/range_sensor_layer.cpp 78.36% <100.00%> (-0.51%) ⬇️
... and 4 more

... and 12 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

Thanks - I wish STVL was under better licensing so I could just pull it into Nav2 -_-

But, I don't have control over that - that was my ex-company's choice

@mini-1235
Copy link
Collaborator Author

STVL: SteveMacenski/spatio_temporal_voxel_layer#350

For NPVL: I don't really see the declare or get pattern there, so I didn't update it

@SteveMacenski SteveMacenski merged commit e819126 into ros-navigation:main Jan 16, 2026
17 checks passed
Pana1v pushed a commit to Arnav-panjla/navigation2 that referenced this pull request Feb 21, 2026
…igation#5867)

* Use new api for nav2_costmap_2d

Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>

* Self review

Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>

* Update tests

Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>

* Revert static layer parameters

Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>

* Reorder

Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>

---------

Signed-off-by: mini-1235 <mauricepurnawan@gmail.com>
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