overlay_diagnostic_display.h
Go to the documentation of this file.
00001 // -*- mode: c++; -*-
00002 /*********************************************************************
00003  * Software License Agreement (BSD License)
00004  *
00005  *  Copyright (c) 2014, JSK Lab
00006  *  All rights reserved.
00007  *
00008  *  Redistribution and use in source and binary forms, with or without
00009  *  modification, are permitted provided that the following conditions
00010  *  are met:
00011  *
00012  *   * Redistributions of source code must retain the above copyright
00013  *     notice, this list of conditions and the following disclaimer.
00014  *   * Redistributions in binary form must reproduce the above
00015  *     copyright notice, this list of conditions and the following
00016  *     disclaimer in the documentation and/o2r other materials provided
00017  *     with the distribution.
00018  *   * Neither the name of the Willow Garage nor the names of its
00019  *     contributors may be used to endorse or promote products derived
00020  *     from this software without specific prior written permission.
00021  *
00022  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033  *  POSSIBILITY OF SUCH DAMAGE.
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


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Mon Oct 6 2014 01:18:44