converter.hpp
Go to the documentation of this file.
00001 
00014 /*****************************************************************************
00015 ** Ifdefs
00016 *****************************************************************************/
00017 
00018 #ifndef cost_map_ros_CONVERTER_HPP_
00019 #define cost_map_ros_CONVERTER_HPP_
00020 
00021 /*****************************************************************************
00022 ** Includes
00023 *****************************************************************************/
00024 
00025 // grid maps
00026 #include <grid_map_core/grid_map_core.hpp>
00027 #include <grid_map_ros/grid_map_ros.hpp>
00028 #include <grid_map_costmap_2d/grid_map_costmap_2d.hpp>
00029 #include <cost_map_core/cost_map_core.hpp>
00030 #include <cost_map_msgs/CostMap.h>
00031 #include <cost_map_msgs/GetCostMap.h>
00032 
00033 // ros
00034 #include <costmap_2d/costmap_2d_ros.h>
00035 #include <nav_msgs/OccupancyGrid.h>
00036 
00037 // general
00038 #include <string>
00039 
00040 /*****************************************************************************
00041 ** Namespaces
00042 *****************************************************************************/
00043 
00044 namespace cost_map {
00045 
00046 /*****************************************************************************
00047 ** CostMap and GridMap
00048 *****************************************************************************/
00049 
00056 void toGridMap(const cost_map::CostMap cost_map, grid_map::GridMap& grid_map);
00057 
00058 /*****************************************************************************
00059 ** ROS Messages
00060 *****************************************************************************/
00061 
00067 void toMessage(const cost_map::CostMap& cost_map, cost_map_msgs::CostMap& message);
00068 
00075 bool fromMessage(const cost_map_msgs::CostMap& message, cost_map::CostMap& cost_map);
00076 
00077 /*****************************************************************************
00078 ** ROS Images
00079 *****************************************************************************/
00080 
00081 bool addLayerFromROSImage(const sensor_msgs::Image& image,
00082                           const std::string& layer_name,
00083                           cost_map::CostMap& cost_map
00084                           );
00085 
00086 /*****************************************************************************
00087 ** Ros CostMap2D & Occupancy Grids
00088 *****************************************************************************/
00089 /*
00090  * There are various ways we can pull from ros costmaps. Build up a suite
00091  * of functions as we need to.
00092  */
00093 
00108 bool fromCostmap2DROS(costmap_2d::Costmap2DROS& ros_costmap,
00109                       const std::string& layer_name,
00110                       cost_map::CostMap& cost_map);
00111 
00128 bool fromCostmap2DROSAtRobotPose(costmap_2d::Costmap2DROS& ros_costmap,
00129                                  const cost_map::Length& geometry,
00130                                  const std::string& layer_name,
00131                                  cost_map::CostMap& cost_map);
00132 
00133 void toOccupancyGrid(const cost_map::CostMap& cost_map, const std::string& layer, nav_msgs::OccupancyGrid& msg);
00134 
00138 class Costmap2DROSServiceProvider {
00139 public:
00140   Costmap2DROSServiceProvider(costmap_2d::Costmap2DROS* ros_costmap,
00141                               const std::string& service_name="get_cost_map");
00142   Costmap2DROSServiceProvider(costmap_2d::Costmap2DROS* ros_costmap, ros::NodeHandle& node_handle,
00143                               const std::string& service_name="get_cost_map");
00144 
00145   bool callback(cost_map_msgs::GetCostMap::Request  &req,
00146                 cost_map_msgs::GetCostMap::Response &res);
00147 private:
00148   costmap_2d::Costmap2DROS* ros_costmap;
00149   ros::ServiceServer service;
00150 };
00151 
00152 /*****************************************************************************
00153 ** Trailers
00154 *****************************************************************************/
00155 
00156 } // namespace cost_map
00157 
00158 #endif /* cost_map_ros_CONVERTER_HPP_ */


cost_map_ros
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 20:27:54