Base class of all Analyzers. Loaded by aggregator. More...
#include <analyzer.h>
Public Member Functions | |
virtual bool | analyze (const boost::shared_ptr< StatusItem > item)=0 |
Returns true if analyzer will analyze this name. More... | |
Analyzer () | |
Default constructor, called by pluginlib. More... | |
virtual std::string | getName () const =0 |
Returns nice name for display. (ex: 'Sensors') More... | |
virtual std::string | getPath () const =0 |
Returns full prefix of analyzer. (ex: '/Robot/Sensors') More... | |
virtual bool | init (const std::string base_path, const ros::NodeHandle &n)=0 |
Analyzer is initialized with base path and namespace. More... | |
virtual bool | match (const std::string name)=0 |
Returns true if analyzer will handle this item. More... | |
virtual std::vector< boost::shared_ptr< diagnostic_msgs::DiagnosticStatus > > | report ()=0 |
Analysis function, output processed data. More... | |
virtual | ~Analyzer () |
Base class of all Analyzers. Loaded by aggregator.
Base class, for all Analyzers loaded by pluginlib. All analyzers must implement these functions: init, match, analyze, report, getPath and getName.
Analyzers must output their data in a vector of DiagnosticStatus messages when the report() function is called. Each DiagnosticStatus message name should be prepended by the path of the Analyzer. The path is "BASE_PATH/MY_PATH" for each analyzer. For example:
EtherCAT Device (head_pan_motor) EtherCAT Device (head_tilt_motor) --- PATH/EtherCAT Device (head_pan_motor) PATH/EtherCAT Device (head_tilt_motor) PATH/EtherCAT Devices *
Analyzers generally also output another DiagnosticStatus message for the "header", with the name BASE_PATH/MY_PATH, as in the example above ("PATH/EtherCAT Devices").
For each new DiagnosticStatus name received, the analyzer will be asked whether it wants view the message using "match(string name)". If the analyzer wants to view the message, all future messages with that name will be given to the analyzer, using "analyze(item)".
If an analyzer is given a message to analyze, it should return true only if it will report that status value. For example, an Analyzer may look at all the messages for robots motors and power, but will only report messages on motors. This allows Analyzers to use data from other sections of the robot in reporting data.
Since the match() function is called only when new DiagnosticStatus names arrive, the analyzers are not allowed to change which messages they want to look at.
Definition at line 117 of file analyzer.h.
|
inline |
Default constructor, called by pluginlib.
Definition at line 155 of file analyzer.h.
|
inlinevirtual |
Definition at line 157 of file analyzer.h.
|
pure virtual |
Returns true if analyzer will analyze this name.
This is called with every new item that an analyzer matches. Analyzers should only return "true" if they will report the value of this item. If it is only looking at an item, it should return false.
Implemented in diagnostic_aggregator::AnalyzerGroup, diagnostic_aggregator::GenericAnalyzerBase, and diagnostic_aggregator::IgnoreAnalyzer.
|
pure virtual |
Returns nice name for display. (ex: 'Sensors')
Implemented in diagnostic_aggregator::GenericAnalyzerBase, diagnostic_aggregator::AnalyzerGroup, and diagnostic_aggregator::IgnoreAnalyzer.
|
pure virtual |
Returns full prefix of analyzer. (ex: '/Robot/Sensors')
Implemented in diagnostic_aggregator::GenericAnalyzerBase, diagnostic_aggregator::AnalyzerGroup, and diagnostic_aggregator::IgnoreAnalyzer.
|
pure virtual |
Analyzer is initialized with base path and namespace.
The Analyzer initialized with parameters in its given namespace. The "base_path" is common to all analyzers, and needs to be prepended to all DiagnosticStatus names.
base_path | : Common to all analyzers, prepended to all processed names. Starts with "/". |
n | : NodeHandle with proper private namespace for analyzer. |
Implemented in diagnostic_aggregator::GenericAnalyzerBase, diagnostic_aggregator::GenericAnalyzer, diagnostic_aggregator::AnalyzerGroup, diagnostic_aggregator::OtherAnalyzer, and diagnostic_aggregator::IgnoreAnalyzer.
|
pure virtual |
Returns true if analyzer will handle this item.
Match is called once for each new status name, so this return value cannot change with time.
Implemented in diagnostic_aggregator::OtherAnalyzer, diagnostic_aggregator::GenericAnalyzerBase, diagnostic_aggregator::GenericAnalyzer, diagnostic_aggregator::AnalyzerGroup, and diagnostic_aggregator::IgnoreAnalyzer.
|
pure virtual |
Analysis function, output processed data.
report is called at 1Hz intervals. Analyzers should return a vector of processed DiagnosticStatus messages.
Implemented in diagnostic_aggregator::GenericAnalyzer, diagnostic_aggregator::AnalyzerGroup, diagnostic_aggregator::GenericAnalyzerBase, diagnostic_aggregator::OtherAnalyzer, diagnostic_aggregator::IgnoreAnalyzer, and diagnostic_aggregator::DiscardAnalyzer.