GridMapVisual.hpp
Go to the documentation of this file.
00001 /*
00002  * GridMapVisual.cpp
00003  *
00004  *  Created on: Aug 3, 2016
00005  *  Author: Philipp Krüsi, Péter Fankhauser
00006  *  Institute: ETH Zurich, ANYbotics
00007  */
00008 
00009 #pragma once
00010 
00011 #include <OGRE/OgreMaterial.h>
00012 #include <OGRE/OgreSharedPtr.h>
00013 
00014 #include <grid_map_msgs/GridMap.h>
00015 #include <grid_map_core/GridMap.hpp>
00016 
00017 namespace Ogre {
00018 class Vector3;
00019 class Quaternion;
00020 class ManualObject;
00021 class ColourValue;
00022 }
00023 
00024 namespace rviz {
00025 class BillboardLine;
00026 }
00027 
00028 namespace grid_map_rviz_plugin {
00029 
00030 // Visualizes a single grid_map_msgs::GridMap message.
00031 class GridMapVisual
00032 {
00033  public:
00034   GridMapVisual(Ogre::SceneManager* sceneManager, Ogre::SceneNode* parentNode);
00035   virtual ~GridMapVisual();
00036 
00037   // Copy the grid map data to map_.
00038   void setMessage(const grid_map_msgs::GridMap::ConstPtr& msg);
00039   // Compute the visualization of map_.
00040   void computeVisualization(float alpha, bool showGridLines, bool flatTerrain, std::string heightLayer, bool flatColor,
00041                             bool noColor, Ogre::ColourValue meshColor, bool mapLayerColor, std::string colorLayer,
00042                             bool useRainbow, bool invertRainbow, Ogre::ColourValue minColor, Ogre::ColourValue maxColor,
00043                             bool autocomputeIntensity, float minIntensity, float maxIntensity);
00044 
00045   // Set the coordinate frame pose.
00046   void setFramePosition(const Ogre::Vector3& position);
00047   void setFrameOrientation(const Ogre::Quaternion& orientation);
00048 
00049   // Get grid map layer names.
00050   std::vector<std::string> getLayerNames();
00051 
00052  private:
00053   Ogre::SceneNode* frameNode_;
00054   Ogre::SceneManager* sceneManager_;
00055 
00056   // ManualObject for mesh display.
00057   Ogre::ManualObject* manualObject_;
00058   Ogre::MaterialPtr material_;
00059   std::string materialName_;
00060 
00061   // Lines for mesh.
00062   boost::shared_ptr<rviz::BillboardLine> meshLines_;
00063 
00064   // Grid map.
00065   grid_map::GridMap map_;
00066   bool haveMap_;
00067 
00068   // Helper methods.
00069   void normalizeIntensity(float& intensity, float minIntensity, float maxIntensity);
00070   Ogre::ColourValue getRainbowColor(float intensity);
00071   Ogre::ColourValue getInterpolatedColor(float intensity, Ogre::ColourValue minColor,
00072                                          Ogre::ColourValue maxColor);
00073 };
00074 
00075 }  // namespace


grid_map_rviz_plugin
Author(s): Philipp Krüsi, Péter Fankhauser
autogenerated on Tue Jul 9 2019 05:06:44