NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nimbro_utils::RosServiceCaller< T > Class Template Reference

Provides basic functionality for controlling calls to ROS services. More...

#include <ros_timing.h>

Public Member Functions

 RosServiceCaller (double reissueDelay, double failRetryDelay)
 Default constructor. More...
 
void setServiceClient (const ros::ServiceClient &SC)
 Set function for the ROS ServiceClient used by this RosServiceCaller
 
bool callService ()
 Call the required service with the request data stored in the data class member.
 
bool callService (T &srv_data)
 Call the required service with the request data stored in srv_data.
 

Public Attributes

data
 Request variable (can choose to use this instead of providing your own in the calling scope of callService())
 

Detailed Description

template<class T>
class nimbro_utils::RosServiceCaller< T >

Provides basic functionality for controlling calls to ROS services.

To use a RosServiceCaller in your class, simply add an instance of it as a class member and provide the two delay arguments to the RosServiceCaller constructor in the class initialiser list. From then on you can simply directly invoke callService() whenver you need to. So in the end you'll probably have something like this:

RosServiceCaller<srv_node::MySrv> m_rsc_mySrv(2.0, 0.3);
...
if(I_Want_To_Call_My_Service)
{
srv_node::MySrv data;
data.request.XXX = ...;
data.request.YYY = ...;
if(m_rsc_mySrv.callService(data))
{
// Process data.response!
}
}
...
OR
...
if(I_Want_To_Call_My_Service)
{
m_rsc_mySrv.data.request.XXX = ...;
m_rsc_mySrv.data.request.YYY = ...;
if(m_rsc_mySrv.callService())
{
// Process m_rsc_mySrv.data.response!
}
}

Constructor & Destructor Documentation

template<class T >
nimbro_utils::RosServiceCaller< T >::RosServiceCaller ( double  reissueDelay,
double  failRetryDelay 
)
inline

Default constructor.

Parameters
reissueDelayThe minimum time to wait after a successful service call before allowing attempts to call the service again.
failRetryDelayThe minimum time to wait after an unsuccessful service call before allowing attempts to call the service again.

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