Ask Your Question
0

pcl_ros::transformPointCloud says it does not have the transformation

asked 2014-08-21 05:41:01 -0600

madmage gravatar image

updated 2014-08-22 09:24:40 -0600

Hi all, I am using the pcl_ros package in Groovy in order to transform a point cloud in the /map frame (/map -> /odom is given by a localizer node, while /odom -> /rgb_optical_frame is given by a set of transform publishers):

pcl_ros::transformPointCloud(fixedFrame, *cloud, *tcloud, tf_);

However, an exception is raised that says I do not have the transormation from /rgb_optical_frame to /map. If I open rqt and display the transformation tree, this is all connected as expected.

Could it be some issues about timings? How to check them, how to solve?

EDIT: here I add some additional information from the comments I have two machines, on the first machine (I call it sensor-laptop) the following topics are computed: - tf (/map -> /odom, /odom -> /X1_rgb_optical_frame) - point clouds from depth and rgb images

on the second machine (visualization-laptop) I compute the following topics: - point clouds (again) from depth and rgb images sent over the network from sensor-laptop and I am trying to visualize these point clouds using the transformation computed on the other laptop

the two laptops are time-synchronized using chrony, however, the transformPointCloud function says it does not have the transformation:

[ERROR] [1408639544.612446512]: Unable to lookup transform, cache is empty, when looking up transform from frame [/X1_rgb_optical_frame] to frame [/map]

EDIT2: the output of tf_echo and tf_monitor on the visualizer-laptop these outputs have been obtained on visualizer-laptop by setting ROS_MASTER_URI to the address of sensor-laptop

$ rosrun tf tf_echo /map /X1_rgb_optical_frame
Failure at 1408704324.631461344
Exception thrown:Could not find a connection between '/map' and '/X1_rgb_optical_frame' because they are not part of the same tree.Tf has two or more unconnected trees.
The current list of frames is:
Frame /X1_depth_optical_frame exists with parent /X1_depth_frame.
Frame /X1_depth_frame exists with parent /X1_link.
Frame /X2_depth_frame exists with parent /X2_link.
Frame /X2_link exists with parent /base_link.
Frame /X2_depth_optical_frame exists with parent /X2_depth_frame.
Frame /X1_link exists with parent /base_link.
Frame /base_link exists with parent /base_projected.
Frame /X1_rgb_frame exists with parent /X1_link.
Frame /X2_rgb_frame exists with parent /X2_link.
Frame /X2_rgb_optical_frame exists with parent /X2_rgb_frame.
Frame /base_projected exists with parent NO_PARENT.
Frame /imu exists with parent /base_link.
Frame /X1_rgb_optical_frame exists with parent /X1_rgb_frame.
Frame /odom exists with parent /map.
Frame /map exists with parent NO_PARENT.

At time 1408704324.660
- Translation: [0.110, 0.045, 0.540]
- Rotation: in Quaternion [0.496, 0.504, 0.503, 0.497]
            in RPY [1.571, 0.002, 1.585]
At time 1408704324.660
- Translation: [0.110, 0.045, 0.540]
- Rotation: in Quaternion [0.496, 0.504, 0.503, 0.497]
            in RPY [1.571, 0.002, 1.585]
At time 1408704326.660
- Translation: [0.110, 0.045, 0.540]
- Rotation: in Quaternion [0.496, 0.504, 0.503, 0.497]
            in RPY [1.571, 0.002, 1.585]
At time 1408704326.660
- Translation: [0.110, 0.045, 0.540]
- Rotation: in Quaternion [0.496, 0.504, 0.503, 0.497]
            in RPY [1.571, 0.002, 1.585]
At time 1408704328.663
- Translation: [0.110, 0.045, 0.540]
- Rotation: in ...
(more)
edit retag flag offensive close merge delete

Comments

Yes, it most probably is. The actual exception should tell you what the problem is.

dornhege gravatar imagedornhege ( 2014-08-21 05:54:16 -0600 )edit

I have another hypothesis: it could be that you have to somehow tell ROS that the transformation from /rgb_optical_frame to /map is the transformation /rgb_optical_frame->/odom->/map

lucaluca gravatar imagelucaluca ( 2014-08-21 07:06:58 -0600 )edit
2

@lucaluca, the tf library takes care of that

paulbovbel gravatar imagepaulbovbel ( 2014-08-21 09:00:29 -0600 )edit

Yeah you're right, I got confused, but if the tree is connected there's no need to tell ROS anything. Sorry :)

lucaluca gravatar imagelucaluca ( 2014-08-21 09:22:20 -0600 )edit

dornhege, the exception says this: so, it does not mention anything about timing issues

madmage gravatar imagemadmage ( 2014-08-21 09:44:41 -0600 )edit

I think you're missing the actual content here. Can you verify that the time stamp of the point cloud is in the range of the TF times in the listener. Is everything running on a single machine?

dornhege gravatar imagedornhege ( 2014-08-21 09:59:38 -0600 )edit

dornhege, actually this is run on two machines: one with the sensors and the other with the visualizer in the current configuration: clouds and localization (tf) are computed on the sensor-laptop, then clouds are again computed on visualizer-laptop and I take the tf computed on the sensor-laptop

madmage gravatar imagemadmage ( 2014-08-21 10:45:26 -0600 )edit

I cannot send clouds over the network (too large), how can I sync the clouds computed on the visualizer-laptop with the tfs computed on the sensor-laptop?

madmage gravatar imagemadmage ( 2014-08-21 10:46:34 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-08-21 09:05:15 -0600

paulbovbel gravatar image

updated 2014-08-21 13:20:12 -0600

You need call waitForTransform(cloud->header.frame_id, fixedFrame, cloud->header.stamp, ros::Duration(<timeout>)) before trying to transform the point cloud.

If waitForTransform returns true, that means the transform is available and you can call transformPointCloud.


Between the 'cache empty' exception, and your waitForTransform returning false, that implies deeper issues in either your time synchronization, network communication, or a typo like spelling the transform names wrong :)

edit flag offensive delete link more

Comments

it is what I did, I had to remove it in order to read the exception, but actually waitForTransform returns false.. but I have the transform, if I look at rqt tf tree viewer!

madmage gravatar imagemadmage ( 2014-08-21 09:45:30 -0600 )edit

TF considers time as well, so potentially the times are not lining up. The fact that you're running on separate machines is very important, since your computer clocks may not be in sync.

paulbovbel gravatar imagepaulbovbel ( 2014-08-21 11:31:56 -0600 )edit

You should be running chrony on your machines to sync time.

paulbovbel gravatar imagepaulbovbel ( 2014-08-21 11:31:58 -0600 )edit

thanks, I sync'ed the two laptops using chrony, however, dornhege says that the two clouds should get the timestamps of the input images, so they should be lined up

madmage gravatar imagemadmage ( 2014-08-21 11:50:13 -0600 )edit

Two clouds? Afaik we're talking about one cloud, coming from your sensor. That cloud has a timestamp, determined by the sensor-computer's clock. Once that cloud is transmitted to your viz-computer, if the two computers clocks aren't in sync, the timestamp will be inconsistent and cause tf errors.

paulbovbel gravatar imagepaulbovbel ( 2014-08-21 13:15:01 -0600 )edit

TF is distributed, for example, a tfbroadcaster on sensor-computer records the transform for frame a-to-b for duration x-to-y, in context of its own clock. It transmits that data to nodes with tflisteners.

paulbovbel gravatar imagepaulbovbel ( 2014-08-21 13:18:12 -0600 )edit

I said "the two clouds" but I was thinking on the two images (one depth image and one RGB image) that are used to produce one cloud. dornhege says that the timestamp of the resulting cloud should be that of the input images, is that wrong?

madmage gravatar imagemadmage ( 2014-08-22 08:00:38 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-08-21 05:41:01 -0600

Seen: 583 times

Last updated: Aug 22 '14