Nav2 Navigation Stack - kilted
kilted
ROS 2 Navigation Stack
|
A GraphFileLoader plugin to load a geojson graph representation. More...
#include <nav2_route/include/nav2_route/plugins/graph_file_loaders/geojson_graph_file_loader.hpp>
Public Types | |
using | Json = nlohmann::json |
![]() | |
using | Ptr = std::shared_ptr< GraphFileLoader > |
Public Member Functions | |
GeoJsonGraphFileLoader ()=default | |
Constructor. | |
~GeoJsonGraphFileLoader ()=default | |
Destructor. | |
void | configure (const rclcpp_lifecycle::LifecycleNode::SharedPtr node) override |
Configure, but do not store the node. More... | |
bool | loadGraphFromFile (Graph &graph, GraphToIDMap &graph_to_id_map, std::string filepath) override |
Loads the geojson file into the graph. More... | |
![]() | |
GraphFileLoader ()=default | |
Constructor. | |
virtual | ~GraphFileLoader ()=default |
Virtual destructor. | |
Protected Member Functions | |
bool | doesFileExist (const std::string &filepath) |
Checks if a file even exists on the filesystem. More... | |
void | getGraphElements (const Json &features, std::vector< Json > &nodes, std::vector< Json > &edges) |
Get the nodes and edges from features. More... | |
void | addNodesToGraph (Graph &graph, GraphToIDMap &graph_to_id_map, std::vector< Json > &nodes) |
Add nodes into the graph. More... | |
void | addEdgesToGraph (Graph &graph, GraphToIDMap &graph_to_id_map, std::vector< Json > &edges) |
Add edges into the graph. More... | |
Coordinates | convertCoordinatesFromJson (const Json &node) |
Converts the coordinates from the json object into the Coordinates type. More... | |
Metadata | convertMetaDataFromJson (const Json &properties, const std::string &key="metadata") |
Converts the metadata from the json object into the metadata type. More... | |
Operation | convertOperationFromJson (const Json &json_operation) |
Converts the operation from the json object into the operation type. More... | |
Operations | convertOperationsFromJson (const Json &properties) |
Converts the operations data from the json object into the operations type if present. More... | |
EdgeCost | convertEdgeCostFromJson (const Json &properties) |
Converts the edge cost data from the json object into the edge cost type. More... | |
Protected Attributes | |
rclcpp::Logger | logger_ {rclcpp::get_logger("GeoJsonGraphFileLoader")} |
A GraphFileLoader plugin to load a geojson graph representation.
Definition at line 33 of file geojson_graph_file_loader.hpp.
|
protected |
Add edges into the graph.
[out] | graph | The graph that will contain the new edges |
[in] | graph_to_id_map | A map of node id to the graph id |
[in] | edges | The edges to be added into the graph |
Definition at line 102 of file geojson_graph_file_loader.cpp.
References convertEdgeCostFromJson(), convertMetaDataFromJson(), and convertOperationsFromJson().
Referenced by loadGraphFromFile().
|
protected |
Add nodes into the graph.
[out] | graph | The graph that will contain the new nodes |
[out] | graph_to_id_map | A map of node id to the graph index |
[in] | nodes | The nodes to be added into the graph |
Definition at line 87 of file geojson_graph_file_loader.cpp.
References convertCoordinatesFromJson(), convertMetaDataFromJson(), and convertOperationsFromJson().
Referenced by loadGraphFromFile().
|
overridevirtual |
Configure, but do not store the node.
parent | pointer to user's node |
Implements nav2_route::GraphFileLoader.
Definition at line 25 of file geojson_graph_file_loader.cpp.
|
protected |
Converts the coordinates from the json object into the Coordinates type.
node | The json object that holds the coordinate data |
Definition at line 132 of file geojson_graph_file_loader.cpp.
Referenced by addNodesToGraph().
|
protected |
Converts the edge cost data from the json object into the edge cost type.
properties | The json object that holds the edge cost data |
Definition at line 225 of file geojson_graph_file_loader.cpp.
Referenced by addEdgesToGraph().
|
protected |
Converts the metadata from the json object into the metadata type.
properties | The json object that holds the metadata |
key | The key for the metadata |
Definition at line 147 of file geojson_graph_file_loader.cpp.
Referenced by addEdgesToGraph(), addNodesToGraph(), and convertOperationFromJson().
|
protected |
Converts the operation from the json object into the operation type.
json_operation | The json object that holds the operation data |
Definition at line 202 of file geojson_graph_file_loader.cpp.
References convertMetaDataFromJson().
Referenced by convertOperationsFromJson().
|
protected |
Converts the operations data from the json object into the operations type if present.
properties | The json object that holds the operations data |
Definition at line 214 of file geojson_graph_file_loader.cpp.
References convertOperationFromJson().
Referenced by addEdgesToGraph(), and addNodesToGraph().
|
protected |
Checks if a file even exists on the filesystem.
filepath | The filepath to be checked |
Definition at line 67 of file geojson_graph_file_loader.cpp.
Referenced by loadGraphFromFile().
|
protected |
Get the nodes and edges from features.
[in] | features | The features that contain the nodes and edges |
[out] | nodes | The nodes found within the features |
[out] | edges | The edges found within the features |
Definition at line 72 of file geojson_graph_file_loader.cpp.
Referenced by loadGraphFromFile().
|
overridevirtual |
Loads the geojson file into the graph.
graph | The graph to be populated by the geojson file |
graph_to_id_map | A map of node id's to the graph index |
filepath | The path of the file to load |
Implements nav2_route::GraphFileLoader.
Definition at line 32 of file geojson_graph_file_loader.cpp.
References addEdgesToGraph(), addNodesToGraph(), doesFileExist(), and getGraphElements().