00001 /* 00002 * Copyright (c) 2008, Willow Garage, Inc. 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Neither the name of the Willow Garage, Inc. nor the names of its 00014 * contributors may be used to endorse or promote products derived from 00015 * this software without specific prior written permission. 00016 * 00017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 * POSSIBILITY OF SUCH DAMAGE. 00028 */ 00029 00030 #ifndef RVIZ_TF_DISPLAY_H 00031 #define RVIZ_TF_DISPLAY_H 00032 00033 #include "rviz/display.h" 00034 #include "rviz/properties/forwards.h" 00035 00036 #include <OGRE/OgreVector3.h> 00037 #include <OGRE/OgreQuaternion.h> 00038 00039 #include <map> 00040 #include <set> 00041 00042 namespace ogre_tools 00043 { 00044 class Arrow; 00045 class Axes; 00046 class MovableText; 00047 } 00048 00049 namespace Ogre 00050 { 00051 class SceneNode; 00052 } 00053 00054 namespace rviz 00055 { 00056 00057 class BoolProperty; 00058 class Vector3Property; 00059 class QuaternionProperty; 00060 class FloatProperty; 00061 class CategoryProperty; 00062 class StringProperty; 00063 00064 struct FrameInfo; 00065 typedef std::set<FrameInfo*> S_FrameInfo; 00066 00071 class TFDisplay : public Display 00072 { 00073 public: 00074 TFDisplay( const std::string& name, VisualizationManager* manager ); 00075 virtual ~TFDisplay(); 00076 00077 bool getShowNames() { return show_names_; } 00078 void setShowNames( bool show ); 00079 00080 bool getShowAxes() { return show_axes_; } 00081 void setShowAxes( bool show ); 00082 00083 bool getShowArrows() { return show_arrows_; } 00084 void setShowArrows( bool show ); 00085 00086 float getUpdateRate() { return update_rate_; } 00087 void setUpdateRate( float rate ); 00088 00089 bool getAllEnabled() { return all_enabled_; } 00090 void setAllEnabled(bool enabled); 00091 00092 float getFrameTimeout() { return frame_timeout_; } 00093 void setFrameTimeout(float timeout); 00094 00095 void setFrameEnabled(FrameInfo* frame, bool enabled); 00096 00097 // Overrides from Display 00098 virtual void update(float wall_dt, float ros_dt); 00099 virtual void targetFrameChanged(); 00100 virtual void fixedFrameChanged() {} 00101 virtual void createProperties(); 00102 virtual void reset(); 00103 00104 protected: 00105 void updateFrames(); 00106 FrameInfo* createFrame(const std::string& frame); 00107 void updateFrame(FrameInfo* frame); 00108 void deleteFrame(FrameInfo* frame); 00109 00110 FrameInfo* getFrameInfo(const std::string& frame); 00111 00112 void clear(); 00113 00114 // overrides from Display 00115 virtual void onEnable(); 00116 virtual void onDisable(); 00117 00118 Ogre::SceneNode* root_node_; 00119 Ogre::SceneNode* names_node_; 00120 Ogre::SceneNode* arrows_node_; 00121 Ogre::SceneNode* axes_node_; 00122 00123 typedef std::map<std::string, FrameInfo*> M_FrameInfo; 00124 M_FrameInfo frames_; 00125 00126 float update_timer_; 00127 float update_rate_; 00128 00129 bool show_names_; 00130 bool show_arrows_; 00131 bool show_axes_; 00132 float frame_timeout_; 00133 bool all_enabled_; 00134 00135 BoolPropertyWPtr show_names_property_; 00136 BoolPropertyWPtr show_arrows_property_; 00137 BoolPropertyWPtr show_axes_property_; 00138 FloatPropertyWPtr update_rate_property_; 00139 FloatPropertyWPtr frame_timeout_property_; 00140 BoolPropertyWPtr all_enabled_property_; 00141 00142 CategoryPropertyWPtr frames_category_; 00143 CategoryPropertyWPtr tree_category_; 00144 }; 00145 00146 } // namespace rviz 00147 00148 #endif 00149