diagnostics_specific.hpp
Go to the documentation of this file.
00001 
00028 #ifndef _DIAGNOSTIC_SPECIFIC_HPP_
00029 #define _DIAGNOSTIC_SPECIFIC_HPP_
00030 
00031 #include <diagnostic_updater/DiagnosticStatusWrapper.h>
00032 #include <diagnostic_msgs/DiagnosticArray.h>
00033 #include <diagnostic_msgs/DiagnosticStatus.h>
00034 #include <boost/ptr_container/ptr_vector.hpp>
00035 #include <boost/ptr_container/ptr_map.hpp>
00036 #include <boost/variant.hpp>
00037 #include <sstream>
00038 #include <ros/ros.h>
00039 
00040 #include "sr_self_test/diagnostics_parser/diagnostics_common.hpp"
00041 
00042 namespace shadow_robot
00043 {
00044   class RTLoopDiagnostics
00045     : public MinMaxDiagnostics
00046   {
00047   public:
00048     RTLoopDiagnostics(std::string name, self_test::TestRunner* test_runner)
00049       : MinMaxDiagnostics(name, test_runner)
00050     {
00051       values_.reset(new DiagMap() );
00052       DiagnosticTest jitter;
00053       jitter.min_max = std::make_pair(0.0, 100.0); //min and max acceptable jitter
00054       values_->insert( std::pair<std::string, DiagnosticTest>("Avg Loop Jitter (us)", jitter) );
00055     }
00056 
00057     virtual ~RTLoopDiagnostics()
00058     {}
00059 
00060     virtual std::auto_ptr<BaseDiagnostics> shallow_clone(std::string name)
00061     {
00062       std::auto_ptr<BaseDiagnostics> tmp( new RTLoopDiagnostics(name, test_runner_) );
00063       return tmp;
00064     };
00065 
00066   private:
00067     double avg_jitter;
00068     int control_loop_overruns;
00069   };
00070 
00071   class EtherCATMasterDiagnostics
00072     : public MinMaxDiagnostics
00073   {
00074   public:
00075     EtherCATMasterDiagnostics(std::string name, self_test::TestRunner* test_runner)
00076       : MinMaxDiagnostics(name, test_runner)
00077     {
00078       values_.reset(new DiagMap() );
00079       DiagnosticTest dropped_packet;
00080       dropped_packet.min_max = std::make_pair(0, 200); //min and max acceptable dropped packets
00081       //max  (TODO: this should be a ratio dropped/sent packets??)
00082       values_->insert( std::pair<std::string, DiagnosticTest>("Dropped Packets", dropped_packet) );
00083     }
00084 
00085     virtual ~EtherCATMasterDiagnostics()
00086     {};
00087 
00088     virtual std::auto_ptr<BaseDiagnostics> shallow_clone(std::string name)
00089     {
00090       std::auto_ptr<BaseDiagnostics> tmp( new EtherCATMasterDiagnostics(name, test_runner_) );
00091       return tmp;
00092     };
00093   };
00094 
00095 
00096   class MotorDiagnostics
00097     : public MinMaxDiagnostics
00098   {
00099   public:
00100     MotorDiagnostics(std::string name, self_test::TestRunner* test_runner)
00101       : MinMaxDiagnostics(name, test_runner)
00102     {
00103       values_.reset(new DiagMap() );
00104       DiagnosticTest voltage;
00105       voltage.min_max = std::make_pair(23.5, 24.5); //min and max acceptable voltage
00106       values_->insert( std::pair<std::string, DiagnosticTest>("Measured Voltage", voltage) );
00107 
00108       DiagnosticTest temperature;
00109       temperature.min_max = std::make_pair(20.0, 50.0); //min and max acceptable temperature
00110       values_->insert( std::pair<std::string, DiagnosticTest>("Temperature", temperature) );
00111     };
00112 
00113     virtual ~MotorDiagnostics() {};
00114 
00115     virtual std::auto_ptr<BaseDiagnostics> shallow_clone(std::string name)
00116     {
00117       std::auto_ptr<BaseDiagnostics> tmp( new MotorDiagnostics(name, test_runner_) );
00118       return tmp;
00119     };
00120   };
00121 }
00122 
00123   /* For the emacs weenies in the crowd.
00124      Local Variables:
00125      c-basic-offset: 2
00126      End:
00127   */
00128 
00129 #endif /* _DIAGNOSTIC_SPECIFIC_HPP_ */


sr_self_test
Author(s): Ugo Cupcic
autogenerated on Fri Aug 28 2015 13:09:38