ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
#Create time object and fill with current time
timeObject = rospy.Time()
timeObject.nsecs = int(time.time_ns())
timeObject.secs = int(time.time())
The problem is time.time_ns()
is the total number of nanoseconds since the epoch. The nsecs
field should only contain the number of nanoseconds since since the secs
field, meaning the number in nsecs
should always be less than the number of nanoseconds in a second: 1,000,000,000.
Use rospy.Time.now()
to get the current time instead.
http://wiki.ros.org/rospy/Overview/Time#Getting_the_current_time
#Create time object and fill with current time
timeObject = rospy.Time.now()