$search

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 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 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.
virtual ~AnalyzerGroup ()

Private Attributes

pluginlib::ClassLoader< Analyzeranalyzer_loader_
 Loads Analyzer plugins in "analyzers" namespace.
std::vector< 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 109 of file analyzer_group.h.


Constructor & Destructor Documentation

diagnostic_aggregator::AnalyzerGroup::AnalyzerGroup (  ) 
AnalyzerGroup::~AnalyzerGroup (  )  [virtual]

Definition at line 163 of file analyzer_group.cpp.


Member Function Documentation

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 198 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 140 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 138 of file analyzer_group.h.

virtual bool diagnostic_aggregator::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.

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

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

Implements diagnostic_aggregator::Analyzer.

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 213 of file analyzer_group.cpp.


Member Data Documentation

Loads Analyzer plugins in "analyzers" namespace.

Definition at line 148 of file analyzer_group.h.

Definition at line 155 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 153 of file analyzer_group.h.

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

Definition at line 160 of file analyzer_group.h.

Definition at line 143 of file analyzer_group.h.

Definition at line 143 of file analyzer_group.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends


diagnostic_aggregator
Author(s): Kevin Watts
autogenerated on Wed Jan 30 11:30:57 2013