Public Member Functions | Private Attributes
diagnostic_aggregator::AnalyzerGroup Class Reference

Allows analyzers to be grouped together, or used as sub-analyzers. More...

#include <analyzer_group.h>

Inheritance diagram for diagnostic_aggregator::AnalyzerGroup:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual bool addAnalyzer (boost::shared_ptr< Analyzer > &analyzer)
 Add an analyzer to this analyzerGroup.
virtual bool analyze (const boost::shared_ptr< StatusItem > item)
 Analyze returns true if any sub-analyzers will analyze an item.
 AnalyzerGroup ()
virtual std::string getName () const
 Returns nice name for display. (ex: 'Sensors')
virtual std::string getPath () const
 Returns full prefix of analyzer. (ex: '/Robot/Sensors')
virtual bool init (const std::string base_path, const ros::NodeHandle &n)
 Initialized with base path and namespace.
virtual bool match (const std::string name)
 Match returns true if any sub-analyzers match an item.
virtual bool removeAnalyzer (boost::shared_ptr< Analyzer > &analyzer)
 Remove an analyzer from this analyzerGroup.
virtual std::vector
< boost::shared_ptr
< diagnostic_msgs::DiagnosticStatus > > 
report ()
 The processed output is the combined output of the sub-analyzers, and the top level status.
void resetMatches ()
 Clear match arrays. Used when analyzers are added or removed.
virtual ~AnalyzerGroup ()

Private Attributes

pluginlib::ClassLoader< Analyzeranalyzer_loader_
 Loads Analyzer plugins in "analyzers" namespace.
std::vector< boost::shared_ptr
< Analyzer > > 
analyzers_
std::vector< boost::shared_ptr
< StatusItem > > 
aux_items_
 These items store errors, if any, for analyzers that failed to initialize or load.
std::map< const std::string,
std::vector< bool > > 
matched_
std::string nice_name_
std::string path_

Detailed Description

Allows analyzers to be grouped together, or used as sub-analyzers.

The AnalyzerGroup is used by the diagnostic aggregator internally to load and handle analyzers. It can be used as a normal analyzer plugin to allow analyzers to become "sub-analyzers", or move as a group.

The "sub-analyzers" are initialized using parameters in the "~analyzers" namespace of the AnalyzerGroup. The "type" parameters determines the analyzer type.

Example initialization:

 *  sensors:
 *  type: AnalyzerGroup
 *  path: Sensors
 *  analyzers:
 *    base_hk:
 *      type: GenericAnalyzer
 *      path: Base Hokuyo
 *      timeout: 5.0
 *      find_and_remove_prefix: base_hokuyo_node
 *      num_items: 3
 *    tilt_hk:
 *      type: GenericAnalyzer
 *      path: Tilt Hokuyo
 *      timeout: 5.0
 *      find_and_remove_prefix: tilt_hokuyo_node
 *      num_items: 3
 *    imu:
 *      type: GenericAnalyzer
 *      path: IMU
 *      timeout: 5.0
 *      find_and_remove_prefix: imu_node
 *      num_items: 3
 *

Each namespace below "analyzers" describes a new Analyzer that will be loaded as a sub-analyzer. Any analyzer that fails to initialize or loads incorrectly will generate an error in the console output, and a special diagnostic item in the output of the AnalyzerGroup that describes the error.

In the above example, the AnalyzerGroup will have three sub-analyzers. The AnalyzerGroup will report a DiagnosticStatus message in the processed output with the name "Sensors" (the top-level state). The "Sensors" message will have the level of the highest of the sub-analyzers, or the highest of "Sensors/Base Hokuyo", "Sensors/Tilt Hokuyo" and "Sensors/IMU". The state of any other items, like "Sensors/IMU/Connection" won't matter to the AnalyzerGroup.

The Aggregator uses the AnalyzerGroup internally to load and update analyzers.

Definition at line 110 of file analyzer_group.h.


Constructor & Destructor Documentation

Definition at line 161 of file analyzer_group.cpp.


Member Function Documentation

bool AnalyzerGroup::addAnalyzer ( boost::shared_ptr< Analyzer > &  analyzer) [virtual]

Add an analyzer to this analyzerGroup.

!

Definition at line 166 of file analyzer_group.cpp.

bool AnalyzerGroup::analyze ( const boost::shared_ptr< StatusItem item) [virtual]

Analyze returns true if any sub-analyzers will analyze an item.

Implements diagnostic_aggregator::Analyzer.

Definition at line 217 of file analyzer_group.cpp.

virtual std::string diagnostic_aggregator::AnalyzerGroup::getName ( ) const [inline, virtual]

Returns nice name for display. (ex: 'Sensors')

Implements diagnostic_aggregator::Analyzer.

Definition at line 156 of file analyzer_group.h.

virtual std::string diagnostic_aggregator::AnalyzerGroup::getPath ( ) const [inline, virtual]

Returns full prefix of analyzer. (ex: '/Robot/Sensors')

Implements diagnostic_aggregator::Analyzer.

Definition at line 154 of file analyzer_group.h.

bool AnalyzerGroup::init ( const std::string  base_path,
const ros::NodeHandle n 
) [virtual]

Initialized with base path and namespace.

The parameters in its namespace determine the sub-analyzers.

Implements diagnostic_aggregator::Analyzer.

Definition at line 51 of file analyzer_group.cpp.

bool AnalyzerGroup::match ( const std::string  name) [virtual]

Match returns true if any sub-analyzers match an item.

Implements diagnostic_aggregator::Analyzer.

Definition at line 183 of file analyzer_group.cpp.

bool AnalyzerGroup::removeAnalyzer ( boost::shared_ptr< Analyzer > &  analyzer) [virtual]

Remove an analyzer from this analyzerGroup.

!

Definition at line 172 of file analyzer_group.cpp.

vector< boost::shared_ptr< diagnostic_msgs::DiagnosticStatus > > AnalyzerGroup::report ( ) [virtual]

The processed output is the combined output of the sub-analyzers, and the top level status.

Implements diagnostic_aggregator::Analyzer.

Definition at line 232 of file analyzer_group.cpp.

Clear match arrays. Used when analyzers are added or removed.

Definition at line 211 of file analyzer_group.cpp.


Member Data Documentation

Loads Analyzer plugins in "analyzers" namespace.

Definition at line 164 of file analyzer_group.h.

std::vector<boost::shared_ptr<Analyzer> > diagnostic_aggregator::AnalyzerGroup::analyzers_ [private]

Definition at line 171 of file analyzer_group.h.

std::vector<boost::shared_ptr<StatusItem> > diagnostic_aggregator::AnalyzerGroup::aux_items_ [private]

These items store errors, if any, for analyzers that failed to initialize or load.

Definition at line 169 of file analyzer_group.h.

std::map<const std::string, std::vector<bool> > diagnostic_aggregator::AnalyzerGroup::matched_ [private]

Definition at line 176 of file analyzer_group.h.

Definition at line 159 of file analyzer_group.h.

Definition at line 159 of file analyzer_group.h.


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


diagnostic_aggregator
Author(s): Kevin Watts, Brice Rebsamen
autogenerated on Mon Aug 14 2017 02:51:54