Abstract class representing a service based BT node.
More...
#include <nav2_behavior_tree/include/nav2_behavior_tree/bt_service_node.hpp>
|
| 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 void | on_tick () |
| Function to perform some user-defined operation on tick Fill in service request with information if necessary.
|
|
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 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.
|
|
|
std::string | service_name_ |
|
std::string | service_node_name_ |
|
nav2_util::ServiceClient< ServiceT >::SharedPtr | service_client_ |
|
std::shared_ptr< typename ServiceT::Request > | request_ |
|
rclcpp::Node::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_ {false} |
|
rclcpp::Time | sent_time_ |
|
bool | should_send_request_ |
|
template<class ServiceT>
class nav2_behavior_tree::BtServiceNode< ServiceT >
Abstract class representing a service based BT node.
- Template Parameters
-
- Note
- This is an Asynchronous (long-running) node which may return a RUNNING state while executing. It will re-initialize when halted.
Definition at line 42 of file bt_service_node.hpp.
◆ BtServiceNode()
template<class ServiceT >
◆ check_future()
template<class ServiceT >
Check the future and decide the status of BT.
- Returns
- BT::NodeStatus SUCCESS if future complete before timeout, FAILURE otherwise
Definition at line 212 of file bt_service_node.hpp.
◆ on_completion()
template<class ServiceT >
Function to perform some user-defined operation upon successful completion of the service. Could put a value on the blackboard.
- Parameters
-
response | can be used to get the result of the service call in the BT Node. |
- Returns
- BT::NodeStatus Returns SUCCESS by default, user may override to return another value
Definition at line 203 of file bt_service_node.hpp.
◆ providedBasicPorts()
template<class ServiceT >
Any subclass of BtServiceNode that accepts parameters must provide a providedPorts method and call providedBasicPorts in it.
- Parameters
-
addition | Additional ports to add to BT port list |
- Returns
- BT::PortsList Containing basic ports along with node-specific ports
Definition at line 128 of file bt_service_node.hpp.
◆ providedPorts()
template<class ServiceT >
Creates list of BT ports.
- Returns
- BT::PortsList Containing basic ports along with node-specific ports
Definition at line 143 of file bt_service_node.hpp.
◆ tick()
template<class ServiceT >
The main override required by a BT service.
- Returns
- BT::NodeStatus Status of tick execution
Definition at line 152 of file bt_service_node.hpp.
The documentation for this class was generated from the following file: