Nav2 Navigation Stack - rolling  main
ROS 2 Navigation Stack
Public Member Functions | Static Public Member Functions | List of all members
nav2_behavior_tree::ValidatePath Class Reference

A nav2_behavior_tree::BtServiceNode class that validates a path by calling the IsPathValid service on the path provided in the input port. More...

#include <nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/validate_path_action.hpp>

Inheritance diagram for nav2_behavior_tree::ValidatePath:
Inheritance graph
[legend]
Collaboration diagram for nav2_behavior_tree::ValidatePath:
Collaboration graph
[legend]

Public Member Functions

 ValidatePath (const std::string &service_node_name, const BT::NodeConfiguration &conf)
 A constructor for nav2_behavior_tree::ValidatePath. More...
 
void on_tick () override
 The main override required by a BT service. More...
 
BT::NodeStatus on_completion (std::shared_ptr< nav2_msgs::srv::IsPathValid::Response > response) override
 Function to perform some user-defined operation after receiving a result from the service. More...
 
- Public Member Functions inherited from nav2_behavior_tree::BtServiceNode< nav2_msgs::srv::IsPathValid >
 BtServiceNode (const std::string &service_node_name, const BT::NodeConfiguration &conf, const std::string &service_name="")
 A nav2_behavior_tree::BtServiceNode constructor. More...
 
void initialize ()
 Function to read parameters and initialize class variables.
 
void createROSInterfaces ()
 Function to create ROS interfaces.
 
BT::NodeStatus tick () override
 The main override required by a BT service. More...
 
void halt () override
 The other (optional) override required by a BT service.
 
virtual BT::NodeStatus on_completion (std::shared_ptr< typename ServiceT::Response >)
 Function to perform some user-defined operation upon successful completion of the service. Could put a value on the blackboard. More...
 
virtual void on_timeout ()
 Function to perform work in a BT Node when the service call times out.
 
virtual BT::NodeStatus check_future ()
 Check the future and decide the status of BT. More...
 
virtual void on_wait_for_result ()
 Function to perform some user-defined operation after a timeout waiting for a result that hasn't been received yet.
 

Static Public Member Functions

static BT::PortsList providedPorts ()
 Creates list of BT ports. More...
 
- Static Public Member Functions inherited from nav2_behavior_tree::BtServiceNode< nav2_msgs::srv::IsPathValid >
static BT::PortsList providedBasicPorts (BT::PortsList addition)
 Any subclass of BtServiceNode that accepts parameters must provide a providedPorts method and call providedBasicPorts in it. More...
 
static BT::PortsList providedPorts ()
 Creates list of BT ports. More...
 

Additional Inherited Members

- Protected Member Functions inherited from nav2_behavior_tree::BtServiceNode< nav2_msgs::srv::IsPathValid >
void increment_recovery_count ()
 Function to increment recovery count on blackboard if this node wraps a recovery.
 
- Protected Attributes inherited from nav2_behavior_tree::BtServiceNode< nav2_msgs::srv::IsPathValid >
std::string service_name_
 
std::string service_node_name_
 
nav2::ServiceClient< nav2_msgs::srv::IsPathValid >::SharedPtr service_client_
 
std::shared_ptr< typename ServiceT::Request > request_
 
nav2::LifecycleNode::SharedPtr node_
 
std::chrono::milliseconds server_timeout_
 
std::chrono::milliseconds max_timeout_
 
std::chrono::milliseconds wait_for_service_timeout_
 
std::shared_future< typename ServiceT::Response::SharedPtr > future_result_
 
bool request_sent_
 
rclcpp::Time sent_time_
 
bool should_send_request_
 

Detailed Description

A nav2_behavior_tree::BtServiceNode class that validates a path by calling the IsPathValid service on the path provided in the input port.

Usage in XML:

server_timeout="10"
path="{path}"
max_cost="100"
consider_unknown_as_obstacle="false"
layer_name=""
footprint=""
stop_at_first_collision="true"
collision_poses="{collision_poses}" />
<!-- With max_lookahead_distance: -->
path="{path}"
max_lookahead_distance="5.0"
collision_poses="{collision_poses}" />
<!-- With custom footprint: -->
path="{path}"
footprint="[[0.5,0.5],[0.5,-0.5],[-0.5,-0.5],[-0.5,0.5]]"
collision_poses="{collision_poses}" />
<!-- Checking a specific costmap layer: -->
path="{path}"
layer_name="obstacle_layer"
stop_at_first_collision="false"
collision_poses="{collision_poses}" />
ValidatePath(const std::string &service_node_name, const BT::NodeConfiguration &conf)
A constructor for nav2_behavior_tree::ValidatePath.

Definition at line 70 of file validate_path_action.hpp.

Constructor & Destructor Documentation

◆ ValidatePath()

nav2_behavior_tree::ValidatePath::ValidatePath ( const std::string &  service_node_name,
const BT::NodeConfiguration &  conf 
)

A constructor for nav2_behavior_tree::ValidatePath.

Parameters
service_node_nameService name this node creates a client for
confBT node configuration

Definition at line 24 of file validate_path_action.cpp.

Member Function Documentation

◆ on_completion()

BT::NodeStatus nav2_behavior_tree::ValidatePath::on_completion ( std::shared_ptr< nav2_msgs::srv::IsPathValid::Response >  response)
override

Function to perform some user-defined operation after receiving a result from the service.

Parameters
responseThe response received from the service
Returns
BT::NodeStatus Status of tick execution after processing the response

Definition at line 52 of file validate_path_action.cpp.

◆ on_tick()

void nav2_behavior_tree::ValidatePath::on_tick ( )
overridevirtual

The main override required by a BT service.

Returns
BT::NodeStatus Status of tick execution

Reimplemented from nav2_behavior_tree::BtServiceNode< nav2_msgs::srv::IsPathValid >.

Definition at line 32 of file validate_path_action.cpp.

◆ providedPorts()

static BT::PortsList nav2_behavior_tree::ValidatePath::providedPorts ( )
inlinestatic

Creates list of BT ports.

Returns
BT::PortsList Containing node-specific ports

Definition at line 100 of file validate_path_action.hpp.

References nav2_behavior_tree::BtServiceNode< nav2_msgs::srv::IsPathValid >::providedBasicPorts().

Here is the call graph for this function:

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