Functions
ros::service Namespace Reference

Contains functions for querying information about and calling a service. More...

Functions

template<class MReq , class MRes >
bool call (const std::string &service_name, MReq &req, MRes &res)
 Invoke an RPC service.
template<class Service >
bool call (const std::string &service_name, Service &service)
 Invoke an RPC service.
template<class MReq , class MRes >
ServiceClient createClient (const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
 Create a client for a service.
template<class Service >
ServiceClient createClient (const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
 Create a client for a service.
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.
ROSCPP_DECL bool waitForService (const std::string &service_name, ros::Duration timeout=ros::Duration(-1))
 Wait for a service to be advertised and available. Blocks until it is.

Detailed Description

Contains functions for querying information about and calling a service.


Function Documentation

template<class MReq , class MRes >
bool ros::service::call ( const std::string &  service_name,
MReq &  req,
MRes &  res 
)

Invoke an RPC service.

This method invokes an RPC service on a remote server, looking up the service location first via the master.

Parameters:
service_nameThe name of the service.
reqThe request message.
[out]resStorage for the response message.
Returns:
true on success, false otherwise.

Definition at line 65 of file service.h.

template<class Service >
bool ros::service::call ( const std::string &  service_name,
Service &  service 
)

Invoke an RPC service.

This method invokes an RPC service on a remote server, looking up the service location first via the master.

Parameters:
service_nameThe name of the service.
serviceThe service class that contains the request and response messages
Returns:
true on success, false otherwise.

Definition at line 85 of file service.h.

template<class MReq , class MRes >
ServiceClient ros::service::createClient ( const std::string &  service_name,
bool  persistent = false,
const M_string header_values = M_string() 
)

Create a client for a service.

When the last handle reference of a persistent connection is cleared, the connection will automatically close.

Parameters:
service_nameThe name of the service to connect to
persistentWhether this connection should persist. Persistent services keep the connection to the remote host active so that subsequent calls will happen faster. In general persistent services are discouraged, as they are not as robust to node failure as non-persistent services.
header_valuesKey/value pairs you'd like to send along in the connection handshake

Definition at line 133 of file service.h.

template<class Service >
ServiceClient ros::service::createClient ( const std::string &  service_name,
bool  persistent = false,
const M_string header_values = M_string() 
)

Create a client for a service.

When the last handle reference of a persistent connection is cleared, the connection will automatically close.

Parameters:
service_nameThe name of the service to connect to
persistentWhether this connection should persist. Persistent services keep the connection to the remote host active so that subsequent calls will happen faster. In general persistent services are discouraged, as they are not as robust to node failure as non-persistent services.
header_valuesKey/value pairs you'd like to send along in the connection handshake

Definition at line 151 of file service.h.

bool ros::service::exists ( const std::string &  service_name,
bool  print_failure_reason 
)

Checks if a service is both advertised and available.

Parameters:
service_nameName of the service to check for
print_failure_reasonWhether to print the reason for failure to the console (service not advertised vs. could not connect to the advertised host)
Returns:
true if the service is up and available, false otherwise

Definition at line 41 of file service.cpp.

bool ros::service::waitForService ( const std::string &  service_name,
int32_t  timeout 
)

Wait for a service to be advertised and available. Blocks until it is.

Parameters:
service_nameName of the service to wait for.
timeoutThe amount of time to wait for, in milliseconds. If timeout is -1, waits until the node is shutdown
Returns:
true on success, false otherwise

Definition at line 128 of file service.cpp.

bool ros::service::waitForService ( const std::string &  service_name,
ros::Duration  timeout = ros::Duration(-1) 
)

Wait for a service to be advertised and available. Blocks until it is.

Parameters:
service_nameName of the service to wait for.
timeoutThe amount of time to wait for before timing out. If timeout is -1 (default), waits until the node is shutdown
Returns:
true on success, false otherwise

Definition at line 87 of file service.cpp.



roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim
autogenerated on Mon Oct 6 2014 11:46:44