tf_display.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2012, 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 <map>
00034 #include <set>
00035 
00036 #include <OgreQuaternion.h>
00037 #include <OgreVector3.h>
00038 
00039 #include "rviz/selection/forwards.h"
00040 
00041 #include "rviz/display.h"
00042 
00043 namespace Ogre
00044 {
00045 class SceneNode;
00046 }
00047 
00048 namespace rviz
00049 {
00050 class Arrow;
00051 class Axes;
00052 class BoolProperty;
00053 class FloatProperty;
00054 class MovableText;
00055 class QuaternionProperty;
00056 class StringProperty;
00057 class VectorProperty;
00058 
00059 class FrameInfo;
00060 class FrameSelectionHandler;
00061 typedef boost::shared_ptr<FrameSelectionHandler> FrameSelectionHandlerPtr;
00062 
00064 class TFDisplay: public Display
00065 {
00066 Q_OBJECT
00067 public:
00068   TFDisplay();
00069   virtual ~TFDisplay();
00070 
00071   virtual void update(float wall_dt, float ros_dt);
00072 
00073 protected:
00074   // Overrides from Display
00075   virtual void onInitialize();
00076   virtual void fixedFrameChanged();
00077   virtual void reset();
00078 
00079 private Q_SLOTS:
00080   void updateShowAxes();
00081   void updateShowArrows();
00082   void updateShowNames();
00083   void allEnabledChanged();
00084 
00085 private:
00086   void updateFrames();
00087   FrameInfo* createFrame(const std::string& frame);
00088   void updateFrame(FrameInfo* frame);
00089   void deleteFrame(FrameInfo* frame, bool delete_properties);
00090 
00091   FrameInfo* getFrameInfo(const std::string& frame);
00092 
00093   void clear();
00094 
00095   // overrides from Display
00096   virtual void onEnable();
00097   virtual void onDisable();
00098 
00099   Ogre::SceneNode* root_node_;
00100   Ogre::SceneNode* names_node_;
00101   Ogre::SceneNode* arrows_node_;
00102   Ogre::SceneNode* axes_node_;
00103 
00104   typedef std::map<std::string, FrameInfo*> M_FrameInfo;
00105   M_FrameInfo frames_;
00106 
00107   float update_timer_;
00108 
00109   BoolProperty* show_names_property_;
00110   BoolProperty* show_arrows_property_;
00111   BoolProperty* show_axes_property_;
00112   FloatProperty* update_rate_property_;
00113   FloatProperty* frame_timeout_property_;
00114   BoolProperty* all_enabled_property_;
00115 
00116   FloatProperty* scale_property_;
00117 
00118   Property* frames_category_;
00119   Property* tree_category_;
00120 
00121   bool changing_single_frame_enabled_state_;
00122   friend class FrameInfo;
00123 };
00124 
00126 class FrameInfo: public QObject
00127 {
00128   Q_OBJECT
00129   public:
00130   FrameInfo( TFDisplay* display );
00131 
00133   void setEnabled( bool enabled );
00134 
00135 public Q_SLOTS:
00137   void updateVisibilityFromFrame();
00138 
00140   void updateVisibilityFromSelection();
00141 
00142 public:
00143   TFDisplay* display_;
00144   std::string name_;
00145   std::string parent_;
00146   Axes* axes_;
00147   CollObjectHandle axes_coll_;
00148   FrameSelectionHandlerPtr selection_handler_;
00149   Arrow* parent_arrow_;
00150   MovableText* name_text_;
00151   Ogre::SceneNode* name_node_;
00152 
00153   float distance_to_parent_;
00154   Ogre::Quaternion arrow_orientation_;
00155 
00156   ros::Time last_update_;
00157   ros::Time last_time_to_fixed_;
00158 
00159   VectorProperty* rel_position_property_;
00160   QuaternionProperty* rel_orientation_property_;
00161   VectorProperty* position_property_;
00162   QuaternionProperty* orientation_property_;
00163   StringProperty* parent_property_;
00164   BoolProperty* enabled_property_;
00165 
00166   Property* tree_property_;
00167 };
00168 
00169 } // end namespace rviz
00170 
00171 #endif // RVIZ_TF_DISPLAY_H


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Thu Aug 27 2015 15:02:28