![]() |
NimbRo ROS Soccer Package
|
Class that facilitates the timing of durations using ROS-time. More...
#include <ros_timing.h>
Public Member Functions | |
RosTimeMarker () | |
Default constructor. | |
void | unsetMarker () |
Forget any time marker that may have been set previously. | |
void | setMarker () |
Set the time marker to the current ROS time (future calls to getElapsed() and hasElapsed() will be evaluated relative to this marker) | |
bool | haveMarker () const |
Returns whether a marker is currently set. | |
double | getElapsed () const |
Returns the current elapsed time since the marker was set (returns -1.0 if no marker has been set - check this if you must as getElapsed() < 0.0 ) | |
bool | hasElapsed (double duration) const |
Returns whether a certain time duration has elapsed since the time marker was set (returns true if no marker has been set) | |
Class that facilitates the timing of durations using ROS-time.
To use a RosTimeMarker
you simply need to instantiate one with its default constructor (e.g. simply add it as a member of your class). No initialisation is necessary. Then you can go straight to checking hasElapsed(T)
for example, which until you actually set the marker will always return true and allow your action to happen.