Public Member Functions | Private Attributes | List of all members
swri::OptionalDiagnosedPublisher< T > Class Template Reference

#include <optional_diagnosed_publisher.h>

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

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 ()
 
- Public Member Functions inherited from diagnostic_updater::DiagnosedPublisher< T >
 DiagnosedPublisher (const ros::Publisher &pub, diagnostic_updater::Updater &diag, const diagnostic_updater::FrequencyStatusParam &freq, const diagnostic_updater::TimeStampStatusParam &stamp)
 
ros::Publisher getPublisher () const
 
virtual void publish (const T &message)
 
virtual void publish (const boost::shared_ptr< T > &message)
 
void setPublisher (ros::Publisher pub)
 
virtual ~DiagnosedPublisher ()
 
- Public Member Functions inherited from diagnostic_updater::TopicDiagnostic
virtual void tick ()
 
virtual void tick (const ros::Time &stamp)
 
 TopicDiagnostic (std::string name, diagnostic_updater::Updater &diag, const diagnostic_updater::FrequencyStatusParam &freq, const diagnostic_updater::TimeStampStatusParam &stamp)
 
virtual ~TopicDiagnostic ()
 
- Public Member Functions inherited from diagnostic_updater::HeaderlessTopicDiagnostic
virtual void clear_window ()
 
 HeaderlessTopicDiagnostic (std::string name, diagnostic_updater::Updater &diag, const diagnostic_updater::FrequencyStatusParam &freq)
 
virtual ~HeaderlessTopicDiagnostic ()
 
- Public Member Functions inherited from diagnostic_updater::CompositeDiagnosticTask
void addTask (DiagnosticTask *t)
 
 CompositeDiagnosticTask (const std::string name)
 
- Public Member Functions inherited from diagnostic_updater::DiagnosticTask
 DiagnosticTask (const std::string name)
 
const std::string & getName ()
 
virtual ~DiagnosticTask ()
 

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

◆ OptionalDiagnosedPublisher()

Definition at line 57 of file optional_diagnosed_publisher.h.

◆ ~OptionalDiagnosedPublisher()

template<class T >
virtual swri::OptionalDiagnosedPublisher< T >::~OptionalDiagnosedPublisher ( )
inlinevirtual

Definition at line 65 of file optional_diagnosed_publisher.h.

Member Function Documentation

◆ run()

template<class T >
virtual void swri::OptionalDiagnosedPublisher< T >::run ( diagnostic_updater::DiagnosticStatusWrapper stat)
inlinevirtual

Reimplemented from diagnostic_updater::CompositeDiagnosticTask.

Definition at line 68 of file optional_diagnosed_publisher.h.

◆ setEnabled()

template<class T >
virtual void swri::OptionalDiagnosedPublisher< T >::setEnabled ( bool  enabled)
inlinevirtual

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

◆ is_diagnostic_enabled_

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 Sat Jan 21 2023 03:13:16