frequency.hpp
Go to the documentation of this file.
1 
4 /*****************************************************************************
5 ** Ifdefs
6 *****************************************************************************/
7 
8 #ifndef ecl_time_TIME_FREQUENCY_DIAGNOSTICS_HPP_
9 #define ecl_time_TIME_FREQUENCY_DIAGNOSTICS_HPP_
10 
11 /*****************************************************************************
12 ** Includes
13 *****************************************************************************/
14 
15 #include "timestamp.hpp"
16 
17 /*****************************************************************************
18 ** Namespaces
19 *****************************************************************************/
20 
21 namespace ecl {
22 
23 /*****************************************************************************
24 ** Interfaces
25 *****************************************************************************/
31 struct FrequencyDiagnostics {
32 
34  : has_connection(false)
35  , hz(-1.0)
36  , std_dev(-1.0)
37  , minimum_interval(-1.0)
38  , maximum_interval(-1.0)
39  , last_incoming()
40  {}
41 
42  bool has_connection;
43  float hz;
44  float std_dev;
45  float minimum_interval;
46  float maximum_interval;
47  float last_incoming;
48 
49 };
50 
83 class FrequencyMonitor {
84 public:
91  FrequencyMonitor(
92  const float& window_period = 2.0,
93  const bool& use_realtime_clock=false
94  );
100  void update();
107  const FrequencyDiagnostics& analyse();
108 
113  const FrequencyDiagnostics& diagnostics() const { return current_diagnostics; };
114 
115 protected:
116  FrequencyDiagnostics current_diagnostics;
117  unsigned int incoming_counter;
118  ecl::TimeStamp last_anyalsed;
119  ecl::TimeStamp period;
120  ecl::TimeStamp minimum_interval;
121  ecl::TimeStamp maximum_interval;
122  bool use_realtime_clock;
123  ecl::TimeStamp last_incoming;
124 };
125 
126 /*****************************************************************************
127 ** Trailers
128 *****************************************************************************/
129 
130 } // namespace ecl
131 
132 #endif /* ecl_time_TIME_FREQUENCY_DIAGNOSTICS_HPP_ */


xbot_driver
Author(s): Roc, wangpeng@droid.ac.cn
autogenerated on Sat Oct 10 2020 03:27:37