time_utils.hpp
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include <ros/duration.h>
12 #include <ros/rate.h>
13 #include <ros/time.h>
14 
15 namespace cras
16 {
17 
24 ::ros::Duration remainingTime(const ::ros::Time& query, double timeout);
25 
32 ::ros::Duration remainingTime(const ::ros::Time& query, const ::ros::Duration& timeout);
33 
40 double frequency(const ::ros::Rate& rate, bool maxCycleTimeMeansZero = false);
41 
48 double frequency(const ::ros::WallRate& rate, bool maxCycleTimeMeansZero = false);
49 
57 
65 
71 
72 }
73 
74 namespace ros
75 {
76 
83 bool operator==(const ::ros::Rate& r1, const ::ros::Rate& r2);
84 
91 bool operator==(const ::ros::WallRate& r1, const ::ros::WallRate& r2);
92 
100 ::ros::Duration operator*(const ::ros::Duration& val1, const ::ros::Duration& val2);
101 
109 ::ros::Duration operator/(const ::ros::Duration& numerator, const ::ros::Duration& denominator);
110 
118 ::ros::WallDuration operator*(const ::ros::WallDuration& val1, const ::ros::WallDuration& val2);
119 
127 ::ros::WallDuration operator/(const ::ros::WallDuration& numerator, const ::ros::WallDuration& denominator);
128 
129 }
::ros::WallDuration operator*(const ::ros::WallDuration &val1, const ::ros::WallDuration &val2)
Multiply two durations. The units of the result are [s^2].
::ros::Duration remainingTime(const ::ros::Time &query, double timeout)
Return remaining time to timeout from the query time.
double frequency(const ::ros::Rate &rate, bool maxCycleTimeMeansZero=false)
Return the frequency represented by the given rate.
::ros::WallDuration operator/(const ::ros::WallDuration &numerator, const ::ros::WallDuration &denominator)
Divide duration val1 by val2. The result is unitless.
::ros::Rate safeRate(double frequency)
Return a rate representing the given frequency. If the frequency is zero or too small, return min/max representable rate.
bool operator==(const ::ros::WallRate &r1, const ::ros::WallRate &r2)
Test two rates for equality.
::ros::WallRate safeWallRate(double frequency)
Return a rate representing the given frequency. If the frequency is zero or too small, return min/max representable rate.
::ros::Time nowFallbackToWall()
Return current ROS time if it has already been initialized, or current wall time. ...
Definition: any.hpp:15


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Sat Jun 17 2023 02:32:53