PCL conversions is VERY SLOW

asked 2015-05-28 20:06:47 -0600

frankb gravatar image

Hi all, I am generating pointclouds from a stereo camera using stereo_image_proc at a good speed of 24Hz. However, when I convert from the ROS pointcloud format (sensor_msgs::PointCloud2) to the PCL format (pcl::PointCloud< T >) for PCL processing, there is a drastic slow down even when no processing is done. I have noticed this slow down after a recent Ubuntu software update on May 21st and hence decided to run some tests.

I have tested this with two conversion methods: 1) subscribing as PointCloud< T > for implicit conversion and 2) using fromROSMsg and toROSMsg for direct conversion. In both test cases, I subscribe and immediately re-publish the pointcloud. With conversion: Method (1) yields yields a rate of 12Hz while Method (2) a rate of 8.8Hz. For control purposes; I also tested subscribing as a ROS pointcloud and re-publishing that same ROS pointcloiud. As expected, the control was still 24Hz without conversion.

Method 1: Subscribe directly as a PointCloud< T > while including pcl_ros/point_cloud.h. Described here: http://wiki.ros.org/pcl_ros as well as in my test below: Publishes at 12Hz.

#include <pcl_ros/point_cloud.h>
typedef pcl::PointCloud<pcl::PointXYZ> PointCloud;
.
.
.
void cloud_cb(const PointCloud::ConstPtr& msg)
{
    pub.publish(msg);
    return;
}

Method 2: Subscribe to ROS pointcloud and convert to PCL using fromROSMsg and toROSMsg. Described here: http://wiki.ros.org/pcl/Tutorials#pcl.. . as well as in my test below: Publishes at 8.8Hz.

void cloud_cb(const sensor_msgs::PointCloud2ConstPtr& input)
{
    pcl::PointCloud<pcl::PointXYZ> temp;
    sensor_msgs::PointCloud2 output;

    pcl::fromROSMsg(*input, temp);
    pcl::toROSMsg(temp, output);

    pub.publish(output);
    return;
}

I am running ROS Indigo on Ubuntu 14.04. I remember running a PCL passthrough filter on my cloud last week without issue. I also tested conversions on a friends computer yesterday running an older version of Indigo (prior to the May 21st update). Conversions did not seem to affect his publish rate as he was able to publish at the original 24Hz.

I have tried removing pcl_ros and pcl_conversions using apt-get remove, and installing versions prior to May 21st using git, however, the slow-down still persists. Has anyone else experienced this slow-down? Are there other conversion methods I should know about? Please investigate this and let me know if you are able to re-publish your clouds at the same rate they are coming in at or if you are having this slow-down like me.

Thanks, -Frank

edit retag flag offensive close merge delete

Comments

I have this same problem, have you figured out a solution?

Thanks, Vincent

vkee gravatar image vkee  ( 2016-10-17 12:40:34 -0600 )edit

Any feedback for this?

lahiruherath gravatar image lahiruherath  ( 2018-06-26 08:59:54 -0600 )edit