ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Why is pcl_ros::transformPointCloud changing the frame_id

asked 2015-01-23 09:37:41 -0500

Tobias Neumann gravatar image

Hi, if got the following code:

cloud_out->header.frame_id = "<out_frame>";

tf_listener_->lookupTransform( frame_out, frame_in, stamp, transform);

ROS_INFO("Frame before: %s", cloud_out->header.frame_id.c_str());
pcl_ros::transformPointCloud( *cloud_in, *cloud_out, transform );
ROS_INFO("Frame after : %s", cloud_out->header.frame_id.c_str());

The first output, gives out_frame, but after the transformation the frame is set to the frame of cloud_in

For me this looks like an error, is there a reason to change the frame_id like this?

edit retag flag offensive close merge delete

Comments

are these sensor_msgs Pointcloud2s or pcl::Pointclouds?

paulbovbel gravatar image paulbovbel  ( 2015-01-29 12:11:35 -0500 )edit

They are both pcl::PointCloud<pcl::pointxyzi>::Ptr

Tobias Neumann gravatar image Tobias Neumann  ( 2015-01-30 02:28:14 -0500 )edit

Which version of ROS?

paulbovbel gravatar image paulbovbel  ( 2015-01-30 07:48:58 -0500 )edit

sry, its Ubuntu 12.04 with Hydro and pcl-1.7

Tobias Neumann gravatar image Tobias Neumann  ( 2015-01-30 11:20:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-02-03 16:24:00 -0500

paulbovbel gravatar image

updated 2015-02-06 18:48:08 -0500

So, this is not actually a bug.

The cloud_out parameter passed in by reference is pretty much just a placeholder for allocation, and not expected to contain any useful data. These types of functions are everywhere in tf. The Transform object that you feed to ::transformPointCloud actually doesn't have any header information attached (not a StampedTransform), so this function is not expected to be doing anything useful with headers, it simply applies the transform to cloud_in, and overwrites cloud_out.

Anyways, the function call you're actually looking for is http://docs.ros.org/indigo/api/pcl_ro... , where you supply the target frame and a listener. That call will actually chain to the one you're using, and update the header after the transformation is applied.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-01-23 09:37:41 -0500

Seen: 1,078 times

Last updated: Feb 06 '15