[ros-users] tf, use_sim_time, --clock, and bag files

Ken Conley kwc at willowgarage.com
Tue Aug 24 05:21:17 UTC 2010


This is a bug with pytf that is being fixed, but requires enough code
to be more than a quick fix. The pytf code is based on a roscpp-based
codebase and has issues with simulated time when running in rospy,
which is not roscpp-based. So, pytf does not work with simulated time.

 - Ken

On Mon, Aug 23, 2010 at 10:07 PM, Travis Deyle <beambot at gmail.com> wrote:
> I have a vexing "bug."  Perhaps someone can clarify.  For reference, I'm
> using cturtle binaries, running "rosbag play --clock mybagfile.bag" and have
> set /use_sim_time to true in both my python code and using rosparam.
>
> Basically, when I try to wait for a transform, this works:
>
>             rospy.logout( 'Time read: %d.%d' % ( mymsg.header.stamp.secs,
> mymsg.header.stamp.nsecs ))
>             now = rospy.Time.now()
>             rospy.logout( 'Rospy Now: %d.%d' % ( now.secs, now.nsecs ))
>             self.tf_listener.waitForTransform( frame, '/map',
>                                                rospy.Time(),
>                                                timeout = rospy.Duration(0.1)
> )
>
>
> Whereas this fails:
>
>             rospy.logout( 'Time read: %d.%d' % ( mymsg.header.stamp.secs,
> mymsg.header.stamp.nsecs ))
>             now = rospy.Time.now()
>             rospy.logout( 'Rospy Now: %d.%d' % ( now.secs, now.nsecs ))
>             self.tf_listener.waitForTransform( frame, '/map',
>                                                mymsg.header.stamp,
>                                                timeout = rospy.Duration(0.1)
> )
>
> This also fails:
>
>             rospy.logout( 'Time read: %d.%d' % ( mymsg.header.stamp.secs,
> mymsg.header.stamp.nsecs ))
>             now = rospy.Time.now()
>             rospy.logout( 'Rospy Now: %d.%d' % ( now.secs, now.nsecs ))
>             self.tf_listener.waitForTransform( frame, '/map',
>                                                rospy.Time.now(),
>                                                timeout = rospy.Duration(0.1)
> )
>
> The only (subtle) difference is that the "working" version is waiting for
> the transform at Time 0.0, which just gets the latest available transform,
> but both mymsg.header.stamp and rospy.Time.now() fail with the following
> exception message:
>
> [INFO] 1282625415.289159: PF: Awaiting necessary tf transforms.
> [INFO] 1282625417.263204: PF: All tf transforms ready. # Using rospy.Time(0)
> [INFO] 1282625417.318107: PF: Starting particle filter!
> [INFO] 1282625418.667938: Time read: 1282347068.759572982
> [INFO] 1282625418.668339: Rospy Now: 1282347068.760468681
> [INFO] 1282625418.769964: PF: tf unavailable.  Skipping read (1).
> You requested a transform that is 278350010.097 miliseconds in the past,
> but the most recent transform in the tf buffer is 278350024.236 miliseconds
> old.
>
> <class 'tf.Exception'>
>
> You'll notice that the roscore time from logout is the (correct) simtime.
> Using "rosrun tf view_frames" also shows that the frames are 278350010ish
> milliseconds old.  The /clock message is being (correctly) published by the
> bag file...
>
> Is this somehow "expected" behavior, or is there a bug in tf that prevents
> the use of simtime?
>
>
>
> ~Travis Deyle
> PhD student @ Georgia Tech's Healthcare Robotics Lab
> Co-Founder www.Hizook.com -- Robotics News for Academics & Professionals
>
> _______________________________________________
> ros-users mailing list
> ros-users at code.ros.org
> https://code.ros.org/mailman/listinfo/ros-users
>
>



More information about the ros-users mailing list