15 #ifndef NAV2_ROUTE__GRAPH_SAVER_HPP_
16 #define NAV2_ROUTE__GRAPH_SAVER_HPP_
21 #include <unordered_map>
22 #include <nlohmann/json.hpp>
23 #include <pluginlib/class_loader.hpp>
25 #include "nav2_ros_common/lifecycle_node.hpp"
26 #include "nav2_ros_common/tf2_factories.hpp"
27 #include "nav2_ros_common/node_utils.hpp"
28 #include "nav2_util/robot_utils.hpp"
29 #include "nav2_route/types.hpp"
30 #include "nav2_route/interfaces/graph_file_saver.hpp"
31 #include "rclcpp/node_interfaces/node_parameters_interface.hpp"
50 nav2::LifecycleNode::SharedPtr node,
51 nav2::TransformBuffer::SharedPtr tf,
52 const std::string frame);
67 std::string filepath =
"");
77 std::string route_frame_, graph_filepath_;
78 nav2::TransformBuffer::SharedPtr tf_;
79 rclcpp::Logger logger_{rclcpp::get_logger(
"GraphSaver")};
82 pluginlib::ClassLoader<GraphFileSaver> plugin_loader_;
83 GraphFileSaver::Ptr graph_file_saver_;
84 std::string default_plugin_id_;
85 std::string plugin_type_;
An object to save graph objects to a file.
GraphSaver(nav2::LifecycleNode::SharedPtr node, nav2::TransformBuffer::SharedPtr tf, const std::string frame)
A constructor for nav2_route::GraphSaver.
bool saveGraphToFile(Graph &graph, std::string filepath="")
Saves a graph object to a file.
~GraphSaver()=default
A destructor for nav2_route::GraphSaver.
bool transformGraph(Graph &graph)
Transform the coordinates in the graph to the route frame.