Significance of rospy.time(0) in listener lookup transform function?

Why dont we use rospy.time.now() instead of rospy.time(0)

Hi @vasank1958,

according to this link, the answer is:

rospy.Time.now() just returns the current ‘wall clock time’ (or the simulated clock, depending on whether you have a Clock server running).

rospy.Time(0) constructs a Time instance that has special significance in TF contexts: it will cause lookupTransform(..) and friends to return the latest available data for a specific transform, instead of the data at a specific point in time .

1 Like

Hi @vasank1958
When coding with Ros there are two different time systems. If you import time and import rospy you have the following options:

time.now() is the current computer system time. The ‘real time’
rospy.Time.now() is the current ros clock time, which is usually given by the gazebo simulation.

Simulations often run faster or slower compared to the real time. Sometimes you need the one, sometimes the other.

perhaps give this a read. Using TF, you will often have to use rospy.Time.now() and rospy.duration()
http://wiki.ros.org/rospy/Overview/Time