0
$\begingroup$

Rosanswers logo

Hey there,

I tried to write some pretty simple code with tf2 and I'm stuck already.

How does one transform a pcl::PointCloud<...> when using tf2 (and, less importantly, how about transforming a sensor_msgs/PointCloud2)? With tf there is the pcl_ros package which can transform pcl-PointClouds with tf::Transform. There's also pcl's own transformation interface pcl::transformPointCloud which takes Transforms as Eigen matrices.

However, tf2_ros::Buffer::lookupTransform, which seems to be the right interface to use, only returns geometry_msgs::TransformStamped and I can't find a one-liner to convert these (or, well, more likely the wrapped geometry_msgs::Transform to Eigen::Matrix4f or similar.


Originally posted by v4hn on ROS Answers with karma: 2950 on 2014-09-29

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

@Vincent Rabaud recently opened a pull request to add support for exactly that. The pull-request is here. https://github.com/ros/geometry_experimental/pull/71 It will probably be merged and deployed after a review.


Originally posted by tfoote with karma: 58457 on 2014-09-29

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by v4hn on 2014-09-30:
Thanks, that answers one question.

What do we do about pcl::PointClouds? To use pcl::transformPointCloud we'd need a function to convert geometry_msgs::Transform to Eigen::Matrix4f. Could tf2::convert do that?

Otoh, pcl_ros is quite useful already, so how about extending its transforms.h?

Comment by v4hn on 2014-09-30:
Should the latter be done by adding pcl_ros::transformPointCloud functions for geometry_msgs::TransformStamped (which makes sense in the context of pcl_ros) or by adding tf2::doTransform functions there (which makes sense in the context of tf2)?

Comment by tfoote on 2014-09-30:
If you want to use the pcl transform function, just use eigen_conversions to convert the transform into the needed eigen matrix.

Comment by v4hn on 2014-10-01:
Thanks, I didn't know about that package!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.