Class FrequencyStatusParam
Defined in File topic_status_param.hpp
Inheritance Relationships
Base Type
public diagnostic_updater::FrequencyStatusParam
Derived Type
public cras::TopicStatusParamWithHeader(Class TopicStatusParamWithHeader)
Class Documentation
-
class FrequencyStatusParam : public diagnostic_updater::FrequencyStatusParam
An extension of diagnostic_updater::FrequencyStatusParam that allows passing non-pointer min/max frequency values. If the internal pointers are used, they are correctly handled when copying this object (the new copy will have its own copy of the internal pointers).
Subclassed by cras::TopicStatusParamWithHeader
Public Functions
-
FrequencyStatusParam(double *min_freq, double *max_freq, double tolerance = 0.1, int window_size = 5)
The original constructor from diagnostic_updater::FrequencyStatusParam.
- Parameters:
min_freq – [in] Pointer to a double containing the minimum allowed frequency. Cannot be nullptr.
max_freq – [in] Pointer to a double containing the maximum allowed frequency. Cannot be nullptr.
tolerance – [in] Tolerance of the rate.
window_size – [in] Number of updates during which the frequency is computed.
-
explicit FrequencyStatusParam(double min_freq = 0.0, double max_freq = ::std::numeric_limits<double>::infinity(), double tolerance = 0.1, int window_size = 5)
The added constructor not requiring pointers.
Note
Internal pointers for min/max rate are used.
- Parameters:
min_freq – [in] Minimum allowed frequency.
max_freq – [in] Maximum allowed frequency.
tolerance – [in] Tolerance of the rate.
window_size – [in] Number of updates during which the frequency is computed.
-
FrequencyStatusParam(const ::cras::FrequencyStatusParam &other)
Copy values from another object of this type. If it uses the internal pointers, their values are copied and a new set of internal pointers is created for this object, making it independent of the other one. If the other object uses explicit pointer, this object will use pointers to the same memory.
- Parameters:
other – [in] The object to copy from.
-
FrequencyStatusParam(const ::diagnostic_updater::FrequencyStatusParam &other)
Copy values from the original
diagnostic_updater::FrequencyStatusParam. This object will use pointers to the same memory for min/max rate as the other one.- Parameters:
other – [in] The object to copy from.
-
FrequencyStatusParam(const ::cras::SimpleTopicStatusParamNoHeader ¶ms)
Initialize this object from
SimpleTopicStatusParam. Internal pointers for min/max rate will be used, so theparamsobject may cease to exist.- Parameters:
params – [in] The parameters to initialize with.
-
::cras::FrequencyStatusParam &operator=(const ::cras::FrequencyStatusParam &other)
Copy values from another object of this type. If it uses the internal pointers, their values are copied and a new set of internal pointers is created for this object, making it independent of the other one. If the other object uses explicit pointer, this object will use pointers to the same memory.
- Parameters:
other – [in] The object to copy from.
-
::cras::FrequencyStatusParam &operator=(const ::diagnostic_updater::FrequencyStatusParam &other)
Copy values from the original
diagnostic_updater::FrequencyStatusParam. This object will use pointers to the same memory for min/max rate as the other one.- Parameters:
other – [in] The object to copy from.
-
double getExpectedRate() const
Get the expected/average rate. If min and max are the same, their value will be returned. If min rate is non-positive, the max rate is returned. Otherwise, if max rate is infinite, the min rate will be returned. If min is positive and max is finite, their arithmetic mean is returned.
- Returns:
The expected rate (in Hz).
-
FrequencyStatusParam(double *min_freq, double *max_freq, double tolerance = 0.1, int window_size = 5)