Nav2 Navigation Stack - humble
humble
ROS 2 Navigation Stack
|
A GraphFileSaver plugin to save a geojson graph representation. More...
#include <nav2_route/include/nav2_route/plugins/graph_file_savers/geojson_graph_file_saver.hpp>
Public Types | |
using | Json = nlohmann::json |
![]() | |
using | Ptr = std::shared_ptr< GraphFileSaver > |
Public Member Functions | |
GeoJsonGraphFileSaver ()=default | |
Constructor. | |
~GeoJsonGraphFileSaver ()=default | |
Destructor. | |
void | configure (const nav2_util::LifecycleNode::SharedPtr node) override |
Configure, but do not store the node. More... | |
bool | saveGraphToFile (Graph &graph, std::string filepath) override |
Saves the graph to a geojson file. More... | |
![]() | |
GraphFileSaver ()=default | |
Constructor. | |
virtual | ~GraphFileSaver ()=default |
Virtual destructor. | |
virtual void | configure (const rclcpp_lifecycle::LifecycleNode::SharedPtr node)=0 |
Configure the graph file saver, but do not store the node. More... | |
Protected Member Functions | |
void | loadNodesFromGraph (Graph &graph, std::vector< Json > &json_features) |
Add nodes into the graph. More... | |
void | loadEdgesFromGraph (Graph &graph, std::vector< Json > &json_edges) |
Add edges into the graph. More... | |
void | convertMetaDataToJson (const Metadata &metadata, Json &json_metadata) |
Convert graph metadata to Json. More... | |
void | convertOperationsToJson (const Operations &operations, Json &json_operations) |
Convert graph operation to Json. More... | |
Protected Attributes | |
rclcpp::Logger | logger_ {rclcpp::get_logger("GeoJsonGraphFileSaver")} |
A GraphFileSaver plugin to save a geojson graph representation.
Definition at line 35 of file geojson_graph_file_saver.hpp.
|
override |
Configure, but do not store the node.
parent | pointer to user's node |
Definition at line 25 of file geojson_graph_file_saver.cpp.
|
protected |
Convert graph metadata to Json.
metadata | Metadata from a node or edge in the graph |
json_metadata | Json entry to store metadata in |
Definition at line 116 of file geojson_graph_file_saver.cpp.
Referenced by convertOperationsToJson(), loadEdgesFromGraph(), and loadNodesFromGraph().
|
protected |
Convert graph operation to Json.
Operations | Operations information from the graph |
json_operations | Json entry to store operation data in |
Definition at line 160 of file geojson_graph_file_saver.cpp.
References convertMetaDataToJson().
Referenced by loadEdgesFromGraph(), and loadNodesFromGraph().
|
protected |
Add edges into the graph.
[out] | graph | The graph that will contain the new edges |
[in] | json_edges | Json array to add the edges to |
Definition at line 88 of file geojson_graph_file_saver.cpp.
References convertMetaDataToJson(), and convertOperationsToJson().
Referenced by saveGraphToFile().
|
protected |
Add nodes into the graph.
[out] | graph | The graph that will contain the new nodes |
[in] | json_features | Json array to add the nodes to |
Definition at line 61 of file geojson_graph_file_saver.cpp.
References convertMetaDataToJson(), and convertOperationsToJson().
Referenced by saveGraphToFile().
|
overridevirtual |
Saves the graph to a geojson file.
graph | The graph to save to the geojson file |
filepath | The path to save the graph to |
Implements nav2_route::GraphFileSaver.
Definition at line 32 of file geojson_graph_file_saver.cpp.
References loadEdgesFromGraph(), and loadNodesFromGraph().