52 if (transport->connect(host, port))
58 m[
"service"] = mapped_name;
62 transport->write((uint8_t*)&size,
sizeof(size));
63 transport->write(buffer.get(), size);
70 if (print_failure_reason)
72 ROS_INFO(
"waitForService: Service [%s] could not connect to host [%s:%d], waiting...", mapped_name.c_str(), host.c_str(), port);
78 if (print_failure_reason)
80 ROS_INFO(
"waitForService: Service [%s] has not been advertised, waiting...", mapped_name.c_str());
98 if (
exists(service_name, !printed))
111 if ((current_time - start_time) >= wall_timeout)
123 ROS_INFO(
"waitForService: Service [%s] is now available.", mapped_name.c_str());
ROSCPP_DECL const std::string & getName()
Returns the name of the current node.
ROSCPP_DECL std::string resolve(const std::string &name, bool remap=true)
Resolve a graph resource name into a fully qualified graph resource name.
static const ServiceManagerPtr & instance()
std::map< std::string, std::string > M_string
ROSCPP_DECL bool ok()
Check whether it's time to exit.
ROSCPP_DECL bool exists(const std::string &service_name, bool print_failure_reason)
Checks if a service is both advertised and available.
ROSCPP_DECL bool waitForService(const std::string &service_name, int32_t timeout)
Wait for a service to be advertised and available. Blocks until it is.