Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef JSK_RVIZ_PLUGIN_OVERLAY_DIAGNOSTIC_DISPLAY_H_
00036 #define JSK_RVIZ_PLUGIN_OVERLAY_DIAGNOSTIC_DISPLAY_H_
00037
00038 #include <rviz/display.h>
00039 #include <OGRE/OgreTexture.h>
00040 #include <OGRE/OgreColourValue.h>
00041 #include <OGRE/OgreMaterial.h>
00042
00043 #include <QPainter>
00044
00045 #include <rviz/properties/ros_topic_property.h>
00046 #include <rviz/properties/editable_enum_property.h>
00047 #include <rviz/properties/int_property.h>
00048 #include <rviz/properties/float_property.h>
00049 #include <rviz/properties/color_property.h>
00050
00051 #include <diagnostic_msgs/DiagnosticArray.h>
00052
00053 #include "overlay_utils.h"
00054
00055 namespace jsk_rviz_plugin
00056 {
00057 class OverlayDiagnosticDisplay: public rviz::Display
00058 {
00059 Q_OBJECT
00060 public:
00061 OverlayDiagnosticDisplay();
00062 virtual ~OverlayDiagnosticDisplay();
00063
00064 protected:
00065 virtual bool isStalled();
00066 virtual void processMessage(
00067 const diagnostic_msgs::DiagnosticArray::ConstPtr& msg);
00068 virtual void update(float wall_dt, float ros_dt);
00069 virtual void onEnable();
00070 virtual void onDisable();
00071 virtual void onInitialize();
00072 virtual void subscribe();
00073 virtual void unsubscribe();
00074 virtual void redraw();
00075 virtual void fillNamespaceList();
00076 virtual QColor foregroundColor();
00077 virtual QColor blendColor(QColor a, QColor b, double a_rate);
00078 virtual void drawText(QPainter& painter, QColor fg_color,
00079 const std::string& text);
00080 virtual double drawAnimatingText(QPainter& painter,
00081 QColor fg_color,
00082 const double height,
00083 const double font_size,
00084 const std::string text);
00085 virtual std::string statusText();
00086 boost::mutex mutex_;
00087 OverlayObject::Ptr overlay_;
00088
00089 diagnostic_msgs::DiagnosticStatus::Ptr latest_status_;
00090 ros::WallTime latest_message_time_;
00091 int size_;
00092 std::string diagnostics_namespace_;
00093 std::set<std::string> namespaces_;
00094 double alpha_;
00095 int top_, left_;
00096 double t_;
00097 double stall_duration_;
00098 rviz::RosTopicProperty* ros_topic_property_;
00099 rviz::EditableEnumProperty* diagnostics_namespace_property_;
00100 rviz::IntProperty* top_property_;
00101 rviz::IntProperty* left_property_;
00102 rviz::FloatProperty* alpha_property_;
00103 rviz::IntProperty* size_property_;
00104 rviz::FloatProperty* stall_duration_property_;
00105
00106 ros::Subscriber sub_;
00107 protected Q_SLOTS:
00108 virtual void updateRosTopic();
00109 virtual void updateDiagnosticsNamespace();
00110 virtual void updateSize();
00111 virtual void updateAlpha();
00112 virtual void updateTop();
00113 virtual void updateLeft();
00114 virtual void updateStallDuration();
00115 private:
00116
00117 };
00118 }
00119
00120 #endif