Publishing cloud message of pcl::PointXYZ type
I received a very long error when I try to publish a point cloud of type pcl::PointXYZ. I suspect there is no way to publish it using that pcl type, and that I've to convert to ros PointCloud2. Is that the case.
The defined publisher:
point_cloud_pcl_publisher_ = n.advertise<pcl::PointXYZ> ("/cloud_pcl", 100);
Thanks in advance.
EDIT
I declared the publisher as below:
pcl::PointCloud<pcl::PointXYZ> cloud_pcl;
In the header:
#include "ros/ros.h"
#include "std_msgs/String.h"
#include <sstream>
#include <fstream>
#include <sensor_msgs/LaserScan.h>
#include <sensor_msgs/PointCloud.h>
#include <sensor_msgs/PointCloud2.h>
#include <tf/transform_listener.h>
#include <boost/algorithm/string.hpp>
#include "tf/tf.h"
#include "tf/transform_datatypes.h"
#include <tf/transform_broadcaster.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl_ros/point_cloud.h>
The error message:
/opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::MD5Sum<m>::value() [with M = pcl::PointXYZ]’: /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h:228: instantiated from ‘const char* ros::message_traits::md5sum() [with M = pcl::PointXYZ]’ /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/include/ros/advertise_options.h:92: instantiated from ‘void ros::AdvertiseOptions::init(const std::string&, uint32_t, const ros::SubscriberStatusCallback&, const ros::SubscriberStatusCallback&) [with M = pcl::PointXYZ]’ /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/include/ros/node_handle.h:239: instantiated from ‘ros::Publisher ros::NodeHandle::advertise(const std::string&, uint32_t, bool) [with M = pcl::PointXYZ]’ /home/shah/code/ros_workspace/point_cloud_drone/src/pointcloud_builder_node.cpp:192: instantiated from here /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h:121: error: ‘__s_getMD5Sum’ is not a member of ‘pcl::PointXYZ’ /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_traits/include/ros/message_traits.h: In static member function ‘static const char* ros::message_traits::DataType<m>::value() [with M = pcl::PointXYZ]’: