Ask Your Question

Revision history [back]

Where is your point cloud coming from? If it is a rosbag, try setting the parameter use_sim_time to true and playing it bag with rosbag play --clock <bag>. If it's an actual sensor, is it maybe connected to a different computer and the clocks are not synchronized?

Another, more dirty solution would be to set previous_scan_.header.stamp to ros::Time::now(). Also, make sure that pose3D_LD2.header.stamp and previous_scan_.header.stamp are equal. If not, you need at least two transforms, one before the stamp of your scan and one after it. TF needs to do interpolation if it doesn't have an exact time stamp for which it needs two transforms.

Btw. your waitForTransform call shouldn't use ros::Time(0) but previous_scan_.header.stamp.

Where is your point cloud coming from? If it is a rosbag, try setting the parameter use_sim_time to true and playing it bag back with rosbag play --clock <bag>. If it's an actual sensor, is it maybe connected to a different computer and the clocks are not synchronized?

Another, more dirty solution would be to set previous_scan_.header.stamp to ros::Time::now(). Also, make sure that pose3D_LD2.header.stamp and previous_scan_.header.stamp are equal. If not, you need at least two transforms, one before the stamp of your scan and one after it. TF needs to do interpolation if it doesn't have an exact time stamp for which it needs two transforms.

Btw. your waitForTransform call shouldn't use ros::Time(0) but previous_scan_.header.stamp.