$search

ros::service Namespace Reference

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

Functions

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

Detailed Description

Contains functions for querying information about and calling a service.


Function Documentation

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

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_name The name of the service.
service The 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 >
bool ros::service::call ( const std::string &  service_name,
MReq &  req,
MRes &  res 
) [inline]

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_name The name of the service.
req The request message.
[out] res Storage for the response message.
Returns:
true on success, false otherwise.

Definition at line 65 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() 
) [inline]

Create a client for a service.

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

Parameters:
service_name The name of the service to connect to
persistent Whether 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_values Key/value pairs you'd like to send along in the connection handshake

Definition at line 151 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() 
) [inline]

Create a client for a service.

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

Parameters:
service_name The name of the service to connect to
persistent Whether 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_values Key/value pairs you'd like to send along in the connection handshake

Definition at line 133 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_name Name of the service to check for
print_failure_reason Whether 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,
ros::Duration  timeout = ros::Duration(-1) 
)

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

Parameters:
service_name Name of the service to wait for.
timeout The 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.

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_name Name of the service to wait for.
timeout The 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.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


roscpp
Author(s): Morgan Quigley mquigley@cs.stanford.edu, Josh Faust jfaust@willowgarage.com, Brian Gerkey gerkey@willowgarage.com, Troy Straszheim straszheim@willowgarage.com
autogenerated on Sat Mar 2 13:23:33 2013