Go to the documentation of this file.00001
00014
00015
00016
00017
00018 #ifndef cost_map_ros_CONVERTER_HPP_
00019 #define cost_map_ros_CONVERTER_HPP_
00020
00021
00022
00023
00024
00025
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
00034 #include <costmap_2d/costmap_2d_ros.h>
00035 #include <nav_msgs/OccupancyGrid.h>
00036
00037
00038 #include <string>
00039
00040
00041
00042
00043
00044 namespace cost_map {
00045
00046
00047
00048
00049
00056 void toGridMap(const cost_map::CostMap cost_map, grid_map::GridMap& grid_map);
00057
00058
00059
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
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
00088
00089
00090
00091
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
00154
00155
00156 }
00157
00158 #endif