-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Route Tool Rviz Panel #4775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SteveMacenski
merged 53 commits into
ros-navigation:nav2_route_server
from
usdot-fhwa-stol:route-server-develop
Apr 14, 2025
Merged
Route Tool Rviz Panel #4775
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
e294afa
added route tool skeleton code and gui
john-chrosniak c4b7334
rviz2 panel can load route graph
john-chrosniak 3fabaf2
can add nodes using route tool
john-chrosniak 81ad975
added logic for creating edges
john-chrosniak b0fa2aa
graph nodes can be edited, existing edges will still connect if a nod…
john-chrosniak e39920f
can edit edges
john-chrosniak 10123cc
can delete nodes and edges
john-chrosniak ec6e1e4
route graphs can be saved
john-chrosniak f4dbe7d
fixed bug for loading in route graphs
john-chrosniak 4b66723
added dynamic text to UI, created launch file and rviz configuration
john-chrosniak b3c41f5
fixed bug for deleting nodes
john-chrosniak 88e680c
actually fixed node removal bug
john-chrosniak bc544a2
publishing clicked point populates x and y fields
john-chrosniak 6aede5e
removed debugging log statements
john-chrosniak 00328b5
added check to make sure node/edges exist before editing
john-chrosniak 859f128
bug fix
john-chrosniak 73450a2
migrated route tool to rviz plugin
john-chrosniak 34deb61
minor refactoring
john-chrosniak 7e92d8b
added metadata and operations to graph saver so nothing should be erased
john-chrosniak ec3163c
edited set route service to clear current route before setting new
john-chrosniak ebf5c30
Update README.md
SaikrishnaBairamoni 2dee68b
addressed comments
john-chrosniak 166b800
documentation cleanup
john-chrosniak 2098109
changed copyright
john-chrosniak 0291f9a
addressed comments
john-chrosniak a1c3fa1
moved copyright due to compiler error
john-chrosniak 9ae6180
revert removal of files
john-chrosniak b172a57
added gen ai comment
john-chrosniak c8c0d4f
fixed rebasing issue
john-chrosniak ac16c1b
fix linting errors
john-chrosniak 96b4276
added export for graph saver dependencies
john-chrosniak 036adc7
added ui file to library
john-chrosniak 1027df0
added nav2_route_core to link libaries
john-chrosniak 29c986f
fixed cmake error
john-chrosniak b146543
fixed build issues
john-chrosniak 1eaa4cd
uncrustified
john-chrosniak 0e60ccb
cpplint
john-chrosniak 300d7f1
added unit tests and fixed bugs
john-chrosniak d50f17e
increased test coverage
john-chrosniak f31a92e
fixed linter errors
john-chrosniak 3d82b64
fixed pre-commit errors
john-chrosniak a28c976
fixed formatting error
john-chrosniak 911c361
double -> single quotes
john-chrosniak 462f1e7
added test for using default filepath
john-chrosniak a33d1c3
fixed license
john-chrosniak f630c34
addressed comments
john-chrosniak 93e3319
Update nav2_route/include/nav2_route/graph_saver.hpp
john-chrosniak 88f2dbe
Update nav2_route/src/plugins/graph_file_savers/geojson_graph_file_sa…
john-chrosniak d660772
Update nav2_route/src/plugins/graph_file_savers/geojson_graph_file_sa…
john-chrosniak a04e42d
Update nav2_route/src/plugins/graph_file_savers/geojson_graph_file_sa…
john-chrosniak f51f3d8
Update nav2_route/src/plugins/graph_file_savers/geojson_graph_file_sa…
john-chrosniak e341c31
linter fix
john-chrosniak 2f30737
Merge branch 'route-server-develop' of github.com:usdot-fhwa-stol/nav…
john-chrosniak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| // Copyright (c) 2024 John Chrosniak | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #ifndef NAV2_ROUTE__GRAPH_SAVER_HPP_ | ||
| #define NAV2_ROUTE__GRAPH_SAVER_HPP_ | ||
|
|
||
| #include <string> | ||
| #include <memory> | ||
| #include <vector> | ||
| #include <unordered_map> | ||
| #include <nlohmann/json.hpp> | ||
| #include <pluginlib/class_loader.hpp> | ||
|
|
||
| #include "nav2_util/lifecycle_node.hpp" | ||
| #include "tf2_ros/buffer.h" | ||
| #include "tf2_ros/transform_listener.h" | ||
| #include "nav2_util/node_utils.hpp" | ||
| #include "nav2_util/robot_utils.hpp" | ||
| #include "nav2_route/types.hpp" | ||
| #include "nav2_route/interfaces/graph_file_saver.hpp" | ||
| #include "rclcpp/node_interfaces/node_parameters_interface.hpp" | ||
|
|
||
| namespace nav2_route | ||
| { | ||
|
|
||
| /** | ||
| * @class nav2_route::GraphSaver | ||
| * @brief An object to save graph objects to a file | ||
| */ | ||
| class GraphSaver | ||
| { | ||
| public: | ||
| /** | ||
| * @brief A constructor for nav2_route::GraphSaver | ||
| * @param node Lifecycle node encapsulated by the GraphSaver | ||
| * @param tf A tf buffer | ||
| * @param frame Coordinate frame that the graph belongs to | ||
| */ | ||
| explicit GraphSaver( | ||
| nav2_util::LifecycleNode::SharedPtr node, | ||
| std::shared_ptr<tf2_ros::Buffer> tf, | ||
| const std::string frame); | ||
|
|
||
| /** | ||
| * @brief A destructor for nav2_route::GraphSaver | ||
| */ | ||
| ~GraphSaver() = default; | ||
|
|
||
| /** | ||
| * @brief Saves a graph object to a file | ||
| * @param graph Graph to save | ||
| * @param filepath The filepath to the graph data | ||
| * @return bool If successful | ||
| */ | ||
| bool saveGraphToFile( | ||
| Graph & graph, | ||
| std::string filepath = ""); | ||
|
|
||
| /** | ||
| * @brief Transform the coordinates in the graph to the route frame | ||
| * @param[in/out] graph The graph to be transformed | ||
| * @return True if transformation was successful | ||
| */ | ||
| bool transformGraph(Graph & graph); | ||
|
|
||
| protected: | ||
| std::string route_frame_, graph_filepath_; | ||
| std::shared_ptr<tf2_ros::Buffer> tf_; | ||
| rclcpp::Logger logger_{rclcpp::get_logger("GraphSaver")}; | ||
|
|
||
| // Graph Parser | ||
| pluginlib::ClassLoader<GraphFileSaver> plugin_loader_; | ||
| GraphFileSaver::Ptr graph_file_saver_; | ||
| std::string default_plugin_id_; | ||
| std::string plugin_type_; | ||
| }; | ||
|
|
||
| } // namespace nav2_route | ||
|
|
||
| #endif // NAV2_ROUTE__GRAPH_SAVER_HPP_ | ||
67 changes: 67 additions & 0 deletions
67
nav2_route/include/nav2_route/interfaces/graph_file_saver.hpp
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Copyright (c) 2024 John Chrosniak | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #ifndef NAV2_ROUTE__INTERFACES__GRAPH_FILE_SAVER_HPP_ | ||
| #define NAV2_ROUTE__INTERFACES__GRAPH_FILE_SAVER_HPP_ | ||
|
|
||
| #include <string> | ||
| #include <memory> | ||
|
|
||
|
|
||
| #include "rclcpp/rclcpp.hpp" | ||
| #include "rclcpp_lifecycle/lifecycle_node.hpp" | ||
| #include "nav2_route/types.hpp" | ||
|
|
||
| namespace nav2_route | ||
| { | ||
|
|
||
| /** | ||
| * @class GraphFileSaver | ||
| * @brief A plugin interface to parse a file into the graph | ||
| */ | ||
| class GraphFileSaver | ||
| { | ||
| public: | ||
| using Ptr = std::shared_ptr<GraphFileSaver>; | ||
|
|
||
| /** | ||
| * @brief Constructor | ||
| */ | ||
| GraphFileSaver() = default; | ||
|
|
||
| /** | ||
| * @brief Virtual destructor | ||
| */ | ||
| virtual ~GraphFileSaver() = default; | ||
|
|
||
| /** | ||
| * @brief Configure the graph file saver, but do not store the node | ||
| * @param parent pointer to user's node | ||
| */ | ||
| virtual void configure( | ||
| const rclcpp_lifecycle::LifecycleNode::SharedPtr node) = 0; | ||
|
|
||
| /** | ||
| * @brief Method to save the graph to the filepath | ||
| * @param graph The graph to save | ||
| * @param filepath The path to save the file to | ||
| * @return true if graph was successfully saved | ||
| */ | ||
| virtual bool saveGraphToFile( | ||
| Graph & graph, | ||
| std::string filepath) = 0; | ||
| }; | ||
| } // namespace nav2_route | ||
|
|
||
| #endif // NAV2_ROUTE__INTERFACES__GRAPH_FILE_SAVER_HPP_ |
99 changes: 99 additions & 0 deletions
99
nav2_route/include/nav2_route/plugins/graph_file_savers/geojson_graph_file_saver.hpp
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| // Copyright (c) 2024 John Chrosniak | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #include <memory> | ||
| #include <string> | ||
| #include <vector> | ||
| #include <nlohmann/json.hpp> | ||
|
|
||
| #include "nav2_core/route_exceptions.hpp" | ||
| #include "nav2_route/interfaces/graph_file_saver.hpp" | ||
| #include "nav2_route/plugins/graph_file_loaders/geojson_graph_file_loader.hpp" | ||
|
|
||
| #ifndef NAV2_ROUTE__PLUGINS__GRAPH_FILE_SAVERS__GEOJSON_GRAPH_FILE_SAVER_HPP_ | ||
| #define NAV2_ROUTE__PLUGINS__GRAPH_FILE_SAVERS__GEOJSON_GRAPH_FILE_SAVER_HPP_ | ||
|
|
||
| namespace nav2_route | ||
| { | ||
|
|
||
| /** | ||
| * @class nav2_route::GeoJsonGraphFileSaver | ||
| * @brief A GraphFileSaver plugin to save a geojson graph representation | ||
| */ | ||
| class GeoJsonGraphFileSaver : public GraphFileSaver | ||
| { | ||
| public: | ||
| using Json = nlohmann::json; | ||
|
|
||
| /** | ||
| * @brief Constructor | ||
| */ | ||
| GeoJsonGraphFileSaver() = default; | ||
|
|
||
| /** | ||
| * @brief Destructor | ||
| */ | ||
| ~GeoJsonGraphFileSaver() = default; | ||
|
|
||
| /** | ||
| * @brief Configure, but do not store the node | ||
| * @param parent pointer to user's node | ||
| */ | ||
| void configure( | ||
| const rclcpp_lifecycle::LifecycleNode::SharedPtr node) override; | ||
|
|
||
| /** | ||
| * @brief Saves the graph to a geojson file | ||
| * @param graph The graph to save to the geojson file | ||
| * @param filepath The path to save the graph to | ||
| * @return True if successful | ||
| */ | ||
| bool saveGraphToFile( | ||
| Graph & graph, | ||
| std::string filepath) override; | ||
|
|
||
| protected: | ||
| /** | ||
| * @brief Add nodes into the graph | ||
| * @param[out] graph The graph that will contain the new nodes | ||
| * @param[in] json_features Json array to add the nodes to | ||
| */ | ||
| void loadNodesFromGraph(Graph & graph, std::vector<Json> & json_features); | ||
|
|
||
| /** | ||
| * @brief Add edges into the graph | ||
| * @param[out] graph The graph that will contain the new edges | ||
| * @param[in] json_edges Json array to add the edges to | ||
| */ | ||
| void loadEdgesFromGraph(Graph & graph, std::vector<Json> & json_edges); | ||
|
|
||
| /** | ||
| * @brief Convert graph metadata to Json | ||
| * @param metadata Metadata from a node or edge in the graph | ||
| * @param json_metadata Json entry to store metadata in | ||
| */ | ||
| void convertMetaDataToJson(const Metadata & metadata, Json & json_metadata); | ||
|
|
||
| /** | ||
| * @brief Convert graph operation to Json | ||
| * @param Operations Operations information from the graph | ||
| * @param json_operations Json entry to store operation data in | ||
| */ | ||
| void convertOperationsToJson(const Operations & operations, Json & json_operations); | ||
|
|
||
| rclcpp::Logger logger_{rclcpp::get_logger("GeoJsonGraphFileSaver")}; | ||
| }; | ||
| } // namespace nav2_route | ||
|
|
||
| #endif // NAV2_ROUTE__PLUGINS__GRAPH_FILE_SAVERS__GEOJSON_GRAPH_FILE_SAVER_HPP_ |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.