Go to the documentation of this file.
37 #ifndef __DIAGNOSTIC_STATUS__UPDATE_FUNCTIONS_H__
38 #define __DIAGNOSTIC_STATUS__UPDATE_FUNCTIONS_H__
41 #include "diagnostic_msgs/DiagnosticStatus.h"
51 struct FrequencyStatusParam
57 FrequencyStatusParam(
double *min_freq,
double *max_freq,
double tolerance = 0.1,
int window_size = 5) :
104 class FrequencyStatus :
public DiagnosticTask
107 const FrequencyStatusParam
params_;
110 std::vector <ros::Time>
times_;
120 FrequencyStatus(
const FrequencyStatusParam ¶ms, std::string name) :
145 boost::mutex::scoped_lock lock(
lock_);
163 boost::mutex::scoped_lock lock(
lock_);
170 boost::mutex::scoped_lock lock(
lock_);
179 freq = events / window;
197 else if (window != 0)
202 stat.
addf(
"Events in window",
"%d", events);
203 stat.
addf(
"Events since startup",
"%d",
count_);
204 stat.
addf(
"Duration of window (s)",
"%f", window);
206 stat.
addf(
"Actual frequency (Hz)",
"%f",freq);
211 stat.
addf(
"Minimum acceptable frequency (Hz)",
"%f",
215 stat.
addf(
"Maximum acceptable frequency (Hz)",
"%f",
225 struct TimeStampStatusParam
266 class TimeStampStatus :
public DiagnosticTask
322 void tick(
double stamp)
324 boost::mutex::scoped_lock lock(
lock_);
374 class SlowTimeStampStatus :
public TimeStampStatus
virtual void run(diagnostic_updater::DiagnosticStatusWrapper &stat)
Fills out this Task's DiagnosticStatusWrapper.
static TimeStampStatusParam DefaultTimeStampStatusParam
Default TimeStampStatusParam. This is like calling the constructor with no arguments.
A structure that holds the constructor parameters for the TimeStampStatus class.
FrequencyStatus(const FrequencyStatusParam ¶ms, std::string name)
Constructs a FrequencyStatus class with the given parameters.
const FrequencyStatusParam params_
double * max_freq_
Maximum acceptable frequency.
double min_acceptable_
Minimum acceptable difference between two timestamps.
FrequencyStatusParam(double *min_freq, double *max_freq, double tolerance=0.1, int window_size=5)
Creates a filled-out FrequencyStatusParam.
TimeStampStatus()
Constructs the TimeStampStatus with the default parameters. Uses a default diagnostic task name of "T...
std::vector< ros::Time > times_
void tick()
Signals that an event has occurred.
DiagnosticTask is an abstract base class for collecting diagnostic data.
Diagnostic task to monitor whether a node is alive.
Heartbeat()
Constructs a HeartBeat.
double max_acceptable_
Maximum acceptable difference between two timestamps.
virtual void run(diagnostic_updater::DiagnosticStatusWrapper &stat)
Fills out this Task's DiagnosticStatusWrapper.
double * min_freq_
Minimum acceptable frequency.
void summary(unsigned char lvl, const std::string s)
Fills out the level and message fields of the DiagnosticStatus.
std::vector< int > seq_nums_
void addf(const std::string &key, const char *format,...)
Add a key-value pair using a format string.
double tolerance_
Tolerance with which bounds must be satisfied.
Wrapper for the diagnostic_msgs::DiagnosticStatus message that makes it easier to update.
void clear()
Resets the statistics.
void tick(double stamp)
Signals an event. Timestamp stored as a double.
TimeStampStatusParam params_
TimeStampStatusParam(const double min_acceptable=-1, const double max_acceptable=5)
Creates a filled-out TimeStampStatusParam.
int window_size_
Number of events to consider in the statistics.
A structure that holds the constructor parameters for the FrequencyStatus class.
virtual void run(diagnostic_updater::DiagnosticStatusWrapper &stat)
Fills out this Task's DiagnosticStatusWrapper.
diagnostic_updater
Author(s): Kevin Watts, Brice Rebsamen
, Jeremy Leibs, Blaise Gassend
autogenerated on Tue Nov 15 2022 03:17:19