Ask Your Question
1

PointCloud subscriber/publisher types

asked 2011-03-23 08:37:45 -0500

Ivan Dryanovski gravatar image Ivan Dryanovski flag of United States
3569 36 54 81
http://robotics.ccny.cuny...

updated 2011-03-25 02:04:13 -0500

tfoote gravatar image tfoote flag of United States
17349 47 150 244
http://www.ros.org/

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

edit retag flag offensive close delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-03-25 02:04:02 -0500

tfoote gravatar image tfoote flag of United States
17349 47 150 244
http://www.ros.org/

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.

edit flag offensive delete publish link more

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

subscribe to rss feed

Stats

Asked: 2011-03-23 08:37:45 -0500

Seen: 305 times

Last updated: Mar 25 '11