GridMapRosConverter.hpp
Go to the documentation of this file.
1 /*
2  * GridMapRosConverter.hpp
3  *
4  * Created on: Jul 14, 2014
5  * Author: Péter Fankhauser
6  * Institute: ETH Zurich, ANYbotics
7  */
8 
9 #pragma once
10 
12 #include <grid_map_msgs/GridMap.h>
13 
14 // STL
15 #include <vector>
16 #include <unordered_map>
17 
18 // Eigen
19 #include <Eigen/Core>
20 
21 // ROS
22 #include <ros/ros.h>
23 #include <sensor_msgs/PointCloud2.h>
24 #include <sensor_msgs/Image.h>
26 #include <nav_msgs/OccupancyGrid.h>
27 #include <nav_msgs/GridCells.h>
28 #include <cv_bridge/cv_bridge.h>
29 
30 namespace grid_map {
31 
36 {
37  public:
42 
46  virtual ~GridMapRosConverter();
47 
54  static bool fromMessage(const grid_map_msgs::GridMap& message, grid_map::GridMap& gridMap);
55 
61  static void toMessage(const grid_map::GridMap& gridMap, grid_map_msgs::GridMap& message);
62 
69  static void toMessage(const grid_map::GridMap& gridMap, const std::vector<std::string>& layers,
70  grid_map_msgs::GridMap& message);
71 
80  static void toPointCloud(const grid_map::GridMap& gridMap,
81  const std::string& pointLayer,
82  sensor_msgs::PointCloud2& pointCloud);
83 
93  static void toPointCloud(const grid_map::GridMap& gridMap,
94  const std::vector<std::string>& layers,
95  const std::string& pointLayer,
96  sensor_msgs::PointCloud2& pointCloud);
97 
105  static bool fromOccupancyGrid(const nav_msgs::OccupancyGrid& occupancyGrid,
106  const std::string& layer, grid_map::GridMap& gridMap);
107 
117  static void toOccupancyGrid(const grid_map::GridMap& gridMap, const std::string& layer,
118  float dataMin, float dataMax, nav_msgs::OccupancyGrid& occupancyGrid);
119 
130  static void toGridCells(const grid_map::GridMap& gridMap, const std::string& layer,
131  float lowerThreshold, float upperThreshold,
132  nav_msgs::GridCells& gridCells);
133 
143  static bool initializeFromImage(const sensor_msgs::Image& image, const double resolution,
144  grid_map::GridMap& gridMap,
145  const grid_map::Position& position = grid_map::Position::Zero());
146 
159  static bool addLayerFromImage(const sensor_msgs::Image& image, const std::string& layer,
160  grid_map::GridMap& gridMap, const float lowerValue = 0.0,
161  const float upperValue = 1.0, const double alphaThreshold = 0.5);
162 
170  static bool addColorLayerFromImage(const sensor_msgs::Image& image, const std::string& layer,
171  grid_map::GridMap& gridMap);
172 
183  static bool toImage(const grid_map::GridMap& gridMap, const std::string& layer,
184  const std::string encoding, sensor_msgs::Image& image);
185 
196  static bool toImage(const grid_map::GridMap& gridMap, const std::string& layer,
197  const std::string encoding, const float lowerValue, const float upperValue,
198  sensor_msgs::Image& image);
199 
210  static bool toCvImage(const grid_map::GridMap& gridMap, const std::string& layer,
211  const std::string encoding, cv_bridge::CvImage& cvImage);
212 
223  static bool toCvImage(const grid_map::GridMap& gridMap, const std::string& layer,
224  const std::string encoding, const float lowerValue,
225  const float upperValue, cv_bridge::CvImage& cvImage);
226 
237  static bool saveToBag(const grid_map::GridMap& gridMap, const std::string& pathToBag,
238  const std::string& topic);
239 
247  static bool loadFromBag(const std::string& pathToBag, const std::string& topic,
248  grid_map::GridMap& gridMap);
249 
250 };
251 
252 } /* namespace */
static void toMessage(const grid_map::GridMap &gridMap, grid_map_msgs::GridMap &message)
static bool toImage(const grid_map::GridMap &gridMap, const std::string &layer, const std::string encoding, sensor_msgs::Image &image)
static bool fromOccupancyGrid(const nav_msgs::OccupancyGrid &occupancyGrid, const std::string &layer, grid_map::GridMap &gridMap)
static void toPointCloud(const grid_map::GridMap &gridMap, const std::string &pointLayer, sensor_msgs::PointCloud2 &pointCloud)
static void toOccupancyGrid(const grid_map::GridMap &gridMap, const std::string &layer, float dataMin, float dataMax, nav_msgs::OccupancyGrid &occupancyGrid)
static bool loadFromBag(const std::string &pathToBag, const std::string &topic, grid_map::GridMap &gridMap)
static bool initializeFromImage(const sensor_msgs::Image &image, const double resolution, grid_map::GridMap &gridMap, const grid_map::Position &position=grid_map::Position::Zero())
static bool fromMessage(const grid_map_msgs::GridMap &message, grid_map::GridMap &gridMap)
Eigen::Vector2d Position
static bool saveToBag(const grid_map::GridMap &gridMap, const std::string &pathToBag, const std::string &topic)
static bool addColorLayerFromImage(const sensor_msgs::Image &image, const std::string &layer, grid_map::GridMap &gridMap)
static void toGridCells(const grid_map::GridMap &gridMap, const std::string &layer, float lowerThreshold, float upperThreshold, nav_msgs::GridCells &gridCells)
static bool toCvImage(const grid_map::GridMap &gridMap, const std::string &layer, const std::string encoding, cv_bridge::CvImage &cvImage)
static bool addLayerFromImage(const sensor_msgs::Image &image, const std::string &layer, grid_map::GridMap &gridMap, const float lowerValue=0.0, const float upperValue=1.0, const double alphaThreshold=0.5)


grid_map_ros
Author(s): Péter Fankhauser
autogenerated on Tue Jun 25 2019 20:02:19