Public Member Functions | Private Member Functions | Private Attributes
TimeServer Class Reference

Node that provides a time service to keep other nodes in sync. More...

#include <time_server.h>

List of all members.

Public Member Functions

 TimeServer ()

Private Member Functions

void init ()
 Initializes the node.
bool service (time_server::time_srv::Request &req, time_server::time_srv::Response &res)
 Callback for time service request.

Private Attributes

ros::NodeHandle n_
ros::Duration offset_
ros::ServiceServer service_

Detailed Description

Node that provides a time service to keep other nodes in sync.

The clock starts at 0, and begins the first time the service is called.

Author:
Jonathan Hasenzahl

Definition at line 21 of file time_server.h.


Constructor & Destructor Documentation

TimeServer::TimeServer ( ) [inline]

Definition at line 24 of file time_server.h.


Member Function Documentation

void TimeServer::init ( ) [private]

Initializes the node.

Advertises the service and starts the spin loop.

Definition at line 14 of file time_server.cpp.

bool TimeServer::service ( time_server::time_srv::Request &  req,
time_server::time_srv::Response &  res 
) [private]

Callback for time service request.

This method is called automatically when the node receives a service request. The node responds with the current clock time and the difference between the request time and the actual time.

If this is the first request received, the node starts its clock (from 0).

Parameters:
reqthe client request
resthe server response
Returns:
true

Definition at line 33 of file time_server.cpp.


Member Data Documentation

ros::NodeHandle TimeServer::n_ [private]

Definition at line 31 of file time_server.h.

ros::Duration TimeServer::offset_ [private]

Definition at line 33 of file time_server.h.

ros::ServiceServer TimeServer::service_ [private]

Definition at line 32 of file time_server.h.


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


time_server
Author(s): Jonathan Hasenzahl
autogenerated on Sun Jan 5 2014 11:12:28