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
-
T | The type of message being published. |
Definition at line 54 of file optional_diagnosed_publisher.h.