Save routes refactor - #82
Merged
Merged
Conversation
Signed-off-by: Francisco Martín Rico <fmrico@gmail.com>
Contributor
There was a problem hiding this comment.
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’ssave_routesservice with a newsave_routes_to_yaml()helper. - Add
save_routes_to_yaml()implementation toroute_ioutilities and document it in the public header. - Extend
RoutesMapsManagertests with a live-update cycle test that exercises the realRoutesCostmapFilterplugin, 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
Refactor of saving routes when receiving an update.
Best