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