|
From: <wa...@us...> - 2009-08-26 20:45:03
|
Revision: 23018
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=23018&view=rev
Author: wattsk
Date: 2009-08-26 20:44:56 +0000 (Wed, 26 Aug 2009)
Log Message:
-----------
diagnostics 0.1 commit. Removed diagnostic_analyzer/generic_analyzer and integrated into diagnostic_aggregator.
Modified Paths:
--------------
pkg/trunk/robot_descriptions/pr2/pr2_configurations/pr2_head_cart/manifest.xml
pkg/trunk/stacks/diagnostics/CMakeLists.txt
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/CMakeLists.txt
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_aggregator.h
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/mainpage.dox
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/manifest.xml
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/diagnostic_aggregator.cpp
pkg/trunk/stacks/diagnostics/diagnostic_updater/manifest.xml
pkg/trunk/stacks/diagnostics/diagnostics_analysis/manifest.xml
pkg/trunk/stacks/diagnostics/robot_monitor/manifest.xml
pkg/trunk/stacks/diagnostics/runtime_monitor/manifest.xml
pkg/trunk/stacks/diagnostics/self_test/manifest.xml
pkg/trunk/stacks/diagnostics/stack.xml
pkg/trunk/stacks/pr2/pr2_alpha/manifest.xml
Added Paths:
-----------
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/generic_analyzer_plugin.xml
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_analyzer.h
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_item.h
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer.h
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/diagnostic_item.cpp
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/generic_analyzer.cpp
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/plugin_list.cpp
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/test/
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/test/analyzers.yaml
pkg/trunk/stacks/diagnostics/diagnostic_aggregator/test/cpp_agg.launch
Removed Paths:
-------------
pkg/trunk/stacks/diagnostics/diagnostic_analyzer/
pkg/trunk/stacks/diagnostics/generic_analyzer/
Modified: pkg/trunk/robot_descriptions/pr2/pr2_configurations/pr2_head_cart/manifest.xml
===================================================================
--- pkg/trunk/robot_descriptions/pr2/pr2_configurations/pr2_head_cart/manifest.xml 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/robot_descriptions/pr2/pr2_configurations/pr2_head_cart/manifest.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -17,7 +17,6 @@
<depend package="pr2_computer_monitor" />
<depend package="pr2_power_board" />
<depend package="mechanism_bringup" />
- <depend package="generic_analyzer" />
<depend package="diagnostic_aggregator" />
<depend package="robot_mechanism_controllers" />
<depend package="pr2_mechanism_controllers" />
Modified: pkg/trunk/stacks/diagnostics/CMakeLists.txt
===================================================================
--- pkg/trunk/stacks/diagnostics/CMakeLists.txt 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/CMakeLists.txt 2009-08-26 20:44:56 UTC (rev 23018)
@@ -16,6 +16,6 @@
# variables.
#list(APPEND CPACK_SOURCE_IGNORE_FILES /core/experimental)
-rosbuild(hardware_test 0.1.0)
+rosbuild(diagnostics 0.1.0)
# After next ROS release, change to new macro
#rosbuild_make_distribution(0.1.0)
Modified: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/CMakeLists.txt
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/CMakeLists.txt 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/CMakeLists.txt 2009-08-26 20:44:56 UTC (rev 23018)
@@ -22,6 +22,9 @@
#gensrv()
rospack_add_library(diagnostic_aggregator
+ src/plugin_list.cpp
+ src/generic_analyzer.cpp
+ src/diagnostic_item.cpp
src/diagnostic_aggregator.cpp)
Added: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/generic_analyzer_plugin.xml
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/generic_analyzer_plugin.xml (rev 0)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/generic_analyzer_plugin.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -0,0 +1,7 @@
+<library path="lib/libdiagnostic_aggregator" >
+ <class name="GenericAnalyzer" type="diagnostic_analyzer::GenericAnalyzer" base_class_type="diagnostic_analyzer::DiagnosticAnalyzer">
+ <description>
+ GenericAnalyzer is default diagnostic analyzer.
+ </description>
+ </class>
+</library>
Modified: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_aggregator.h
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_aggregator.h 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_aggregator.h 2009-08-26 20:44:56 UTC (rev 23018)
@@ -47,11 +47,11 @@
#include <diagnostic_msgs/KeyValue.h>
#include "XmlRpcValue.h"
#include "pluginlib/class_loader.h"
-#include "diagnostic_analyzer/diagnostic_analyzer.h"
-#include "diagnostic_analyzer/diagnostic_item.h"
+#include "diagnostic_aggregator/diagnostic_analyzer.h"
+#include "diagnostic_aggregator/diagnostic_item.h"
+#include "diagnostic_aggregator/generic_analyzer.h"
-
namespace diagnostic_aggregator {
/*!
@@ -112,6 +112,9 @@
*/
void init();
+ /*!
+ *\brief Callback for "/diagnostics"
+ */
void diagCallback(const diagnostic_msgs::DiagnosticArray::ConstPtr& diag_msg);
/*!
Added: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_analyzer.h
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_analyzer.h (rev 0)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_analyzer.h 2009-08-26 20:44:56 UTC (rev 23018)
@@ -0,0 +1,116 @@
+/*********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2009, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of the Willow Garage nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *********************************************************************/
+
+// Author: Kevin Watts
+
+#ifndef DIAGNOSTIC_ANALYZER_H
+#define DIAGNOSTIC_ANALYZER_H
+
+#include <map>
+#include <vector>
+#include <ros/ros.h>
+#include <diagnostic_msgs/DiagnosticStatus.h>
+#include <diagnostic_msgs/KeyValue.h>
+#include "diagnostic_aggregator/diagnostic_item.h"
+
+namespace diagnostic_analyzer {
+
+/*!
+ *\brief Base class of all DiagnosticAnalyzers. Loaded by aggregator.
+ *
+ * Base class, loaded by pluginlib. All analyzers must implement these
+ * functions: init, analyze, getPrefix and getName.
+ *
+ * Analyzers must output their data in a tree structure. The tree branches
+ * are marked by '/' in the DiagnosticStatus name of the output.
+ *
+ * Each analyzer should output a "base" DiagnosticStatus, with the name of
+ * "first_prefix/second_prefix" (ex: "/Robot/Motors")
+ *
+ */
+class DiagnosticAnalyzer
+{
+public:
+ /*!
+ *\brief Default constructor, called by pluginlib.
+ */
+ DiagnosticAnalyzer() {}
+
+ virtual ~DiagnosticAnalyzer() {}
+
+ /*!
+ *\brief DiagnosticAnalyzer is initialized with first prefix and namespace.
+ *
+ * The DiagnosticAnalyzer initialized with parameters in its given
+ * namespace. The "first_prefix" is common to all analyzers, and needs to be
+ * prepended to all DiagnosticStatus names.
+ *\param first_prefix : Common to all analyzers, prepended to all processed names. Starts with "/".
+ *\param n : NodeHandle with proper private namespace for analyzer.
+ */
+ virtual bool init(std::string first_prefix, const ros::NodeHandle &n)
+ {
+ ROS_FATAL("DiagnosticAnalyzer did not implement the init function");
+ ROS_BREAK();
+ return false;
+ }
+
+ /*!
+ *\brief Analysis function, output processed data.
+ *
+ *\param msgs : The input map of messages, by status name. StatusPair stores message, count++ if analyzed. Returned array must be deleted by aggregator.
+ */
+ virtual std::vector<diagnostic_msgs::DiagnosticStatus*> analyze(std::map<std::string, diagnostic_item::DiagnosticItem*> msgs)
+ {
+ ROS_FATAL("DiagnosticAnalyzer did not implement the analyze function");
+ ROS_BREAK();
+
+ std::vector<diagnostic_msgs::DiagnosticStatus*> my_vec;
+ return my_vec;
+ }
+
+ /*!
+ *\brief Returns full prefix of analyzer. (ex: '/Robot/Sensors')
+ */
+ virtual std::string getPrefix() { return ""; }
+
+ /*!
+ *\brief Returns nice name for display. (ex: 'Sensors')
+ */
+ virtual std::string getName() { return ""; }
+
+};
+
+}
+
+#endif //DIAGNOSTIC_ANALYZER_H
Added: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_item.h
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_item.h (rev 0)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/diagnostic_item.h 2009-08-26 20:44:56 UTC (rev 23018)
@@ -0,0 +1,120 @@
+/*********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2009, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of the Willow Garage nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *********************************************************************/
+
+// Author: Kevin Watts
+
+#ifndef DIAGNOSTIC_ITEM_H
+#define DIAGNOSTIC_ITEM_H
+
+#include <map>
+#include <string>
+#include <vector>
+#include <ros/ros.h>
+#include <diagnostic_msgs/DiagnosticStatus.h>
+#include <diagnostic_msgs/KeyValue.h>
+
+namespace diagnostic_item {
+
+/*!
+ *\brief Helper class to hold, store DiagnosticStatus messages
+ *
+ * The DiagnosticItem class is used by the DiagnosticAggregator to store
+ * incoming DiagnosticStatus messages. An item stores whether it has been
+ * examined by an analyzer. After it has been converted to a DiagnosticStatus
+ * message with the "toStatusMsg()" functions, it has been "checked". This
+ * is important for processing the "remainder" of DiagnosticStatus messages,
+ * those that haven't been analyzed by other analyzers.
+ */
+class DiagnosticItem
+{
+public:
+ /*!
+ *\brief Constructed from DiagnosticStatus*
+ */
+ DiagnosticItem(const diagnostic_msgs::DiagnosticStatus *status);
+ ~DiagnosticItem();
+
+ /*!
+ *\brief Must have same name as originial status or it won't update.
+ */
+ void update(const diagnostic_msgs::DiagnosticStatus *status);
+
+ /*!
+ *\brief Sets hasChecked() to true
+ */
+ diagnostic_msgs::DiagnosticStatus *toStatusMsg();
+
+ /*!
+ *\brief Sets hasChecked() to true, prepends "prefix/" to name.
+ *
+ *\param prefix : Prepended to name
+ *\param stale : If true, status level is 3
+ */
+ diagnostic_msgs::DiagnosticStatus *toStatusMsg(std::string prefix, bool stale);
+
+ /*
+ *\brief Returns level of DiagnosticStatus message
+ */
+ int8_t getLevel();
+
+ /*!
+ *\brief Message field of DiagnosticStatus
+ */
+ std::string getMessage();
+
+ /*!
+ *\brief Returns name of status
+ */
+ std::string getName();
+
+ /*!
+ *\brief True if item has been converted to DiagnosticStatus
+ */
+ bool hasChecked();
+
+private:
+ bool checked_;
+
+ int8_t level_;
+ std::string output_name_; /**< name_ w/o "/" */
+ std::string name_;
+ std::string message_;
+ std::string hw_id_;
+ std::vector<diagnostic_msgs::KeyValue> values_;
+
+};
+
+}
+
+#endif //DIAGNOSTIC_ITEM_H
Added: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer.h
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer.h (rev 0)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/include/diagnostic_aggregator/generic_analyzer.h 2009-08-26 20:44:56 UTC (rev 23018)
@@ -0,0 +1,160 @@
+/*********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2009, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of the Willow Garage nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *********************************************************************/
+
+// Author: Kevin Watts
+
+#ifndef GENERIC_ANALYZER_H
+#define GENERIC_ANALYZER_H
+
+#include <map>
+#include <ros/ros.h>
+#include <vector>
+#include <string>
+#include "diagnostic_msgs/DiagnosticStatus.h"
+#include "diagnostic_msgs/KeyValue.h"
+#include "diagnostic_aggregator/diagnostic_analyzer.h"
+#include "diagnostic_aggregator/diagnostic_item.h"
+#include "XmlRpcValue.h"
+
+namespace diagnostic_analyzer {
+
+/*!
+ *\brief GenericAnalyzer is most basic DiagnosticAnalyzer
+ *
+ * GenericAnalyzer analyzes diagnostics from list of topics and returns
+ * processed diagnostics data. All analyzed status messages are prepended with
+ * '/FirstPrefix/SecondPrefix', where FirstPrefix is common to all analyzers
+ * (ex: 'PRE') and SecondPrefix is from this analyzer (ex: 'Power System').
+ */
+class GenericAnalyzer : public DiagnosticAnalyzer
+{
+
+public:
+ /*!
+ *\brief Default constructor loaded by pluginlib
+ */
+ GenericAnalyzer();
+
+
+ ~GenericAnalyzer();
+
+ /*!
+ *\brief Initializes GenericAnalyzer from namespace
+ *
+ * NodeHandle is given private namespace to initialize (ex: ~Sensors)
+ * Parameters of NodeHandle must follow this form. See DiagnosticAggregator
+ * for instructions on passing these to the aggregator.
+ *\verbatim
+ * PowerSystem:
+ * type: GenericAnalyzer
+ * prefix: Power System
+ * expected: [
+ * 'IBPS 0',
+ * 'IBPS 1']
+ * startswith: [
+ * 'Smart Battery']
+ * name: [
+ * 'Power Node 1018']
+ * contains: [
+ * 'Battery']
+ *\endverbatim
+ *
+ *\param first_prefix : Prefix for all analyzers (ex: 'Robot')
+ *\param n : NodeHandle in full namespace
+ */
+ bool init(std::string first_prefix, const ros::NodeHandle &n);
+
+ /*!
+ *\brief Initializes analyzer to deal with remaining data
+ *
+ * After all analyzers have been created this analyzer is created to
+ * process all remaining messages. It will prepend "first_prefix/Other"
+ * to all messages that haven't been handled by other analyzers.
+ * The "Other" analyzer is created automatically by the aggregator.
+ */
+ bool initOther(std::string first_prefix);
+
+ /*!
+ *\brief Analyzes DiagnosticStatus messages
+ *
+ */
+ std::vector<diagnostic_msgs::DiagnosticStatus*> analyze(std::map<std::string, diagnostic_item::DiagnosticItem*> msgs);
+
+ /*!
+ *\brief Returns full prefix (ex: "/Robot/Power System")
+ */
+ std::string getPrefix() { return full_prefix_; }
+
+ /*!
+ *\brief Returns nice name (ex: "Power System")
+ */
+ std::string getName() { return nice_name_; }
+
+private:
+ bool other_; /**< True if analyzer is supposed to analyze remaining messages */
+
+ std::string nice_name_;
+ std::string full_prefix_;
+
+ std::vector<std::string> expected_;
+ std::vector<std::string> startswith_;
+ std::vector<std::string> contains_;
+ std::vector<std::string> name_;
+
+ /*!
+ *\brief Stores items by name
+ */
+ std::map<std::string, diagnostic_item::DiagnosticItem*> items_;
+
+ /*!
+ *\brief Updates items_ with messages to analyze. Deletes to_analyze param.
+ */
+ void updateItems(std::vector<diagnostic_msgs::DiagnosticStatus*> to_analyze);
+
+ /*!
+ *\brief Returns items to be analyzed (items that haven't been already)
+ */
+ std::vector<diagnostic_msgs::DiagnosticStatus*> toAnalyzeOther(std::map<std::string, diagnostic_item::DiagnosticItem*> msgs);
+
+ /*!
+ *\brief Returns items that need to be analyzed
+ */
+ std::vector<diagnostic_msgs::DiagnosticStatus*> toAnalyze(std::map<std::string, diagnostic_item::DiagnosticItem*> msgs);
+
+
+};
+
+
+}
+#endif //GENERIC_ANALYZER_H
Modified: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/mainpage.dox
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/mainpage.dox 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/mainpage.dox 2009-08-26 20:44:56 UTC (rev 23018)
@@ -4,7 +4,6 @@
\b diagnostic_aggregator aggregates and performs basic analysis on the diagnostics of a robot. This package consists of the base node, or aggregator, and several analyzers to collect and process diagnostics data.
-
\section codeapi Code API
The DiagnosticAggregator class loads "analyzers" which perform analysis on the incoming diagnostics data. Each analyzer is initialized by an XML node by the aggregator.
@@ -18,38 +17,67 @@
Forms a tree with the trunk "Robot" and the child branch "Motors" and the grandchild "EtherCAT Device (head_tilt_motor)". This allows graphical display of diagnostics data.
-The aggregator will publish the DiagnosticArray on the /diagnostics_agg topic at 1 Hz.
+The aggregator will publish the diagnostic_msgs/DiagnosticArray message on the /diagnostics_agg topic at 1 Hz.
\subsection analyzers Analyzers
-The DiagnosticAggregator will create analyzers to store and process the diagnostic data. Each analyzer inherits from the base class diagnostic_analyzer/DiagnosticAnalyzer. Analyzers should be in packages that depend directly on "pluginlib", "diagnostic_aggregator", and "diagnostic_analyzer".
+The DiagnosticAggregator will create analyzers to store and process the diagnostic data. Each analyzer inherits from the base class diagnostic_analyzer/DiagnosticAnalyzer. Analyzers should be in packages that depend directly on "pluginlib" and "diagnostic_aggregator".
-See the DiagnosticAnalyzer base class and the example generic_analyzer/GenericAnalyzer for more information.
+The base analyzer class is the DiagnosticAnalyzer. All derived classes must implement these methods as specified by the Analyzer:
+- \b init
+- \b analyze
+- \b getPrefix
+- \b getName
-\subsubsecion analyzer_behavior Analyzer Behavior
+Analyzers can choose the error state for any DiagnosticStatus message they analyzer. Generally, the "parent" of an analyzer has an error state of the maximum of its children, but it can follow any rule. The header ("/Robot" above) will have the diagnostic level of the greatest of its immediate children, so an error in "Motors" will give an error in "Robot".
-Analyzers can choose the error state for the parents. It should be related to the state of the children, but can follow any rule. The header ("/Robot" above) will have the diagnostic level of the greatest of its immediate children, so an error in "Motors" will give an error in "Robot".
+\subsubsection generic_analyzer Generic Analyzer
+
+\b generic_analyzer holds the GenericAnalyzer class, which is the most basic of the DiagnosticAnalyzer's. It is used by the diagnostic_aggregator/DiagnosticAggregator to store, process and republish diagnostics data. The GenericAnalyzer is loaded by the pluginlib as a DiagnosticAnalyzer plugin. It is the most basic of all DiagnosticAnalyzer's.
+
+The following YAML parameters will create a GenericAnalyzer to motor a PR2 power system.
+\verbatim
+powersystem:
+ type: GenericAnalyzer
+ prefix: Power System
+ expected: [
+ 'IBPS 0',
+ 'IBPS 1']
+ startswith: [
+ 'Smart Battery']
+ name: [
+ 'Power Node 1018']
+ contains: [
+ 'Battery']
+\endverbatim
+That would create an GenericAnalyzer that will process any DiagnosticStatus message that has a name that matches the given criteria ("startswith", "contains", "name", or "expected"). "expected" and "name" status names require an exact match. Any names in the "expected" list will give an error if not observed.
+
\section rosapi ROS API
Nodes:
- \b aggregator_node
-- \b py_agg_node.py (Don't use)
<hr>
\subsection aggregator_node aggregator_node
-aggregator_node subscribes to "/diagnstics" and publishes an aggregated set of data to "/diagnostics_agg"
+aggregator_node subscribes to "/diagnostics" and publishes an aggregated set of data to "/diagnostics_agg". The aggregator will load diagnostic analyzers (like the GenericAnalyzer above) as plugins. The analyzers are specified in the launch file as private parameters.
\subsubsection Usage
+The aggregator is initialized with the prefix as an argument, and YAML to create the analyzers as a private parameter.
\verbatim
-$ aggregator_node Robot
+<node
+ pkg="diagnostic_aggregator" type="aggregator_node"
+ name="diag_agg" args="Robot" >
+ <rosparam command="load"
+ file="$(find diagnostic_aggregator)/test/analyzers.yaml" />
+</node>
\endverbatim
\par Example
-Using the above usage, the diagnostic aggregator will spawn analyzers that group the robot's data by category. The analyzer parameters are as follows:
+Using the above usage, the diagnostic aggregator will spawn analyzers that group the robot's data by category. The analyzer parameters might look like:
\verbatim
sensors:
type: GenericAnalyzer
@@ -60,14 +88,9 @@
type: PR2MotorsDiagnosticAnalyzer
joints:
type: PR2JointsDiagnosticAnalyzer
-other:
- type: GenericAnalyzer
- other: true
\endverbatim
-Each analyzer is started with a namespace, and must have the parameter "type" in that namespace. Analyzers are loaded as plugins with "pluginlib" and inherit from the base class diagnostic_analyzer/DiagnosticAnalyzer.
+Each analyzer is started with a namespace, and must have the parameter "type" in that namespace. Analyzers are loaded as plugins with "pluginlib" and inherit from the base class diagnostic_analyzer/DiagnosticAnalyzer.
-An analyzer with the namespace "other" will be called last so that it can process only data that hasn't been handled by other analyzers.
-
If any analyzer is not properly specified, or returns false on initialization, the aggregator program will exit.
\subsubsection topics ROS topics
Modified: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/manifest.xml
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/manifest.xml 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/manifest.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -1,16 +1,19 @@
<package>
- <description brief="Aggregates robot diagnostics to allow easy display" >
+ <description brief="Aggregates robot diagnostics and performs online analysis" >
+ <p>diagnostic_aggregator contains the tools to aggregate and analyze robot diagnostics on an active robot. It uses the <b>DiagnosticAggregator</b> class as to aggregate and process data. The aggregator tool creates analyzers according to user specifications, and these analyzers can perform basic tests on diagnostics, such as testing when things are stale, or having known errors. Analyzers are subclasses of <b>DiagnosticAnalyzer</b> and <b>GenericAnalyzer</b> is one of these subclasses and is the most basic analysis tool.</p>
+
+ <p>The DiagnosticAggregator must be run on a robot, and is typically launched in the robot's launch file. Viewing of this aggregated diagnostics is done with the <b>robot_monitor</b> package. </p>
</description>
<author>Kevin Watts</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
- <url>http://pr.willowgarage.com/wiki/diagnostic_aggregator</url>
+ <url>http://www.ros.org/wiki/diagnostic_aggregator</url>
<depend package="diagnostic_msgs" />
<depend package="roscpp" />
<depend package="xmlrpc++" />
<depend package="pluginlib" />
- <depend package="diagnostic_analyzer" />
<export>
<cpp cflags="-I${prefix}/include" lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib -ldiagnostic_aggregator"/>
+ <diagnostic_aggregator plugin="${prefix}/generic_analyzer_plugin.xml" />
</export>
</package>
Modified: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/diagnostic_aggregator.cpp
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/diagnostic_aggregator.cpp 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/diagnostic_aggregator.cpp 2009-08-26 20:44:56 UTC (rev 23018)
@@ -52,6 +52,11 @@
DiagnosticAggregator::~DiagnosticAggregator()
{
clearMessages();
+
+ for (unsigned int i = 0; i < analyzers_.size(); ++i)
+ delete analyzers_[i];
+
+ analyzers_.clear();
}
void DiagnosticAggregator::init()
@@ -67,8 +72,6 @@
XmlRpc::XmlRpcValue::iterator xml_it;
- diagnostic_analyzer::DiagnosticAnalyzer *remainder = NULL;
-
for (xml_it = private_params.begin(); xml_it != private_params.end(); ++xml_it)
{
XmlRpc::XmlRpcValue analyzer_name = xml_it->first;
@@ -84,7 +87,6 @@
}
XmlRpc::XmlRpcValue analyzer_type = analyzer_value["type"];
-
string an_type = analyzer_type;
diagnostic_analyzer::DiagnosticAnalyzer* analyzer = analyzer_loader_.createClassInstance(an_type);
@@ -99,17 +101,15 @@
ROS_FATAL("Unable to initialize analyzer NS: %s, type: %s", ns.c_str(), an_type.c_str());
ROS_BREAK();
}
-
- if (analyzer_name == "other")
- remainder = analyzer;
- else
- analyzers_.push_back(analyzer);
+
+ analyzers_.push_back(analyzer);
}
- // Initialize the remainder last, so it's guarenteed to pick up
- // anything that hasn't been analyzed
- if (remainder != NULL)
- analyzers_.push_back(remainder);
+ // Last analyzer handles remaining data
+ diagnostic_analyzer::GenericAnalyzer *remainder = new diagnostic_analyzer::GenericAnalyzer();
+ remainder->initOther(prefix_);
+
+ analyzers_.push_back(remainder);
}
void DiagnosticAggregator::diagCallback(const diagnostic_msgs::DiagnosticArray::ConstPtr& diag_msg)
Added: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/diagnostic_item.cpp
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/diagnostic_item.cpp (rev 0)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/diagnostic_item.cpp 2009-08-26 20:44:56 UTC (rev 23018)
@@ -0,0 +1,117 @@
+/*********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2009, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of the Willow Garage nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *********************************************************************/
+
+// Author: Kevin Watts
+
+#include <diagnostic_aggregator/diagnostic_item.h>
+
+using namespace diagnostic_item;
+using namespace std;
+
+DiagnosticItem::DiagnosticItem(const diagnostic_msgs::DiagnosticStatus *status)
+{
+ checked_ = false;
+ level_ = status->level;
+ name_ = status->name;
+ message_ = status->message;
+ hw_id_ = status->hardware_id;
+ values_ = status->values; // Copy?
+
+ // Replace "/" with "" in name to output
+ output_name_ = name_;
+ string slash_str = "/";
+ string::size_type pos = 0;
+ while ((pos = output_name_.find(slash_str, pos)) != string::npos)
+ {
+ output_name_.replace( pos, slash_str.size(), " ");
+ pos++;
+ }
+
+}
+
+DiagnosticItem::~DiagnosticItem() {}
+
+void DiagnosticItem::update(const diagnostic_msgs::DiagnosticStatus *status)
+{
+ if (name_ != status->name)
+ ROS_ERROR("Incorrect name when updating DiagnosticItem. Expected %s, got %s", name_.c_str(), status->name.c_str());
+
+
+ level_ = status->level;
+ message_ = status->message;
+ hw_id_ = status->hardware_id;
+ values_ = status->values; // Copy?
+}
+
+diagnostic_msgs::DiagnosticStatus *DiagnosticItem::toStatusMsg()
+{
+ checked_ = true;
+
+ diagnostic_msgs::DiagnosticStatus *status = new diagnostic_msgs::DiagnosticStatus();
+ status->name = output_name_;
+ status->level = level_;
+ status->message = message_;
+ status->hardware_id = hw_id_;
+ status->values = values_;
+
+ return status;
+}
+
+diagnostic_msgs::DiagnosticStatus *DiagnosticItem::toStatusMsg(std::string prefix, bool stale)
+{
+ checked_ = true;
+
+ diagnostic_msgs::DiagnosticStatus *status = new diagnostic_msgs::DiagnosticStatus();
+ ///\todo Check original name to make sure no "/" characters
+
+ status->name = prefix + "/" + output_name_;
+ status->level = level_;
+ status->message = message_;
+ status->hardware_id = hw_id_;
+ status->values = values_;
+
+ if (stale)
+ status->level = 3;
+
+ return status;
+}
+
+
+int8_t DiagnosticItem::getLevel() { return level_; }
+
+string DiagnosticItem::getMessage() { return message_; }
+string DiagnosticItem::getName() { return name_; }
+
+bool DiagnosticItem::hasChecked() {return checked_;}
+
Added: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/generic_analyzer.cpp
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/generic_analyzer.cpp (rev 0)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/generic_analyzer.cpp 2009-08-26 20:44:56 UTC (rev 23018)
@@ -0,0 +1,288 @@
+/*********************************************************************
+ * Software License Agreement (BSD License)
+ *
+ * Copyright (c) 2009, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of the Willow Garage nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *********************************************************************/
+
+// Author: Kevin Watts
+
+#include "diagnostic_aggregator/generic_analyzer.h"
+
+using namespace diagnostic_analyzer;
+using namespace std;
+
+GenericAnalyzer::GenericAnalyzer() : other_(false) { }
+
+bool GenericAnalyzer::initOther(string first_prefix)
+{
+ other_ = true;
+ nice_name_ = "Other";
+ full_prefix_ = first_prefix + "/" + nice_name_;
+
+ ROS_DEBUG("Created remainder analyzer");
+ return true;
+}
+
+bool GenericAnalyzer::init(string first_prefix, const ros::NodeHandle &n)
+{
+ if (!n.getParam("~prefix", nice_name_))
+ {
+ ROS_FATAL("GenericAnalyzer was not given parameter \"prefix\".");
+ ROS_BREAK();
+ }
+ full_prefix_ = first_prefix + "/" + nice_name_;
+
+ XmlRpc::XmlRpcValue startswith;
+ if (n.getParam("~startswith", startswith))
+ {
+ for (int i = 0; i < startswith.size(); ++i)
+ {
+ string starts = startswith[i];
+ startswith_.push_back(starts);
+ }
+ }
+
+ XmlRpc::XmlRpcValue name_val;
+ if (n.getParam("~name", name_val))
+ {
+ for (int i = 0; i < name_val.size(); ++i)
+ {
+ string name = name_val[i];
+ name_.push_back(name);
+ }
+ }
+
+ XmlRpc::XmlRpcValue contains;
+ if (n.getParam("~contains", contains))
+ {
+ for (int i = 0; i < contains.size(); ++i)
+ {
+ string contain_str = contains[i];
+ contains_.push_back(contain_str);
+ }
+ }
+
+ XmlRpc::XmlRpcValue expected;
+ if (n.getParam("~expected", expected))
+ {
+ for (int i = 0; i < expected.size(); ++i)
+ {
+ string expected_str = expected[i];
+ expected_.push_back(expected_str);
+
+ // Make sure we're looking for this item
+ diagnostic_msgs::DiagnosticStatus *status = new diagnostic_msgs::DiagnosticStatus();
+ status->name = expected_str;
+ status->level = 2;
+ status->message = "Missing";
+
+ diagnostic_item::DiagnosticItem *item = new diagnostic_item::DiagnosticItem(status);
+ items_[expected_str] = item;
+
+ delete status;
+ }
+ }
+
+ return true;
+}
+
+GenericAnalyzer::~GenericAnalyzer()
+{
+ // Clear all items
+ map<string, diagnostic_item::DiagnosticItem*>::iterator it;
+ for (it = items_.begin(); it != items_.end(); ++it)
+ {
+ delete it->second;
+ it->second = NULL;
+ }
+ items_.clear();
+}
+
+vector<diagnostic_msgs::DiagnosticStatus*> GenericAnalyzer::analyze(map<string, diagnostic_item::DiagnosticItem*> msgs)
+{
+ diagnostic_msgs::DiagnosticStatus *header_status = new diagnostic_msgs::DiagnosticStatus();
+ header_status->name = full_prefix_;
+ header_status->level = 0;
+ header_status->message = "OK";
+
+ // Output array, gets deleted by aggregator
+ vector<diagnostic_msgs::DiagnosticStatus*> processed;
+ processed.push_back(header_status);
+
+ vector<diagnostic_msgs::DiagnosticStatus*> to_analyze;
+ if (!other_)
+ to_analyze = toAnalyze(msgs);
+ else
+ to_analyze = toAnalyzeOther(msgs);
+
+ // Deletes items to analyze
+ updateItems(to_analyze);
+
+ bool all_stale = true;
+
+ map<string, diagnostic_item::DiagnosticItem*>::iterator it;
+ for (it = items_.begin(); it != items_.end(); it++)
+ {
+ string name = it->first;
+ diagnostic_item::DiagnosticItem *item = it->second;
+
+ int8_t level = item->getLevel();
+
+ ///\todo NEED TO CHECK UPDATE TIME
+
+ all_stale = all_stale && (level == 3);
+
+ header_status->level = max(header_status->level, level);
+
+ diagnostic_msgs::KeyValue kv;
+ kv.key = name;
+ kv.value = item->getMessage();
+
+ header_status->values.push_back(kv);
+ processed.push_back(item->toStatusMsg(full_prefix_, false));
+ }
+ if (header_status->level == 3 && !all_stale)
+ header_status->level = 2;
+
+ if (header_status->level == 1)
+ header_status->message = "Warning";
+ if (header_status->level == 2)
+ header_status->message = "Error";
+ if (header_status->level == 3)
+ header_status->message = "All Stale";
+
+ return processed;
+}
+
+void GenericAnalyzer::updateItems(vector<diagnostic_msgs::DiagnosticStatus*> to_analyze)
+{
+ map<string, diagnostic_item::DiagnosticItem*>::iterator it;
+
+ for (unsigned int i = 0; i < to_analyze.size(); ++i)
+ {
+ it = items_.find(to_analyze[i]->name);
+ if (it == items_.end())
+ items_[to_analyze[i]->name] = new diagnostic_item::DiagnosticItem(to_analyze[i]);
+ else
+ items_[to_analyze[i]->name]->update(to_analyze[i]);
+
+ delete to_analyze[i];
+ to_analyze[i] = NULL;
+ }
+ to_analyze.clear();
+}
+
+// Returns vector of msgs that haven't been analyzed
+vector<diagnostic_msgs::DiagnosticStatus*> GenericAnalyzer::toAnalyzeOther(map<string, diagnostic_item::DiagnosticItem*> msgs)
+{
+ vector<diagnostic_msgs::DiagnosticStatus*> to_analyze;
+
+ map<string, diagnostic_item::DiagnosticItem*>::iterator it;
+
+ for (it = msgs.begin(); it != msgs.end(); ++it)
+ {
+ if (!it->second->hasChecked())
+ to_analyze.push_back(it->second->toStatusMsg());
+ }
+
+ return to_analyze;
+}
+
+// Returns vector of msgs to analyze
+///\todo optimize with dictionaries or something
+vector<diagnostic_msgs::DiagnosticStatus*> GenericAnalyzer::toAnalyze(map<string, diagnostic_item::DiagnosticItem*> msgs)
+{
+ vector<diagnostic_msgs::DiagnosticStatus*> to_analyze;
+
+ map<string, diagnostic_item::DiagnosticItem*>::iterator it;
+
+ for (it = msgs.begin(); it != msgs.end(); ++it)
+ {
+ // Look for all startswith, etc
+ diagnostic_item::DiagnosticItem *item = it->second;
+
+ string name = item->getName();
+
+ bool analyzed = false;
+
+ // Check expected, name, startswith, contains
+ // If we're going to analyze it, don't check remainder
+ for (unsigned int i = 0; i < expected_.size(); ++i)
+ {
+ if (name == expected_[i])
+ {
+ to_analyze.push_back(item->toStatusMsg());
+ analyzed = true;
+ break;
+ }
+ }
+ if (analyzed)
+ continue;
+
+ for (unsigned int i = 0; i < name_.size(); ++i)
+ {
+ if (name == name_[i])
+ {
+ to_analyze.push_back(item->toStatusMsg());
+ analyzed = true;
+ break;
+ }
+ }
+ if (analyzed)
+ continue;
+
+ for (unsigned int i = 0; i < startswith_.size(); ++i)
+ {
+ if (name.find(startswith_[i]) == 0)
+ {
+ to_analyze.push_back(item->toStatusMsg());
+ analyzed = true;
+ break;
+ }
+ }
+ if (analyzed)
+ continue;
+
+ for (unsigned int i = 0; i < contains_.size(); ++i)
+ {
+ if (name.find(contains_[i]) != string::npos)
+ {
+ to_analyze.push_back(item->toStatusMsg());
+ analyzed = true;
+ break;
+ }
+ }
+ }
+
+ return to_analyze;
+}
+
+
Added: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/plugin_list.cpp
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/plugin_list.cpp (rev 0)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/src/plugin_list.cpp 2009-08-26 20:44:56 UTC (rev 23018)
@@ -0,0 +1,5 @@
+#include <pluginlib/class_list_macros.h>
+#include <diagnostic_aggregator/diagnostic_analyzer.h>
+#include <diagnostic_aggregator/generic_analyzer.h>
+
+PLUGINLIB_REGISTER_CLASS(GenericAnalyzer, diagnostic_analyzer::GenericAnalyzer, diagnostic_analyzer::DiagnosticAnalyzer)
Added: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/test/analyzers.yaml
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/test/analyzers.yaml (rev 0)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/test/analyzers.yaml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -0,0 +1,40 @@
+sensors:
+ type: GenericAnalyzer
+ prefix: Sensors
+ contains: [
+ 'hokuyo',
+ 'prosilica',
+ 'imu' ]
+computers:
+ type: GenericAnalyzer
+ prefix: Computers
+ contains: [
+ 'HD Temp',
+ 'CPU Usage',
+ 'CPU Temperature',
+ 'HD Usage',
+ 'NFS']
+motors:
+ type: GenericAnalyzer
+ prefix: Motors
+ startswith: [
+ 'EtherCAT',
+ 'Power board']
+joints:
+ type: GenericAnalyzer
+ prefix: Joints
+ startswith: [
+ 'Joint']
+power:
+ type: GenericAnalyzer
+ prefix: 'Power System'
+ startswith: [
+ 'Smart Battery']
+ name: [
+ 'Expected Batteries']
+ expected: [
+ 'IBPS 1',
+ 'IBPS 2',
+ 'IBPS 3',
+ 'IBPS 0']
+
Added: pkg/trunk/stacks/diagnostics/diagnostic_aggregator/test/cpp_agg.launch
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_aggregator/test/cpp_agg.launch (rev 0)
+++ pkg/trunk/stacks/diagnostics/diagnostic_aggregator/test/cpp_agg.launch 2009-08-26 20:44:56 UTC (rev 23018)
@@ -0,0 +1,9 @@
+<launch>
+ <!-- launch-prefix="xterm -e gdb -args" -->
+ <node
+ pkg="diagnostic_aggregator" type="aggregator_node"
+ name="diag_agg" args="CPP" output="screen" >
+ <rosparam command="load"
+ file="$(find diagnostic_aggregator)/test/analyzers.yaml" />
+ </node>
+</launch>
Modified: pkg/trunk/stacks/diagnostics/diagnostic_updater/manifest.xml
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostic_updater/manifest.xml 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/diagnostic_updater/manifest.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -1,12 +1,14 @@
<package>
- <description>A package containing a class for easily updating diagnostics.</description>
+ <description brief="Allows users to easily update diagnostics on a node">
+ diagnostic_updater contains tools for easily updating diagnostics.
+ </description>
<author>Jeremy Leibs, Blaise Gassend</author>
<license>BSD</license>
<review status="unreviewed" notes="proposal (Jeremy)"/>
+ <url>http://www.ros.org/wiki/diagnostic_updater</url>
<depend package="roscpp" />
<depend package="diagnostic_msgs" />
<export>
<cpp cflags="-I${prefix}/include"/>
</export>
- <url></url>
</package>
Modified: pkg/trunk/stacks/diagnostics/diagnostics_analysis/manifest.xml
===================================================================
--- pkg/trunk/stacks/diagnostics/diagnostics_analysis/manifest.xml 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/diagnostics_analysis/manifest.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -1,10 +1,13 @@
<package>
- <description brief="Process diagnostics log files for statistics">
+ <description brief="Process diagnostics log files for data">
+ The diagnostics_analysis package can convert a log of diagnostics data
+ into a series of CSV files. Robot logs are recorded with rosrecord, and
+ can be processed offline using the scripts in this package.
</description>
<author>Eric Berger, Kevin Watts</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
<depend package="rosrecord"/>
<depend package="diagnostic_msgs"/>
- <url>http://pr.willowgarage.com</url>
+ <url>http://www.ros.org/wiki/diagnostics_analysis</url>
</package>
Modified: pkg/trunk/stacks/diagnostics/robot_monitor/manifest.xml
===================================================================
--- pkg/trunk/stacks/diagnostics/robot_monitor/manifest.xml 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/robot_monitor/manifest.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -1,20 +1,15 @@
<package>
- <description brief="Monitors robot diagnostics from diagnostics_aggregator">
- Monitors robot diagnostics from diagnostics_aggregator, and outputs them
- in a GUI with a tree structure. Displays analyzed, simplified diagnostics
- view.
+ <description brief="Monitors, displays aggregated robot diagnostics" >
+ robot_monitor displays robot diagnostics from the <b>diagnostics_aggregator</b>, and outputs it in a GUI with a tree structure. Displays analyzed, simplified diagnostics view. The data must be aggregated first by the diagnostic_aggregator.
</description>
<author>Kevin Watts</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
- <url>http://pr.willowgarage.com/wiki/robot_monitor</url>
+ <url>http://www.ros.org/wiki/robot_monitor</url>
<depend package="rospy" />
- <depend package="diagnostic_aggregator" />
<depend package="diagnostic_msgs" />
-
<rosdep name="wxwidgets"/>
<rosdep name="wxpython"/>
-
</package>
Modified: pkg/trunk/stacks/diagnostics/runtime_monitor/manifest.xml
===================================================================
--- pkg/trunk/stacks/diagnostics/runtime_monitor/manifest.xml 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/runtime_monitor/manifest.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -1,19 +1,16 @@
<package>
-<description brief='A program to moniter self reported status on the robot'>
-
-This will monitor broadcasts of status of the hardware and report any
-missing parts as well as report failiures.
-
-</description>
-<author>Tully Foote</author>
-<license>BSD</license>
-<review status="proposal cleared" notes=""/>
-<url>http://pr.willowgarage.com/wiki/runtime_monitor</url>
-<export>
-<cpp cflags="-I${prefix}/include " lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib"/>
-</export>
-<depend package="rospy"/>
-<depend package="diagnostic_msgs"/>
- <rosdep name="wxwidgets"/>
- <rosdep name="wxpython"/>
+ <description brief="A program to moniter diagnostics on a robot">
+ The runtime monitor displays raw diagnostics data in an easy to read GUI.
+ </description>
+ <author>Tully Foote</author>
+ <license>BSD</license>
+ <review status="proposal cleared" notes=""/>
+ <url>http://www.ros.org/wiki/runtime_monitor</url>
+ <export>
+ <cpp cflags="-I${prefix}/include " lflags="-Wl,-rpath,${prefix}/lib -L${prefix}/lib"/>
+ </export>
+ <depend package="rospy"/>
+ <depend package="diagnostic_msgs"/>
+ <rosdep name="wxwidgets"/>
+ <rosdep name="wxpython"/>
</package>
Modified: pkg/trunk/stacks/diagnostics/self_test/manifest.xml
===================================================================
--- pkg/trunk/stacks/diagnostics/self_test/manifest.xml 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/self_test/manifest.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -1,13 +1,15 @@
<package>
- <description>A package containing a class for easily constructing a self test.</description>
+ <description brief="Allows users to run a self test on a node">
+ self_test contains a class for easily constructing a self test. This is used by nodes to allow users to quickly check that a device or process is working.
+ </description>
<author>Jeremy Leibs</author>
<license>BSD</license>
<review status="unreviewed" notes="proposal (Jeremy)"/>
+ <url>http://www.ros.org/wiki/self_test</url>
<depend package="roscpp" />
<depend package="diagnostic_updater" />
<depend package="diagnostic_msgs" />
<export>
<cpp cflags="-I${prefix}/include -I${prefix}/srv/cpp"/>
</export>
- <url></url>
</package>
Modified: pkg/trunk/stacks/diagnostics/stack.xml
===================================================================
--- pkg/trunk/stacks/diagnostics/stack.xml 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/diagnostics/stack.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -3,7 +3,7 @@
Packages related to gathering, viewing, and analyzing diagnostics data
from robots.
</description>
- <author>Tully Foote tf...@wi...</author>
+ <author>Kevin Watts wa...@wi..., Tully Foote tf...@wi...</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
<url>http://pr.willowgarage.com/wiki/diagnostics</url>
Modified: pkg/trunk/stacks/pr2/pr2_alpha/manifest.xml
===================================================================
--- pkg/trunk/stacks/pr2/pr2_alpha/manifest.xml 2009-08-26 20:23:30 UTC (rev 23017)
+++ pkg/trunk/stacks/pr2/pr2_alpha/manifest.xml 2009-08-26 20:44:56 UTC (rev 23018)
@@ -34,7 +34,6 @@
<depend package="mechanism_bringup" />
<depend package="robot_mechanism_controllers" />
<depend package="pr2_mechanism_controllers" />
- <depend package="generic_analyzer" />
<depend package="diagnostic_aggregator" />
<!-- For testing -->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|