Skip to content

Fix routes#65

Open
fmrico wants to merge 6 commits intorollingfrom
fix_routes
Open

Fix routes#65
fmrico wants to merge 6 commits intorollingfrom
fix_routes

Conversation

@fmrico
Copy link
Copy Markdown
Contributor

@fmrico fmrico commented May 3, 2026

Hi,

This PR contains two changes:

  1. There was a bug in the A* algorithm for costmap which made the path be calculated without taking into account high-cost cells. This had impact, for example, when using the routes maps manager. Now it is fixed.
  2. While filtering the costmaps, tehre were arbitrary navstate keys. Now the input key is "map", and the output key is also "map", making effective ad simple the chain of different filters on the map.
  • Tests are updated
  • Docs in the repos have been updated.

I hope it helps.

fmrico added 2 commits May 3, 2026 09:51
Signed-off-by: Francisco Martín Rico <fmrico@gmail.com>
Signed-off-by: Francisco Martín Rico <fmrico@gmail.com>
Copilot AI review requested due to automatic review settings May 3, 2026 08:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes NavState map key usage across the navigation stack and adjusts the CostmapPlanner A* traversal cost so high-cost cells influence route selection as intended.

Changes:

  • Rename NavState keys to use map for the dynamic/working map and map.base for the base/static map (plus map.obstacle_bounds for incremental inflation).
  • Update planners, localizers, map managers, filters, and tests/docs to match the new key convention.
  • Modify CostmapPlanner A* traversal cost to apply cost_factor directly to raw costmap cell costs.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
planners/easynav_simple_planner/src/easynav_simple_planner/SimplePlanner.cpp Switches planner input key from map.dynamic to map.
planners/easynav_simple_planner/README.md Updates documented NavState key from map.dynamic to map.
planners/easynav_costmap_planner/src/easynav_costmap_planner/CostmapPlanner.cpp Uses map key and changes A* traversal cost calculation.
planners/easynav_costmap_planner/README.md Updates documented NavState key to map.
maps_managers/easynav_simple_maps_manager/tests/simple_mapsmanager_tests.cpp Updates tests to assert map / map.base keys.
maps_managers/easynav_simple_maps_manager/src/easynav_simple_maps_manager/SimpleMapsManager.cpp Writes map and map.base instead of map.dynamic / map.static.
maps_managers/easynav_simple_maps_manager/README.md Documents map / map.base outputs.
maps_managers/easynav_routes_maps_manager/tests/routes_costmap_filter_tests.cpp Updates tests to use map for filter input/output.
maps_managers/easynav_routes_maps_manager/src/easynav_routes_maps_manager/filters/RoutesCostmapFilter.cpp Reads/modifies costmap under map key.
maps_managers/easynav_routes_maps_manager/include/easynav_routes_maps_manager/filters/RoutesCostmapFilter.hpp Updates header docs to reference map.
maps_managers/easynav_routes_maps_manager/README.md Documents map as the costmap key for the routes filter.
maps_managers/easynav_navmap_maps_manager/tests/navmap_mapsmanager_tests.cpp Updates commented test examples to map / map.base.
maps_managers/easynav_costmap_maps_manager/tests/costmap_mapsmanager_tests.cpp Updates tests to use map key for the dynamic costmap.
maps_managers/easynav_costmap_maps_manager/src/easynav_costmap_maps_manager/filters/ObstacleFilter.cpp Switches dynamic costmap pointer key to map; obstacle bounds key to map.obstacle_bounds.
maps_managers/easynav_costmap_maps_manager/src/easynav_costmap_maps_manager/filters/InflationFilter.cpp Switches dynamic costmap pointer key to map; reads bounds from map.obstacle_bounds; writes back to map.
maps_managers/easynav_costmap_maps_manager/src/easynav_costmap_maps_manager/CostmapMapsManager.cpp Writes dynamic costmap under unified map key before/after filters.
maps_managers/easynav_costmap_maps_manager/README.md Documents new keys (map, map.obstacle_bounds) in filter/manager tables.
localizers/easynav_simple_localizer/src/easynav_simple_localizer/AMCLLocalizer.cpp Switches static map key from map.static to map.base.
localizers/easynav_simple_localizer/README.md Updates documented static map key to map.base.
controllers/easynav_serest_controller/src/easynav_serest_controller/SerestController.cpp Updates required-input check to use map key.
Comments suppressed due to low confidence (1)

maps_managers/easynav_costmap_maps_manager/src/easynav_costmap_maps_manager/filters/InflationFilter.cpp:106

  • dynamic_map_ptr is dereferenced without checking for null. If NavState doesn't contain a map entry (or it isn't stored as a pointer), this will crash. Add a guard (and consider also guarding access to map.base) before dereferencing/reading.
  auto dynamic_map_ptr = nav_state.get_ptr<Costmap2D>("map");
  Costmap2D & dynamic_map = *dynamic_map_ptr;

  const auto & base_map = nav_state.get<Costmap2D>("map.base");


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread maps_managers/easynav_costmap_maps_manager/README.md Outdated
}

nav_state.set("map.dynamic", dynamic_map_);
nav_state.set("map", dynamic_map_);
if (!nav_state.has("map.static")) {
RCLCPP_WARN(get_node()->get_logger(), "There is yet no a map.static map");
if (!nav_state.has("map.base")) {
RCLCPP_WARN(get_node()->get_logger(), "There is yet no a map.base map");
Comment on lines +116 to 127
if (!nav_state.has("map")) {
RCLCPP_WARN(get_node()->get_logger(), "SimplePlanner::update map map not found");
return;
}

SimpleMap map_typed;
if (nav_state.has("map.dynamic")) {
map_typed = nav_state.get<SimpleMap>("map.dynamic");
if (nav_state.has("map")) {
map_typed = nav_state.get<SimpleMap>("map");
} else {
RCLCPP_WARN(get_node()->get_logger(), "There is yet no a map.dynamic map");
RCLCPP_WARN(get_node()->get_logger(), "There is yet no a map");
return;
}
map_typed = nav_state.get<SimpleMap>("map");
} else {
RCLCPP_WARN(get_node()->get_logger(), "There is yet no a map.dynamic map");
RCLCPP_WARN(get_node()->get_logger(), "There is yet no a map");
Comment on lines 96 to 101
| Key | Type | Access | Notes |
|---|---|---|---|
| `goals` | `nav_msgs::msg::Goals` | **Read** | Goal list used as planner targets. |
| `map.dynamic` | `Costmap2D` | **Read** | Dynamic costmap used for A* search. |
| `map` | `Costmap2D` | **Read** | Dynamic costmap used for A* search. |
| `robot_pose` | `nav_msgs::msg::Odometry` | **Read** | Current robot pose used as the start position. |
| `path` | `nav_msgs::msg::Path` | **Write** | Output path to follow. |
fmrico and others added 4 commits May 4, 2026 11:24
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Francisco Martín Rico <fmrico@gmail.com>
Signed-off-by: Francisco Martín Rico <fmrico@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