Skip to main content

WaitForServiceAvailable Class

Waits until a ROS service has at least one server, so an Objective can check a required node is running before it starts work that depends on that node. More...

Declaration​

class moveit_pro::behaviors::WaitForServiceAvailable { ... }

Included Headers​

#include <wait_for_service_available.hpp>

Base class​

classSharedResourcesNode<BehaviorTreeNodeT>

The SharedResourcesNode class provides a BehaviorContext object when constructing a BehaviorTree.Cpp node. More...

Public Constructors Index​

WaitForServiceAvailable (const std::string &name, const BT::NodeConfiguration &config, const std::shared_ptr< BehaviorContext > &shared_resources)

Public Member Functions Index​

BT::NodeStatusonStart () override

Reads and validates the ports, then checks the ROS graph once. More...

BT::NodeStatusonRunning () override

Checks the ROS graph, and fails once the timeout has passed with no server. More...

voidonHalted () override

Private Member Functions Index​

BT::NodeStatuscheck ()

Returns SUCCESS when the service has a server, FAILURE when the deadline has passed, else RUNNING. More...

Private Member Attributes Index​

std::stringservice_name_
doubletimeout_seconds_ = 0.0
std::chrono::steady_clock::time_pointstarted_at_

Public Static Functions Index​

static BT::PortsListprovidedPorts ()
static BT::KeyValueVectormetadata ()

Description​

Waits until a ROS service has at least one server, so an Objective can check a required node is running before it starts work that depends on that node.

Checks the ROS graph for a server of service_name on every tick, without calling the service, so it works for any service type. Returns SUCCESS as soon as a server exists and RUNNING until then. Returns FAILURE when no server appears within timeout seconds, when a port is missing, when service_name is empty, or when timeout is negative or not finite. A timeout of 0 checks once.

Data Port NamePort TypeObject Type
service_nameinputstd::string
timeoutinputdouble

Definition at line 32 of file wait_for_service_available.hpp.

Public Constructors​

WaitForServiceAvailable()​

moveit_pro::behaviors::WaitForServiceAvailable::WaitForServiceAvailable (const std::string & name, const BT::NodeConfiguration & config, const std::shared_ptr< BehaviorContext > & shared_resources)

Declaration at line 35 of file wait_for_service_available.hpp, definition at line 34 of file wait_for_service_available.cpp.

Public Member Functions​

onHalted()​

void moveit_pro::behaviors::WaitForServiceAvailable::onHalted ()

Declaration at line 48 of file wait_for_service_available.hpp, definition at line 90 of file wait_for_service_available.cpp.

onRunning()​

BT::NodeStatus moveit_pro::behaviors::WaitForServiceAvailable::onRunning ()

Checks the ROS graph, and fails once the timeout has passed with no server.

Declaration at line 46 of file wait_for_service_available.hpp, definition at line 85 of file wait_for_service_available.cpp.

onStart()​

BT::NodeStatus moveit_pro::behaviors::WaitForServiceAvailable::onStart ()

Reads and validates the ports, then checks the ROS graph once.

Declaration at line 43 of file wait_for_service_available.hpp, definition at line 54 of file wait_for_service_available.cpp.

Private Member Functions​

check()​

BT::NodeStatus moveit_pro::behaviors::WaitForServiceAvailable::check ()

Returns SUCCESS when the service has a server, FAILURE when the deadline has passed, else RUNNING.

Declaration at line 52 of file wait_for_service_available.hpp, definition at line 95 of file wait_for_service_available.cpp.

Private Member Attributes​

service_name_​

std::string moveit_pro::behaviors::WaitForServiceAvailable::service_name_

Definition at line 54 of file wait_for_service_available.hpp.

started_at_​

std::chrono::steady_clock::time_point moveit_pro::behaviors::WaitForServiceAvailable::started_at_

Definition at line 56 of file wait_for_service_available.hpp.

timeout_seconds_​

double moveit_pro::behaviors::WaitForServiceAvailable::timeout_seconds_ = 0.0

Definition at line 55 of file wait_for_service_available.hpp.

Public Static Functions​

metadata()​

BT::KeyValueVector moveit_pro::behaviors::WaitForServiceAvailable::metadata ()
static

Declaration at line 40 of file wait_for_service_available.hpp, definition at line 49 of file wait_for_service_available.cpp.

providedPorts()​

BT::PortsList moveit_pro::behaviors::WaitForServiceAvailable::providedPorts ()
static

Declaration at line 38 of file wait_for_service_available.hpp, definition at line 40 of file wait_for_service_available.cpp.


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


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.15.0.