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

point cloud is transformed wrong

asked 2012-10-19 06:05:27 -0500

niosus gravatar image

updated 2014-11-22 17:05:28 -0500

ngrennan gravatar image

Hi all,

I'm not sure what information would be sufficient for this question, so please feel free to ask about any details.

The problem is as follows: I have recorded a dataset with kinect, based on the PR2, which provides the tf topic. I then construct the point clouds from depth images and want to translate those point clouds into the world frame. I know, that the world frame is represented by /odom_combined and camera frame by /head_mount_kinect_rgb_link, so I lookup the transform:

listener.lookupTransform("/head_mount_kinect_rgb_link", "/odom_combined", time, transform);

And apply it to the point cloud via

pcl_ros::transformPointCloud(*filteredCloud,*filteredCloud,transform);

This works, but gives some strange results. As I have recorded the dataset with the robot, I definitely know how it looks and that the camera was only rotating with the robot base, so the floor should normally stay horizontal, while in my case whenever the robot turns the floor starts turning so it starts to look like a wall and then eventually as ceiling. I know this may be a bad way to explain the situation, but for now it's the best I can do.

Does anyone have any idea what happens there and what can be done to avoid keep the floor horizontal?

Thanks in advance.

UPD: It seems like the wrong rotation is performed on the point cloud. So, when the robot turns around the y axes the point cloud is turned around the x (??) axes. And that seems to be the problem. Could maybe anyone suggest how to deal with that?

UPD2: Added the tf_frames.pdf on my google drive

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2012-10-25 02:44:52 -0500

niosus gravatar image

Hi all! I have asked in the lab and eventually the problem is solved. The problems were in 2 different places. The first one was that I used the ros::Time(0) instead of the timestamp already provided my info message from the camera i.e. info_msg->header.stamp. The second one was that I got confused with the order of the topics to give into the "lookuptransform" function. The correct order should be (as suggested by @Mac):

listener.lookupTransform( "/odom_combined",filteredCloud->header.frame_id, time, transform);

After that I get the expected result. Thanks everyone for help.

edit flag offensive delete link more
2

answered 2012-10-20 04:38:55 -0500

updated 2012-10-23 06:01:03 -0500

Are you sure you are using the correct frame? I recommend changing to:

listener.lookupTransform(filteredCloud->header.frame_id, "/odom_combined", filteredCloud->header.stamp, transform);

Of course this only works if the cloud has the correct frame when arriving, and you haven't yet modified it. Speaking of which, make sure you set the correct frame after you transform:

pcl_ros::transformPointCloud(*filteredCloud, *filteredCloud, transform);
filteredCloud->header.frame_id = "/odom_combined"

EDIT

Based on the attached pdf of the frames, it appears that the correct frame for your cloud might be /head_mount_kinect_rgb_optical_frame and not /head_mount_kinect_rgb_link.

edit flag offensive delete link more

Comments

Thanks for the answer.I'm not sure if it has the correct frame when arriving as I create it myself from the depth image topic. But I'm sure which frame SHOULD produce it.

niosus gravatar image niosus  ( 2012-10-21 08:14:42 -0500 )edit

Have you verified the frame orientation, in the start? Maybe it's a mixup between the camera frame and camera optical frame

Ivan Dryanovski gravatar image Ivan Dryanovski  ( 2012-10-21 10:21:22 -0500 )edit

No and I'm afraid I don't understand what do you mean by "varifying the orientation of the frame in the start". Can you tell me more about it?

niosus gravatar image niosus  ( 2012-10-21 22:07:41 -0500 )edit

Could you post the output of "rosrun tf view_frames"

Ivan Dryanovski gravatar image Ivan Dryanovski  ( 2012-10-22 06:56:35 -0500 )edit

added the pdf to my question as an update.

niosus gravatar image niosus  ( 2012-10-22 22:37:02 -0500 )edit
1

answered 2012-10-21 04:32:31 -0500

Mac gravatar image

Are you sure you're looking the transform up in the correct direction? You might just have it flipped.

edit flag offensive delete link more

Comments

Tried it both ways, sinse wasn't sure about the direction. Doesn't help.

niosus gravatar image niosus  ( 2012-10-21 08:13:05 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2012-10-19 06:05:27 -0500

Seen: 2,346 times

Last updated: Oct 25 '12