00001 /********************************************************************* 00002 * Software License Agreement (CC BY-NC-SA 4.0 License) 00003 * 00004 * Copyright (c) 2014, PAL Robotics, S.L. 00005 * All rights reserved. 00006 * 00007 * This work is licensed under the Creative Commons 00008 * Attribution-NonCommercial-ShareAlike 4.0 International License. 00009 * 00010 * To view a copy of this license, visit 00011 * http://creativecommons.org/licenses/by-nc-sa/4.0/ 00012 * or send a letter to 00013 * Creative Commons, 444 Castro Street, Suite 900, 00014 * Mountain View, California, 94041, USA. 00015 *********************************************************************/ 00016 00017 /* 00018 * @author Enrique Fernandez 00019 */ 00020 00021 #ifndef TWIST_MUX_DIAGNOSTICS_H 00022 #define TWIST_MUX_DIAGNOSTICS_H 00023 00024 #include <twist_mux/twist_mux_diagnostics_status.h> 00025 00026 #include <diagnostic_updater/diagnostic_updater.h> 00027 #include <ros/ros.h> 00028 00029 #include <boost/shared_ptr.hpp> 00030 00031 namespace twist_mux 00032 { 00033 00034 class TwistMuxDiagnostics 00035 { 00036 public: 00037 typedef TwistMuxDiagnosticsStatus status_type; 00038 00039 static constexpr double MAIN_LOOP_TIME_MIN = 0.2; // [s] 00040 static constexpr double READING_AGE_MIN = 3.0; // [s] 00041 00042 TwistMuxDiagnostics(); 00043 virtual ~TwistMuxDiagnostics(); 00044 00045 void diagnostics(diagnostic_updater::DiagnosticStatusWrapper& stat); 00046 00047 void update(); 00048 00049 void updateStatus(const status_type::ConstPtr& status); 00050 00051 private: 00052 00056 enum 00057 { 00058 OK = diagnostic_msgs::DiagnosticStatus::OK, 00059 WARN = diagnostic_msgs::DiagnosticStatus::WARN, 00060 ERROR = diagnostic_msgs::DiagnosticStatus::ERROR 00061 }; 00062 00063 diagnostic_updater::Updater diagnostic_; 00064 status_type status_; 00065 }; 00066 00067 } // namespace twist_mux 00068 00069 #endif // TWIST_MUX_DIAGNOSTICS_H