1#ifndef MESH_TO_GRID_MAP_CONVERTER_H
2#define MESH_TO_GRID_MAP_CONVERTER_H
4#include <grid_map_msgs/ProcessFile.h>
5#include <pcl/PolygonMesh.h>
6#include <pcl_msgs/PolygonMesh.h>
7#include <pcl_ros/point_cloud.h>
8#include <ros/package.h>
10#include <std_srvs/Empty.h>
12#include <grid_map_core/GridMap.hpp>
15namespace mesh_to_grid_map {
17constexpr double kDefaultGridMapResolution = 0.2;
18static const std::string kDefaultLayerName =
"elevation";
19constexpr bool kDefaultLatchGridMapPub =
true;
20constexpr bool kDefaultVerbose =
false;
21static const std::string kDefaultFrameIdMeshLoaded =
"map";
22static const std::string kDefaultWorldName =
"flat";
30 void subscribeToTopics();
31 void advertiseTopics();
32 void advertiseServices();
33 void getParametersFromRos();
36 void meshCallback(
const pcl_msgs::PolygonMesh& mesh);
39 bool saveGridMapService(grid_map_msgs::ProcessFile::Request& request,
40 grid_map_msgs::ProcessFile::Response& response);
43 bool loadMeshService(grid_map_msgs::ProcessFile::Request& request,
44 grid_map_msgs::ProcessFile::Response& response);
47 bool loadMeshFromFile(
const std::string& path_to_mesh_to_load);
50 bool meshToGridMap(
const pcl::PolygonMesh& polygon_mesh,
51 const std::string& mesh_frame_id,
52 const uint64_t& time_stamp_nano_seconds);
55 bool saveGridMap(
const grid_map::GridMap& map,
56 const std::string& path_to_file,
57 const std::string& topic_name);
61 ros::NodeHandle nh_private_;
64 ros::Subscriber mesh_sub_;
67 ros::Publisher grid_map_pub_;
70 ros::ServiceServer save_grid_map_srv_;
73 std::unique_ptr<grid_map::GridMap> last_grid_map_ptr_;
76 double grid_map_resolution_;
77 std::string layer_name_;
78 std::string world_name_;
81 bool latch_grid_map_pub_;
85 ros::ServiceServer load_map_service_server_;
86 std::string frame_id_mesh_loaded_;
Definition: mesh_to_grid_map_converter.hpp:24