Hi all, I am digging deep in this forum, but I'm getting lost. I am using ROS Groovy and receiving a sensor_msgs::PointCloud2 from a depth_image_proc nodelet and I want to process it using PCL 1.7. None of the solutions found in this forum are working for me, i.e., I miss some function prototype of toPCL, fromROSMsg, etc. functions.
I would like to do something like:
void CloudViewerPlugin::pointcloudCallback(const sensor_msgs::PointCloud2::ConstPtr& msg) {
pcl::PointCloud<pcl::PointXYZ> cloud;
pcl::PCLPointCloud2 pcl_pc;
pcl_conversions::toPCL(*msg, pcl_pc);
pcl::fromPCLPointCloud2(pcl_pc, cloud);
or
void CloudViewerPlugin::pointcloudCallback(const sensor_msgs::PointCloud2::ConstPtr& msg) {
pcl::PointCloud<pcl::PointXYZ> cloud;
pcl::fromROSMsg(*msg, cloud);
but I found no function prototype to do this.
Originally posted by madmage on ROS Answers with karma: 293 on 2014-03-07
Post score: 10
Original comments
Comment by dornhege on 2014-03-07:
Can you try to directly subscribe to a pcl pointcloud? There might be some pcl_ros magic going on that allows you to do so.
Comment by madmage on 2014-03-07:
Hi Christian,
I already tried that solution, but:
/opt/ros/groovy/include/ros/message_traits.h:121: error: ‘__s_getMD5Sum’ is not a member of ‘pcl::PointCloudpcl::PointXYZ’
on the subscribe line
(I'm following http://wiki.ros.org/pcl_ros)
Comment by madmage on 2014-03-07:
Sorry, I hadn't #included the right files, however, now there are two errors:
/opt/ros/groovy/include/pcl_ros/point_cloud.h:176: error: no matching function for call to ‘createMapping(std::vector<sensor_msgs::PointField_std::allocator<void > >&, pcl::MsgFieldMap&)’
and:
/opt/ros/groovy/include/ros/serialization.h:134: error: ‘struct pcl::PCLHeader’ has no member named ‘deserialize’
Comment by Rufus on 2020-04-12:
I believe your second option fromRosMsg
is only available fron Kinetic onwards