Skip to content

Save routes refactor - #82

Merged
fmrico merged 2 commits into
rollingfrom
save_routes
Aug 16, 2026
Merged

Save routes refactor#82
fmrico merged 2 commits into
rollingfrom
save_routes

Conversation

@fmrico

@fmrico fmrico commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Hi,

Refactor of saving routes when receiving an update.

Best

Signed-off-by: Francisco Martín Rico <fmrico@gmail.com>
Copilot AI lite review requested due to automatic review settings August 16, 2026 09:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the route-saving implementation in easynav_routes_maps_manager by extracting YAML persistence into a reusable free function, and adds a regression-style test scenario to validate live route edits propagate through the routes costmap filter across update cycles.

Changes:

  • Replace inline YAML emission in RoutesMapsManager’s save_routes service with a new save_routes_to_yaml() helper.
  • Add save_routes_to_yaml() implementation to route_io utilities and document it in the public header.
  • Extend RoutesMapsManager tests with a live-update cycle test that exercises the real RoutesCostmapFilter plugin, plus link the needed costmap library.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
maps_managers/easynav_routes_maps_manager/tests/routes_mapsmanager_tests.cpp Adds a regression test that simulates live incoming route edits and verifies the costmap filter reflects changes across cycles.
maps_managers/easynav_routes_maps_manager/tests/CMakeLists.txt Links costmap common library needed by the new manager test.
maps_managers/easynav_routes_maps_manager/src/easynav_routes_maps_manager/RoutesMapsManager.cpp Refactors save_routes service to delegate YAML persistence to save_routes_to_yaml().
maps_managers/easynav_routes_maps_manager/src/easynav_routes_maps_manager/route_io.cpp Implements save_routes_to_yaml() for writing routes in the same schema as the loader.
maps_managers/easynav_routes_maps_manager/include/easynav_routes_maps_manager/route_io.hpp Declares and documents the new save_routes_to_yaml() helper.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +206 to +216
out << YAML::EndMap;

std::ofstream file(yaml_file);
if (!file.is_open()) {
error_message = "Could not open file for writing: " + yaml_file;
return false;
}
file << out.c_str();
file.close();

return true;
Comment on lines +375 to +377
publish_single_route(0.0, 2.0);
ASSERT_DOUBLE_EQ(manager->get_routes()[0].start.position.x, 0.0);

Signed-off-by: Francisco Martín Rico <fmrico@gmail.com>
@fmrico
fmrico merged commit c5bcc5e into rolling Aug 16, 2026
1 check passed
@fmrico
fmrico deleted the save_routes branch August 16, 2026 11:10
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