rate.h
Go to the documentation of this file.
1 #include "sick_scan/sick_scan_base.h" /* Base definitions included in all header files, added by add_sick_scan_base_header.py. Do not edit this line. */
2 /*********************************************************************
3 *
4 * Software License Agreement (BSD License)
5 *
6 * Copyright (c) 2009, Willow Garage, Inc.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
19 * * Neither the name of the Willow Garage nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 *
36 * Author: Eitan Marder-Eppstein
37 *********************************************************************/
38 #ifndef ROSLIB_RATE_H
39 #define ROSLIB_RATE_H
40 
41 #include "ros/time.h"
42 #include "rostime_decl.h"
43 
44 namespace roswrap
45 {
46 class Duration;
47 
53 {
54 public:
59  Rate(double frequency);
60  explicit Rate(const Duration&);
61 
66  bool sleep();
67 
71  void reset();
72 
77  Duration cycleTime() const;
78 
82  Duration expectedCycleTime() const { return expected_cycle_time_; }
83 
84 private:
86  Duration expected_cycle_time_, actual_cycle_time_;
87 };
88 
94 {
95 public:
100  WallRate(double frequency);
101  explicit WallRate(const Duration&);
102 
107  bool sleep();
108 
112  void reset();
113 
118  WallDuration cycleTime() const;
119 
123  WallDuration expectedCycleTime() const { return expected_cycle_time_; }
124 
125 private:
127  WallDuration expected_cycle_time_, actual_cycle_time_;
128 };
129 
130 }
131 
132 #endif
roswrap::WallTime
Time representation. Always wall-clock time.
Definition: time.h:233
roswrap::Time
Time representation. May either represent wall clock time or ROS clock time.
Definition: time.h:177
roswrap::Rate::expected_cycle_time_
Duration expected_cycle_time_
Definition: rate.h:86
roswrap::WallRate
Class to help run loops at a desired frequency. This version always uses wall-clock time.
Definition: rate.h:93
roswrap::Rate
Class to help run loops at a desired frequency.
Definition: rate.h:52
roswrap::WallRate::start_
WallTime start_
Definition: rate.h:126
roswrap::Rate::expectedCycleTime
Duration expectedCycleTime() const
Get the expected cycle time – one over the frequency passed in to the constructor.
Definition: rate.h:82
roswrap::WallRate::expected_cycle_time_
WallDuration expected_cycle_time_
Definition: rate.h:127
std_msgs::Duration
::std_msgs::Duration_< std::allocator< void > > Duration
Definition: Duration.h:48
roswrap::Duration
Duration representation for use with the Time class.
Definition: duration.h:109
roswrap
Definition: param_modi.cpp:41
roswrap::WallDuration
Duration representation for use with the WallTime class.
Definition: duration.h:137
roswrap::Rate::start_
Time start_
Definition: rate.h:85
sick_scan_base.h
ROSTIME_DECL
#define ROSTIME_DECL
Definition: rostime_decl.h:53
sleep
void sleep(int secs)
rostime_decl.h
roswrap::WallRate::expectedCycleTime
WallDuration expectedCycleTime() const
Get the expected cycle time – one over the frequency passed in to the constructor.
Definition: rate.h:123


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:10