0
$\begingroup$

Rosanswers logo

Hi,

I'm trying to transform a Point Cloud from one frame to another. I'm using the method:

transformPointCloud (const std::string &target_frame, const tf::Transform &net_transform, const sensor_msgs::PointCloud2 &in, sensor_msgs::PointCloud2 &out)

I have built a transform tree and it works great. I can see well transformed image in rviz using base_link as map. I need to do some calculations on the PointCloud2 data so i need the points transformed to camera_depth frame. However when I use this method I'm not getting the result needed when I visualize the camera_depth, the image is tilted and not straight as in base_link.

listener.lookupTransform(*camera_depth, *base_link, ros::Time(0), transform);

pcl_ros::transformPointCloud(*camera_depth, transform, *msg, *msgOut);

Originally posted by RosFan19 on ROS Answers with karma: 107 on 2015-03-17

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The problem was that I needed to invert the transform.

pcl_ros::transformPointCloud(*camera_depth, transform.invert(), *msg, *msgOut);

Solved the problem.


Originally posted by RosFan19 with karma: 107 on 2015-03-27

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by paulbovbel on 2015-04-26:
That would be because the API for lookupFrame is:

lookupTransform (const std::string &target_frame, const std::string &source_frame ..)

So it would be more sensible to have *camera_depth as your source frame, and *base_link as your target frame. Didn't catch that.

$\endgroup$

Your Answer

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