Nav2 Navigation Stack - humble  humble
ROS 2 Navigation Stack
Public Member Functions | Protected Attributes | List of all members
nav2_route::NodeSpatialTree Class Reference

An object to find kNNs of the graph to determining the start and end nodes to utilize for planning in a free-space-style request of start and goal poses. Since the graph does not change over time, we can precompute this quadtree and reuse it over many requests. More...

#include <nav2_route/include/nav2_route/node_spatial_tree.hpp>

Collaboration diagram for nav2_route::NodeSpatialTree:
Collaboration graph
[legend]

Public Member Functions

 NodeSpatialTree ()=default
 Constructor.
 
 ~NodeSpatialTree ()
 Destructor.
 
void computeTree (Graph &graph)
 Compute the kd-tree based on the graph node information. More...
 
bool findNearestGraphNodesToPose (const geometry_msgs::msg::PoseStamped &pose_in, std::vector< unsigned int > &node_ids)
 Find the closest node to a given pose. More...
 
void setNumOfNearestNodes (int num_of_nearest_nodes)
 Set the number of nodes to search in local area for. More...
 

Protected Attributes

kd_tree_t * kdtree_
 
GraphAdaptoradaptor_
 
Graph * graph_
 
int num_of_nearest_nodes_ {3}
 

Detailed Description

An object to find kNNs of the graph to determining the start and end nodes to utilize for planning in a free-space-style request of start and goal poses. Since the graph does not change over time, we can precompute this quadtree and reuse it over many requests.

Definition at line 67 of file node_spatial_tree.hpp.

Member Function Documentation

◆ computeTree()

void nav2_route::NodeSpatialTree::computeTree ( Graph &  graph)

Compute the kd-tree based on the graph node information.

Parameters
graphThe graph of nodes for the route

Definition at line 42 of file node_spatial_tree.cpp.

◆ findNearestGraphNodesToPose()

bool nav2_route::NodeSpatialTree::findNearestGraphNodesToPose ( const geometry_msgs::msg::PoseStamped &  pose_in,
std::vector< unsigned int > &  node_ids 
)

Find the closest node to a given pose.

Parameters
pose_inPose to find node near
node_idThe return ID of the node
Returns
if successfully found

Definition at line 60 of file node_spatial_tree.cpp.

◆ setNumOfNearestNodes()

void nav2_route::NodeSpatialTree::setNumOfNearestNodes ( int  num_of_nearest_nodes)

Set the number of nodes to search in local area for.

Parameters
numNumbers of nearest nodes to return

Definition at line 37 of file node_spatial_tree.cpp.


The documentation for this class was generated from the following files: