Go to the documentation of this file.
44 , expected_cycle_time_(1.0 / frequency)
45 , actual_cycle_time_(0.0)
51 , actual_cycle_time_(0.0)
58 Time expected_end = start_ + expected_cycle_time_;
63 if (actual_end < start_)
65 expected_end = actual_end + expected_cycle_time_;
69 Duration sleep_time = expected_end - actual_end;
72 actual_cycle_time_ = actual_end - start_;
75 start_ = expected_end;
82 if (actual_end > expected_end + expected_cycle_time_)
90 return sleep_time.sleep();
100 return actual_cycle_time_;
104 : start_(WallTime::
now())
105 , expected_cycle_time_(1.0 / frequency)
106 , actual_cycle_time_(0.0)
110 : start_(WallTime::
now())
112 , actual_cycle_time_(0.0)
148 return sleep_time.
sleep();
bool sleep() const
sleep for the amount of time specified by this Duration. If a signal interrupts the sleep,...
Duration cycleTime() const
Get the actual run time of a cycle from start to sleep.
WallDuration expected_cycle_time_
::std_msgs::Duration_< std::allocator< void > > Duration
uint32_t nsec(const rosTime &time)
bool sleep()
Sleeps for any leftover time in a cycle. Calculated from the last time sleep, reset,...
bool sleep()
Sleeps for any leftover time in a cycle. Calculated from the last time sleep, reset,...
Duration representation for use with the WallTime class.
uint32_t sec(const rosTime &time)
WallDuration cycleTime() const
Get the actual run time of a cycle from start to sleep.
static Time now()
Retrieve the current time. If ROS clock time is in use, this returns the time according to the ROS cl...
WallRate(double frequency)
Constructor, creates a Rate.
void reset()
Sets the start time for the rate to now.
WallDuration actual_cycle_time_
Rate(double frequency)
Constructor, creates a Rate.
void reset()
Sets the start time for the rate to now.
static WallTime now()
Returns the current wall clock time.
sick_scan_xd
Author(s): Michael Lehning
, Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10