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 load(const Config& config);
00077   virtual void fixedFrameChanged();
00078   virtual void reset();
00079 
00080 private Q_SLOTS:
00081   void updateShowAxes();
00082   void updateShowArrows();
00083   void updateShowNames();
00084   void allEnabledChanged();
00085 
00086 private:
00087   void updateFrames();
00088   FrameInfo* createFrame(const std::string& frame);
00089   void updateFrame(FrameInfo* frame);
00090   void deleteFrame(FrameInfo* frame, bool delete_properties);
00091 
00092   FrameInfo* getFrameInfo(const std::string& frame);
00093 
00094   void clear();
00095 
00096   // overrides from Display
00097   virtual void onEnable();
00098   virtual void onDisable();
00099 
00100   Ogre::SceneNode* root_node_;
00101   Ogre::SceneNode* names_node_;
00102   Ogre::SceneNode* arrows_node_;
00103   Ogre::SceneNode* axes_node_;
00104 
00105   typedef std::map<std::string, FrameInfo*> M_FrameInfo;
00106   M_FrameInfo frames_;
00107 
00108   typedef std::map<std::string, bool> M_EnabledState;
00109   M_EnabledState frame_config_enabled_state_;
00110 
00111   float update_timer_;
00112 
00113   BoolProperty* show_names_property_;
00114   BoolProperty* show_arrows_property_;
00115   BoolProperty* show_axes_property_;
00116   FloatProperty* update_rate_property_;
00117   FloatProperty* frame_timeout_property_;
00118   BoolProperty* all_enabled_property_;
00119 
00120   FloatProperty* scale_property_;
00121 
00122   Property* frames_category_;
00123   Property* tree_category_;
00124 
00125   bool changing_single_frame_enabled_state_;
00126   friend class FrameInfo;
00127 };
00128 
00130 class FrameInfo: public QObject
00131 {
00132   Q_OBJECT
00133   public:
00134   FrameInfo( TFDisplay* display );
00135 
00137   void setEnabled( bool enabled );
00138 
00139 public Q_SLOTS:
00141   void updateVisibilityFromFrame();
00142 
00144   void updateVisibilityFromSelection();
00145 
00146 public:
00147   TFDisplay* display_;
00148   std::string name_;
00149   std::string parent_;
00150   Axes* axes_;
00151   CollObjectHandle axes_coll_;
00152   FrameSelectionHandlerPtr selection_handler_;
00153   Arrow* parent_arrow_;
00154   MovableText* name_text_;
00155   Ogre::SceneNode* name_node_;
00156 
00157   float distance_to_parent_;
00158   Ogre::Quaternion arrow_orientation_;
00159 
00160   ros::Time last_update_;
00161   ros::Time last_time_to_fixed_;
00162 
00163   VectorProperty* rel_position_property_;
00164   QuaternionProperty* rel_orientation_property_;
00165   VectorProperty* position_property_;
00166   QuaternionProperty* orientation_property_;
00167   StringProperty* parent_property_;
00168   BoolProperty* enabled_property_;
00169 
00170   Property* tree_property_;
00171 };
00172 
00173 } // end namespace rviz
00174 
00175 #endif // RVIZ_TF_DISPLAY_H


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Thu Jun 6 2019 18:02:16