Convert PointCloud2ConstPtr to PointCloud2
Hello,
I would like to know how to convert convert PointCloud2ConstPtr to PointCloud2. I use these code:
sensor_msgs::PointCloud2ConstPtr kinect_pointcloud_ptr;
kinect_pointcloud_ptr = ros::topic::waitForMessage<sensor_msgs::PointCloud2> ("/voxel_output", ros::Duration (5.0));
std::cerr << "Pointcloud points number: "<< kinect_pointcloud_ptr->width * kinect_pointcloud_ptr->height <<"";
sensor_msgs::PointCloud2ConstPtr p_pointcloud_ptr;
tf2_ros::Buffer tfBuffer;
tf2_ros::TransformListener tfListener(tfBuffer);
geometry_msgs::TransformStamped p_frame_to_kinect2_link;
p_frame_to_kinect2_link = tfBuffer.lookupTransform("kinect2_link", "p_frame", ros::Time::now(), ros::Duration(3.0));
tf2::doTransform(kinect_pointcloud_ptr, p_pointcloud_ptr, p_frame_to_kinect2_link);
And I get some error:
Undefined reference to 「void tf2::doTransform<boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> >(boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const>&, geometry_msgs::TransformStamped_<std::allocator<void> > const&)」
If anyone has good solution to suggest me. It will be nice. Thank!