Public Member Functions | Private Attributes
swri::OptionalDiagnosedPublisher< T > Class Template Reference

#include <optional_diagnosed_publisher.h>

Inheritance diagram for swri::OptionalDiagnosedPublisher< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 OptionalDiagnosedPublisher (const ros::Publisher &pub, diagnostic_updater::Updater &diag, const diagnostic_updater::FrequencyStatusParam &freq, const diagnostic_updater::TimeStampStatusParam &stamp)
virtual void run (diagnostic_updater::DiagnosticStatusWrapper &stat)
virtual void setEnabled (bool enabled)
virtual ~OptionalDiagnosedPublisher ()

Private Attributes

bool is_diagnostic_enabled_

Detailed Description

template<class T>
class swri::OptionalDiagnosedPublisher< T >

The DiagnosedPublisher class is handy, but it has on problem: it can't be turned off. If you ever stop publishing, it will flag an error because your publish rate is 0. If you are intentionally not publishing because you don't have any subscribers in order to avoid unnecessary processing, that is inconvenient.

This class simply wraps the DiagnosedPublisher and adds a setEnabled method that can be used to enable or disable it. When disabled, it will simply publish a diagnostic with an "OK" status.

In theory it could dynamically determine whether you have subscribers or not and change it status based on that, but that might not be what you want in the event that you don't have subscribers but still have some kind of error to report.

Template Parameters:
TThe type of message being published.

Definition at line 54 of file optional_diagnosed_publisher.h.


Constructor & Destructor Documentation

Definition at line 57 of file optional_diagnosed_publisher.h.

template<class T >
virtual swri::OptionalDiagnosedPublisher< T >::~OptionalDiagnosedPublisher ( ) [inline, virtual]

Definition at line 65 of file optional_diagnosed_publisher.h.


Member Function Documentation

template<class T >
virtual void swri::OptionalDiagnosedPublisher< T >::run ( diagnostic_updater::DiagnosticStatusWrapper stat) [inline, virtual]

Reimplemented from diagnostic_updater::CompositeDiagnosticTask.

Definition at line 68 of file optional_diagnosed_publisher.h.

template<class T >
virtual void swri::OptionalDiagnosedPublisher< T >::setEnabled ( bool  enabled) [inline, virtual]

Controls whether the diagnostic for this publisher is enabled.

Parameters:
enabled"true" to enable the diagnostic.

Definition at line 87 of file optional_diagnosed_publisher.h.


Member Data Documentation

template<class T >
bool swri::OptionalDiagnosedPublisher< T >::is_diagnostic_enabled_ [private]

Definition at line 93 of file optional_diagnosed_publisher.h.


The documentation for this class was generated from the following file:


swri_roscpp
Author(s):
autogenerated on Tue Oct 3 2017 03:19:27