0
$\begingroup$

Rosanswers logo

i'm trying to use the gmapping stack with my robot. i broadcast the following tf every 0.05 seconds:

current_time = rospy.Time.now()
odom_quat = tf.transformations.quaternion_about_axis(math.radians(theta), (0, 0, 1))    
laser_quat = tf.transformations.quaternion_about_axis(math.radians(-90), (0, 0, 1))
self.tfBdc.sendTransform((x, y, 0.0), odom_quat, current_time, "/base_link", "/odom")
self.tfBdc.sendTransform((0.16, 0.0, 0.2), laser_quat, rospy.Time.now(), "/base_laser", "/base_link")

i check the result in rviz, if i set the fixed frame as 'base_laser' in the 'global options' tag, everything seems to be fine(the 'LaserScan' tag is always green). But if i set the fixed frame as 'odom' or 'base_link' in the 'global option' tag, the 'LaserScan' tag just change to red and green from time to time. The error message in the 'LaserScan' tag says that 'unknown reason for transform failure'. How can i fix that?


Originally posted by Kent on ROS Answers with karma: 140 on 2012-11-21

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

On systems such as the PR2, the robot_state_publisher node is used to publish all transforms of a robot model. One important feature of it is that it future-dates static transforms to ensure that static trasnforms can always be looked up. Also have a look at the tf faq and this answer for more information on future-dated transform.

My guess for what happens in your case is that rviz tries to look up the transform between odom (or base_link) to the laser although it hasn't received the transform for the current time yet which will lead to a failure. To fix it, future-date your static transforms.


Originally posted by Lorenz with karma: 22731 on 2012-11-21

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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