Home | Trees | Indices | Help |
|
---|
|
object --+ | genpy.rostime.TVal --+ | genpy.rostime.Time --+ | Time
Time represents the ROS 'time' primitive type, which consists of two integers: seconds since epoch and nanoseconds since seconds. Time instances are mutable.
The Time.now() factory method can initialize Time to the current ROS time and from_sec() can be used to create a Time instance from the Python's time.time() float seconds representation.
The Time class allows you to subtract Time instances to compute Durations, as well as add Durations to Time to create new Time instances.
Usage:
now = rospy.Time.now() zero_time = rospy.Time() print 'Fields are', now.secs, now.nsecs # Time arithmetic five_secs_ago = now - rospy.Duration(5) # Time minus Duration is a Time five_seconds = now - five_secs_ago # Time minus Time is a Duration true_val = now > five_secs_ago # NOTE: in general, you will want to avoid using time.time() in ROS code import time py_time = rospy.Time.from_sec(time.time())
Instance Methods | |||
|
|||
|
|||
Inherited from Inherited from Inherited from |
Static Methods | |||
Time |
|
||
Time |
|
||
Time |
|
Properties | |
Inherited from Inherited from |
Method Details |
Constructor: secs and nsecs are integers and correspond to the ROS 'time' primitive type. You may prefer to use the static from_sec() and now() factory methods instead.
|
repr(x)
|
Create new Time instance representing current time. This can either be wall-clock time or a simulated clock. It is strongly recommended that you use the now() factory to create current time representations instead of reading wall-clock time and create Time instances from it. |
Use Time.from_sec() instead. Retained for backwards compatibility.
|
Create new Time instance from a float seconds representation (e.g. time.time()).
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Mar 7 03:45:10 2017 | http://epydoc.sourceforge.net |