Public Member Functions | Private Attributes | List of all members
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]

Public Member Functions

virtual bool addAnalyzer (boost::shared_ptr< Analyzer > &analyzer)
 Add an analyzer to this analyzerGroup. More...
 
virtual bool analyze (const boost::shared_ptr< StatusItem > item)
 Analyze returns true if any sub-analyzers will analyze an item. More...
 
 AnalyzerGroup ()
 
virtual std::string getName () const
 Returns nice name for display. (ex: 'Sensors') More...
 
virtual std::string getPath () const
 Returns full prefix of analyzer. (ex: '/Robot/Sensors') More...
 
virtual bool init (const std::string base_path, const ros::NodeHandle &n)
 Initialized with base path and namespace. More...
 
virtual bool match (const std::string name)
 Match returns true if any sub-analyzers match an item. More...
 
virtual bool removeAnalyzer (boost::shared_ptr< Analyzer > &analyzer)
 Remove an analyzer from this analyzerGroup. More...
 
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. More...
 
void resetMatches ()
 Clear match arrays. Used when analyzers are added or removed. More...
 
virtual ~AnalyzerGroup ()
 
- Public Member Functions inherited from diagnostic_aggregator::Analyzer
 Analyzer ()
 Default constructor, called by pluginlib. More...
 
virtual ~Analyzer ()
 

Private Attributes

pluginlib::ClassLoader< Analyzeranalyzer_loader_
 Loads Analyzer plugins in "analyzers" namespace. More...
 
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. More...
 
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

diagnostic_aggregator::AnalyzerGroup::AnalyzerGroup ( )
AnalyzerGroup::~AnalyzerGroup ( )
virtual

Definition at line 164 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 169 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 220 of file analyzer_group.cpp.

virtual std::string diagnostic_aggregator::AnalyzerGroup::getName ( ) const
inlinevirtual

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
inlinevirtual

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

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

Remove an analyzer from this analyzerGroup.

!

Definition at line 175 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 235 of file analyzer_group.cpp.

void AnalyzerGroup::resetMatches ( )

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

Definition at line 214 of file analyzer_group.cpp.

Member Data Documentation

pluginlib::ClassLoader<Analyzer> diagnostic_aggregator::AnalyzerGroup::analyzer_loader_
private

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.

std::string diagnostic_aggregator::AnalyzerGroup::nice_name_
private

Definition at line 159 of file analyzer_group.h.

std::string diagnostic_aggregator::AnalyzerGroup::path_
private

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 Thu Oct 8 2020 03:19:28