Template Class BtServiceNode
Defined in File BTServiceNode.hpp
Inheritance Relationships
Base Type
public BT::ActionNodeBase
Class Documentation
-
template<class ServiceT>
class BtServiceNode : public BT::ActionNodeBase Abstract class representing a service based BT node.
Note
This is an Asynchronous (long-running) node which may return a RUNNING state while executing. It will re-initialize when halted.
- Template Parameters:
ServiceT – Type of service
Public Functions
-
inline BtServiceNode(const std::string &service_node_name, const BT::NodeConfiguration &conf, const std::string &service_name = "")
A nav2_behavior_tree::BtServiceNode constructor.
- Parameters:
service_node_name – BT node name
conf – BT node configuration
service_name – Optional service name this node creates a client for instead of from input port
-
BtServiceNode() = delete
-
inline virtual ~BtServiceNode()
-
inline BT::NodeStatus tick() override
The main override required by a BT service.
- Returns:
BT::NodeStatus Status of tick execution
-
inline void halt() override
The other (optional) override required by a BT service.
-
inline virtual void on_tick()
Function to perform some user-defined operation on tick Fill in service request with information if necessary.
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
-
inline virtual BT::NodeStatus check_future()
Check the future and decide the status of BT.
- Returns:
BT::NodeStatus SUCCESS if future complete before timeout, FAILURE otherwise
Public Static Functions
-
static inline BT::PortsList providedBasicPorts(BT::PortsList addition)
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
-
static inline BT::PortsList providedPorts()
Creates list of BT ports.
- Returns:
BT::PortsList Containing basic ports along with node-specific ports
Protected Functions
Protected Attributes
-
std::string service_name_
-
std::string service_node_name_
-
rclcpp_lifecycle::LifecycleNode::SharedPtr node_
-
rclcpp::CallbackGroup::SharedPtr callback_group_ = {nullptr}
-
rclcpp::executors::SingleThreadedExecutor::SharedPtr callback_group_executor_
-
std::chrono::milliseconds server_timeout_
-
std::chrono::milliseconds max_timeout_
-
std::chrono::milliseconds wait_for_service_timeout_
-
bool request_sent_ = {false}
-
rclcpp::Time sent_time_
-
bool should_send_request_