ROS2- performance issue in custom transformPointCloud function compared to pcl_ros::transformPointCloud function.

asked 2020-07-28 07:55:11 -0500

AmAppu gravatar image

updated 2020-07-29 02:58:36 -0500


While I am porting my code from ROS1 to ROS2, I used the following function in ROS2 (code is taken from pcl_ros library transforms.hpp function) instead of pcl_ros::transformPointCloud (const pcl::PointCloud <pcl::pointxyzi> &cloud_in, pcl::PointCloud <pcl::pointxyzi> &cloud_out, const tf::Transform &transform) function, because that the pcl_ros library is not available in ros2 dashing.

transformPointCloud (const pcl::PointCloud <pcl::pointxyzi> &cloud_in, pcl::PointCloud <pcl::pointxyzi> &cloud_out, const tf2::Transform &transform) {
tf::Quaternion q = transform.getRotation ();
Eigen::Quaternionf rotation (q.w (), q.x (), q.y (), q.z ());
tf::Vector3 v = transform.getOrigin (); Eigen::Vector3f origin (v.x (), v.y (), v.z ());
pcl::transformPointCloud (cloud_in, cloud_out, origin, rotation); }

In ROS1, the pcl_ros::transformPointCloud() function takes less than 1 ms to process the PCL data with 65535 number points. But when I tried the same data in ROS2 with the above mentioned code, the code code takes almost 55ms to process the data and most of the time is taken to process the pcl::transformPointCloud (cloud_in, cloud_out, origin, rotation) function (last line of the code).

Any idea, why the custom function takes this much time to process the data?

Is that the pcl_ros library has some performance improvement over the direct usage of PCL library?

I am using ros2-dashing version with PCL-1.8.

edit retag flag offensive close merge delete