Nav2 Navigation Stack - rolling  main
ROS 2 Navigation Stack
graph_file_saver.hpp
1 // Copyright (c) 2024 John Chrosniak
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef NAV2_ROUTE__INTERFACES__GRAPH_FILE_SAVER_HPP_
16 #define NAV2_ROUTE__INTERFACES__GRAPH_FILE_SAVER_HPP_
17 
18 #include <string>
19 #include <memory>
20 
21 
22 #include "rclcpp/rclcpp.hpp"
23 #include "nav2_ros_common/lifecycle_node.hpp"
24 #include "nav2_route/types.hpp"
25 
26 namespace nav2_route
27 {
28 
34 {
35 public:
36  using Ptr = std::shared_ptr<GraphFileSaver>;
37 
41  GraphFileSaver() = default;
42 
46  virtual ~GraphFileSaver() = default;
47 
52  virtual void configure(
53  const nav2::LifecycleNode::SharedPtr node) = 0;
54 
61  virtual bool saveGraphToFile(
62  Graph & graph,
63  std::string filepath) = 0;
64 };
65 } // namespace nav2_route
66 
67 #endif // NAV2_ROUTE__INTERFACES__GRAPH_FILE_SAVER_HPP_
A plugin interface to parse a file into the graph.
virtual void configure(const nav2::LifecycleNode::SharedPtr node)=0
Configure the graph file saver, but do not store the node.
GraphFileSaver()=default
Constructor.
virtual bool saveGraphToFile(Graph &graph, std::string filepath)=0
Method to save the graph to the filepath.
virtual ~GraphFileSaver()=default
Virtual destructor.