map_display.h
Go to the documentation of this file.
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_MAP_DISPLAY_H
00031 #define RVIZ_MAP_DISPLAY_H
00032 
00033 #include "rviz/display.h"
00034 #include "rviz/properties/forwards.h"
00035 
00036 #include <OGRE/OgreTexture.h>
00037 #include <OGRE/OgreMaterial.h>
00038 #include <OGRE/OgreVector3.h>
00039 
00040 #include <nav_msgs/MapMetaData.h>
00041 #include <ros/time.h>
00042 
00043 #include <boost/thread/thread.hpp>
00044 #include <boost/thread/mutex.hpp>
00045 
00046 #include <nav_msgs/OccupancyGrid.h>
00047 
00048 namespace Ogre
00049 {
00050 class SceneNode;
00051 class ManualObject;
00052 }
00053 
00054 namespace rviz
00055 {
00056 
00062 class MapDisplay : public Display
00063 {
00064 public:
00065   MapDisplay();
00066   virtual ~MapDisplay();
00067 
00068   void onInitialize();
00069 
00070   void setTopic( const std::string& topic );
00071   const std::string& getTopic() { return topic_; }
00072 
00073   float getResolution() { return resolution_; }
00074   int getWidth() { return width_; }
00075   int getHeight() { return height_; }
00076   Ogre::Vector3 getPosition() { return position_; }
00077   Ogre::Quaternion getOrientation() { return orientation_; }
00078 
00079   float getAlpha() { return alpha_; }
00080   void setAlpha( float alpha );
00081 
00082   bool getDrawUnder() { return draw_under_; }
00083   void setDrawUnder(bool write);
00084 
00085   // Overrides from Display
00086   virtual void targetFrameChanged() {}
00087   virtual void fixedFrameChanged();
00088   virtual void createProperties();
00089   virtual void update(float wall_dt, float ros_dt);
00090   virtual void reset();
00091 
00092 protected:
00093   // overrides from Display
00094   virtual void onEnable();
00095   virtual void onDisable();
00096 
00097   void subscribe();
00098   void unsubscribe();
00099 
00100   void incomingMap(const nav_msgs::OccupancyGrid::ConstPtr& msg);
00101 
00102   void clear();
00103   void load(const nav_msgs::OccupancyGrid::ConstPtr& msg);
00104   void transformMap();
00105 
00106   void requestThreadFunc();
00107 
00108   Ogre::SceneNode* scene_node_;
00109   Ogre::ManualObject* manual_object_;
00110   Ogre::TexturePtr texture_;
00111   Ogre::MaterialPtr material_;
00112   bool loaded_;
00113 
00114   std::string topic_;
00115   float resolution_;
00116   int width_;
00117   int height_;
00118   Ogre::Vector3 position_;
00119   Ogre::Quaternion orientation_;
00120   std::string frame_;
00121   nav_msgs::OccupancyGrid::ConstPtr map_;
00122 
00123   float alpha_;
00124   bool draw_under_;
00125 
00126   ros::Subscriber map_sub_;
00127 
00128   ROSTopicStringPropertyWPtr topic_property_;
00129   FloatPropertyWPtr resolution_property_;
00130   IntPropertyWPtr width_property_;
00131   IntPropertyWPtr height_property_;
00132   Vector3PropertyWPtr position_property_;
00133   QuaternionPropertyWPtr orientation_property_;
00134   FloatPropertyWPtr alpha_property_;
00135   BoolPropertyWPtr draw_under_property_;
00136 };
00137 
00138 } // namespace rviz
00139 
00140  #endif


rviz_qt
Author(s): Dave Hershberger
autogenerated on Fri Dec 6 2013 20:56:52