Class DurationStatus

Inheritance Relationships

Base Type

  • public diagnostic_updater::DiagnosticTask

Class Documentation

class DurationStatus : public diagnostic_updater::DiagnosticTask

Diagnostic task for topic frequency and timestamp delay (combining FrequencyStatus and TimeStampStatus tasks).

Template Parameters:

Message – Type of the message. If it contains a header field, the task will automatically check both frequency and timestamp delay. Header-less messages will only have their frequency checked.

Public Functions

DurationStatus(const ::std::string &name, const ::cras::DurationStatusParam &params)

Create the diagnostic task for a header-less message (checking frequency only).

Template Parameters:

M – SFINAE only. Do not set explicitly.

Parameters:
  • name[in] Name of the diagnostic task.

  • params[in] Parameters of the task.

explicit DurationStatus(const ::std::string &name, const ::ros::Duration &minDuration = {0, 0}, const ::ros::Duration &maxDuration = ::ros::DURATION_MAX, double tolerance = 0.1, size_t windowSize = 5u, bool noEventsIsOk = true)

Create the diagnostic task for a header-less message (checking frequency only).

Template Parameters:

M – SFINAE only. Do not set explicitly.

Parameters:
  • name[in] Name of the diagnostic task.

  • minDuration[in] Minimum allowed duration.

  • maxDuration[in] Maximum allowed duration.

  • tolerance[in] Tolerance of duration.

  • windowSize[in] Number of updates during which the duration is computed.

  • noEventsIsOk[in] Whether it should be treated as correct if there was no event during an update window.

DurationStatus(const ::std::string &name, const ::cras::SimpleDurationStatusParam &params)

Create the diagnostic task checking frequency of messages and timestamp delay (if the message has header).

Parameters:
  • name[in] Name of the diagnostic task.

  • params[in] Parameters of the task.

DurationStatus(const ::std::string &name, const ::cras::BoundParamHelperPtr &params, const ::cras::DurationStatusParam &defaultParams)
DurationStatus(const ::std::string &name, const ::cras::BoundParamHelperPtr &params, const ::cras::SimpleDurationStatusParam &defaultParams)
~DurationStatus() override
void start(const ::ros::Time &time = ::ros::Time::now())

Start a single duration measurement.

Parameters:

time[in] Time of start.

void start(const ::ros::WallTime &time)

Start a single duration measurement.

Parameters:

time[in] Time of start.

void stop(const ::ros::Time &time = ::ros::Time::now())

Stop a single duration measurement.

Parameters:

time[in] Time of end.

void stop(const ::ros::WallTime &time)

Stop a single duration measurement.

Parameters:

time[in] Time of end.

void run(::diagnostic_updater::DiagnosticStatusWrapper &stat) override
const ::ros::Duration &getMinDuration() const

Minimum allowed duration.

Returns:

The duration.

const ::ros::Duration &getMaxDuration() const

Maximum allowed duration.

Returns:

The duration.

double getTolerance() const

Tolerance of duration.

Returns:

The tolerance (0.0 means exact match of the duration limits).

size_t getWindowSize() const

Number of updates during which the duration is computed.

Returns:

The window size.

Protected Attributes

::cras::DurationStatusParam params

The parameters via which this task has been configured.

bool wallTimeMode = {false}
size_t count = {0u}
::cras::RunningStats<::ros::Duration> stats
::cras::optional<::ros::Time> lastStartTime
::std::vector<::ros::Duration> minDurations
::std::vector<::ros::Duration> maxDurations
::std::vector<::ros::Time> historyTimes
::std::vector<::cras::RunningStats<::ros::Duration>> historyStats
size_t historyIndex = {0u}
::std::mutex lock