PointCloudVisualization.cpp
Go to the documentation of this file.
1 /*
2  * PointCloudVisualization.cpp
3  *
4  * Created on: Sep 11, 2014
5  * Author: Péter Fankhauser
6  * Institute: ETH Zurich, ANYbotics
7  */
8 
11 
12 #include <sensor_msgs/PointCloud2.h>
13 
14 namespace grid_map_visualization {
15 
17  : VisualizationBase(nodeHandle, name)
18 {
19 }
20 
22 {
23 }
24 
26 {
28  if (!getParam("layer", layer_)) {
29  ROS_ERROR("PointCloudVisualization with name '%s' did not find a 'layer' parameter.", name_.c_str());
30  return false;
31  }
32  return true;
33 }
34 
36 {
37  publisher_ = nodeHandle_.advertise<sensor_msgs::PointCloud2>(name_, 1, true);
38  return true;
39 }
40 
42 {
43  if (!isActive()) return true;
44  if (!map.exists(layer_)) {
45  ROS_WARN_STREAM("PointCloudVisualization::visualize: No grid map layer with name '" << layer_ << "' found.");
46  return false;
47  }
48  sensor_msgs::PointCloud2 pointCloud;
50  publisher_.publish(pointCloud);
51  return true;
52 }
53 
54 } /* namespace */
void publish(const boost::shared_ptr< M > &message) const
static void toPointCloud(const grid_map::GridMap &gridMap, const std::string &pointLayer, sensor_msgs::PointCloud2 &pointCloud)
bool exists(const std::string &layer) const
bool getParam(const std::string &name, std::string &value)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define ROS_WARN_STREAM(args)
std::string layer_
Type that is transformed to points.
ros::NodeHandle & nodeHandle_
ROS nodehandle.
std::string name_
Name of the visualization.
ros::Publisher publisher_
ROS publisher of the occupancy grid.
virtual bool readParameters(XmlRpc::XmlRpcValue &config)
PointCloudVisualization(ros::NodeHandle &nodeHandle, const std::string &name)
#define ROS_ERROR(...)


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