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 JSK Lab 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 00036 #ifndef JSK_RVIZ_PLUGIN_DIAGNOSTICS_DISPLAY_H_ 00037 #define JSK_RVIZ_PLUGIN_DIAGNOSTICS_DISPLAY_H_ 00038 00039 #ifndef Q_MOC_RUN 00040 #include <rviz/display.h> 00041 #include <rviz/properties/float_property.h> 00042 #include <rviz/properties/string_property.h> 00043 #include <rviz/properties/editable_enum_property.h> 00044 #include <rviz/properties/tf_frame_property.h> 00045 #include <rviz/properties/ros_topic_property.h> 00046 #include <rviz/properties/enum_property.h> 00047 #include <diagnostic_msgs/DiagnosticArray.h> 00048 #include <rviz/ogre_helpers/billboard_line.h> 00049 #include <rviz/display_context.h> 00050 #include <rviz/frame_manager.h> 00051 #include <OGRE/OgreSceneNode.h> 00052 #include <OGRE/OgreSceneManager.h> 00053 #include <rviz/ogre_helpers/movable_text.h> 00054 #endif 00055 00056 namespace jsk_rviz_plugins 00057 { 00058 class DiagnosticsDisplay : public rviz::Display 00059 { 00060 Q_OBJECT 00061 public: 00062 DiagnosticsDisplay(); 00063 virtual ~DiagnosticsDisplay(); 00064 protected: 00065 virtual void onEnable(); 00066 virtual void onDisable(); 00067 virtual void onInitialize(); 00068 virtual void subscribe(); 00069 virtual void unsubscribe(); 00070 virtual void updateLine(); 00071 virtual void update(float wall_dt, float ros_dt); 00072 virtual void processMessage 00073 (const diagnostic_msgs::DiagnosticArray::ConstPtr& msg); 00074 00075 rviz::RosTopicProperty* ros_topic_property_; 00076 rviz::EditableEnumProperty* diagnostics_namespace_property_; 00077 rviz::TfFrameProperty* frame_id_property_; 00078 rviz::FloatProperty* radius_property_; 00079 rviz::FloatProperty* line_width_property_; 00080 rviz::FloatProperty* font_size_property_; 00081 rviz::EnumProperty* axis_property_; 00082 ros::Subscriber sub_; 00083 00084 double radius_; 00085 double line_width_; 00086 std::string frame_id_; 00087 std::string diagnostics_namespace_; 00088 rviz::MovableText* msg_; 00089 rviz::BillboardLine* line_; 00090 Ogre::SceneNode* orbit_node_; 00091 std::set<std::string> namespaces_; 00092 int axis_; 00093 double orbit_theta_; 00094 double font_size_; 00095 bool line_update_required_; 00096 protected Q_SLOTS: 00097 virtual void updateRosTopic(); 00098 virtual void updateDiagnosticsNamespace(); 00099 virtual void updateRadius(); 00100 virtual void updateLineWidth(); 00101 virtual void updateAxis(); 00102 virtual void updateFontSize(); 00103 virtual void fillNamespaceList(); 00104 private: 00105 00106 }; 00107 00108 } 00109 00110 00111 #endif