Hi,
When working with PointClouds, I usually subscribe to a sensor_msgs::PointCloud2 topic, and convert to a pcl::PointCloud inside my code. Then, once I'm done mainpulating the cloud, I convert it back to a sensor_msgs::PointCloud2 to publish it, using these functions:
pcl::fromROSMsg
pcl::toROSMsg
My first question is: what is the cost of using these functions? I am assuming there's a memcpy involved, which (when dealing with kinect data) is probably not negligible.
Second: is there a way to avoid this, by directly subscribing/publishing pcl::PointCloud types? I believe that there is a publisher/subscriber for pcl types, but I'm not sure whether it actually saves time, or does the same conversion/memcpy behind the scenes.
Thanks, Ivan
The conversion to and from PCL datatypes is quite computationally expensive. I have observed something like 100ms for a conversion of a Kinect frame on a 1Ghz Atom core.
To avoid this you can use direct publication of pcl datatypes and nodelets. A very simple example of a nodelet which does this is in the pointcloud_to_laserscan package is cloud_throttle.cpp
When publishing over the network the Kinect data was unusable.
Using nodelets I was able to take processing of the Kinect from 10Hz and 150% cpu to 30Hz and 87% cpu on an Atom by publishing using the exact same data type. Here's a launch file which brings up the kinect and processes the data inside the same process using nodelets.
Asked: 2011-03-23 08:37:45 -0500
Seen: 305 times
Last updated: Mar 25 '11
Failed to load nodelet: Cannot load library: X: undefined symbol: Y
pcl/FeatureFromNormals no incoming messages
Unable to synchronize messages
pcl_tracking in perception_pcl_electric_unstable gives nodelet error
Sensor discovery on runtime with ROS?
how to check if there are waiting messages in a callback queue?
ROS Answers is licensed under Creative Commons Attribution 3.0 Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.