$search
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 float getScale() { return scale_; } 00096 void setScale(float scale); 00097 00098 void setFrameEnabled(FrameInfo* frame, bool enabled); 00099 00100 // Overrides from Display 00101 virtual void update(float wall_dt, float ros_dt); 00102 virtual void targetFrameChanged(); 00103 virtual void fixedFrameChanged() {} 00104 virtual void createProperties(); 00105 virtual void reset(); 00106 00107 protected: 00108 void updateFrames(); 00109 FrameInfo* createFrame(const std::string& frame); 00110 void updateFrame(FrameInfo* frame); 00111 void deleteFrame(FrameInfo* frame, bool delete_properties); 00112 00113 FrameInfo* getFrameInfo(const std::string& frame); 00114 00115 void clear(); 00116 00117 // overrides from Display 00118 virtual void onEnable(); 00119 virtual void onDisable(); 00120 00121 Ogre::SceneNode* root_node_; 00122 Ogre::SceneNode* names_node_; 00123 Ogre::SceneNode* arrows_node_; 00124 Ogre::SceneNode* axes_node_; 00125 00126 typedef std::map<std::string, FrameInfo*> M_FrameInfo; 00127 M_FrameInfo frames_; 00128 00129 float update_timer_; 00130 float update_rate_; 00131 00132 bool show_names_; 00133 bool show_arrows_; 00134 bool show_axes_; 00135 float frame_timeout_; 00136 bool all_enabled_; 00137 00138 float scale_; 00139 00140 BoolPropertyWPtr show_names_property_; 00141 BoolPropertyWPtr show_arrows_property_; 00142 BoolPropertyWPtr show_axes_property_; 00143 FloatPropertyWPtr update_rate_property_; 00144 FloatPropertyWPtr frame_timeout_property_; 00145 BoolPropertyWPtr all_enabled_property_; 00146 00147 FloatPropertyWPtr scale_property_; 00148 00149 CategoryPropertyWPtr frames_category_; 00150 CategoryPropertyWPtr tree_category_; 00151 }; 00152 00153 } // namespace rviz 00154 00155 #endif 00156