grid_map_pcl_loader_node.cpp
Go to the documentation of this file.
1 /*
2  * grid_map_pcl_loader_node.cpp
3  *
4  * Created on: Aug 26, 2019
5  * Author: Edo Jelavic
6  * Institute: ETH Zurich, Robotic Systems Lab
7  */
8 
9 #include <ros/ros.h>
10 
13 
15 #include "grid_map_pcl/helpers.hpp"
16 
17 namespace gm = ::grid_map::grid_map_pcl;
18 
19 int main(int argc, char** argv) {
20  ros::init(argc, argv, "grid_map_pcl_loader_node");
21  ros::NodeHandle nh("~");
23 
24  ros::Publisher gridMapPub;
25  gridMapPub = nh.advertise<grid_map_msgs::GridMap>("grid_map_from_raw_pointcloud", 1, true);
26 
27  grid_map::GridMapPclLoader gridMapPclLoader;
28  const std::string pathToCloud = gm::getPcdFilePath(nh);
29  gridMapPclLoader.loadParameters(gm::getParameterPath());
30  gridMapPclLoader.loadCloudFromPcdFile(pathToCloud);
31 
32  gm::processPointcloud(&gridMapPclLoader, nh);
33 
34  grid_map::GridMap gridMap = gridMapPclLoader.getGridMap();
35  gridMap.setFrameId(gm::getMapFrame(nh));
36 
37  gm::saveGridMap(gridMap, nh, gm::getMapRosbagTopic(nh));
38 
39  // publish grid map
40 
41  grid_map_msgs::GridMap msg;
43  gridMapPub.publish(msg);
44 
45  // run
46  ros::spin();
47  return EXIT_SUCCESS;
48 }
void publish(const boost::shared_ptr< M > &message) const
std::string getPcdFilePath(const ros::NodeHandle &nh)
Definition: helpers.cpp:57
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
static void toMessage(const grid_map::GridMap &gridMap, grid_map_msgs::GridMap &message)
int argc
void processPointcloud(grid_map::GridMapPclLoader *gridMapPclLoader, const ros::NodeHandle &nh)
Definition: helpers.cpp:95
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ROSCPP_DECL void spin()
char ** argv
std::string getParameterPath()
Definition: helpers.cpp:44
int main(int argc, char **argv)
void setVerbosityLevelToDebugIfFlagSet(const ros::NodeHandle &nh)
Definition: helpers.cpp:31
void saveGridMap(const grid_map::GridMap &gridMap, const ros::NodeHandle &nh, const std::string &mapTopic)
Definition: helpers.cpp:83
void setFrameId(const std::string &frameId)
std::string getMapFrame(const ros::NodeHandle &nh)
Definition: helpers.cpp:65
std::string getMapRosbagTopic(const ros::NodeHandle &nh)
Definition: helpers.cpp:71


grid_map_pcl
Author(s): Dominic Jud , Edo Jelavic
autogenerated on Tue Jun 1 2021 02:13:43