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

Using launch file: tf.Exception: Lookup would require extrapolation into the past

asked 2015-10-07 10:53:08 -0500

leovetto gravatar image

Hi, I am using two nodes: the first is a stage from stage_ros, the second is a controller for the robot that I wrote in python. I started using the nodes separately, launching the first from a launch file:

 <launch>
    <node name="stage" pkg="stage_ros" type="stageros"
    args="$(find stage_ros)/world/willow-erratic.world"/>
</launch>

The second from terminal with "rosrun ...". In this way all works fine. If I try to insert the second node in the launch file modifying the launch file in this way

<launch>
    <node name="stage" pkg="stage_ros" type="stageros"
    args="$(find stage_ros)/world/willow-erratic.world"/>

    <node name="controller2" pkg="simplebot" type="controller2.py"/>
</launch>

and now I have some problems with the tf transformation that was working perfectly before. Here is the error that I get when I launch the new launch file:

tf.Exception: Lookup would require extrapolation into the past.  Requested time 4.900000000 but the earliest data is at time 1444231224.668656111, when looking up transform from frame [target] to frame [base_laser_link]. canTransform returned after 5.00914 timeout was 5.

Here is the code that can have something to do with the transformation:

self.sub = rospy.Subscriber('/base_scan', LaserScan, self.laser_callback, queue_size=1)
....
time = rospy.Time(0)
self.tf_listener.waitForTransform('/base_laser_link','/target', time, rospy.Duration(5.0))
(self.t_pos, self.t_ang) = self.tf_listener.lookupTransform('/base_laser_link','/target', time)
....
def position_callback(self, data):
    ...
    #send the target position to tf
    self.br.sendTransform(
        (self.x_target, self.y_target, 0.0), (0.0, 0.0, 0.0, 1.0),
        rospy.Time.now(), '/target', '/odom')

So the problem is that I don't understand why it was working launching the two nodes separately and why is not working with the two nodes in the same launch file

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-03-27 20:50:06 -0500

DinnerHowe gravatar image

i met this error as well, did u figure out how where does it came from?

edit flag offensive delete link more

Comments

hi,bro, i work it out. i think you problem is u start a listener before you launch a broadcaster . u child frame '/target' is built after you listened it. so maybe, it's the reason why it said 'Requested time 4.900000000 but the earliest data is at time *'

DinnerHowe gravatar image DinnerHowe  ( 2016-03-28 02:01:22 -0500 )edit

Question Tools

Stats

Asked: 2015-10-07 10:53:08 -0500

Seen: 683 times

Last updated: Mar 27 '16