Package rospy :: Module rostime

Module rostime

source code

ROS time and duration representations, as well as internal routines for managing wallclock versus a simulated clock. The important data classes are Time and Duration, which represent the ROS 'time' and 'duration' primitives, respectively.

Classes
  Duration
Duration represents the ROS 'duration' primitive type, which consists of two integers: seconds and nanoseconds.
  Time
Time represents the ROS 'time' primitive type, which consists of two integers: seconds since epoch and nanoseconds since seconds.
Functions
Time
get_rostime()
Get the current time as a Time object
source code
float
get_time()
Get the current time as float secs (time.time() format)
source code
 
set_rostime_initialized(val)
Internal use.
source code
bool
is_rostime_initialized()
Internal use.
source code
threading.Cond
get_rostime_cond()
internal API for helper routines that need to wait on time updates
source code
bool
is_wallclock()
Internal use for ROS-time routines.
source code
 
switch_to_wallclock()
Internal use.
source code
 
wallsleep(duration)
Internal use.
source code
Variables
  __package__ = 'rospy'
Function Details

get_rostime()

source code 

Get the current time as a Time object

Returns: Time
current time as a rospy.Time object

get_time()

source code 

Get the current time as float secs (time.time() format)

Returns: float
time in secs (time.time() format)

set_rostime_initialized(val)

source code 

Internal use. Mark rostime as initialized. This flag enables other routines to throw exceptions if rostime is being used before the underlying system is initialized.

Parameters:
  • val (bool) - value for initialization state

is_rostime_initialized()

source code 

Internal use.

Returns: bool
True if rostime has been initialized

get_rostime_cond()

source code 

internal API for helper routines that need to wait on time updates

Returns: threading.Cond
rostime conditional var

is_wallclock()

source code 

Internal use for ROS-time routines.

Returns: bool
True if ROS is currently using wallclock time

switch_to_wallclock()

source code 

Internal use. Switch ROS to wallclock time. This is mainly for testing purposes.

wallsleep(duration)

source code 

Internal use. Windows interrupts time.sleep with an IOError exception when a signal is caught. Even when the signal is handled by a callback, it will then proceed to throw IOError when the handling has completed.

Refer to https://code.ros.org/trac/ros/ticket/3421.

So we create a platform dependant wrapper to handle this here.