rostime
Access ROS time functionality
Description
A ROS Time
message represents an instance of time in
seconds and nanoseconds. This time can be based on your system time, the ROS simulation
time, or an arbitrary time.
Creation
Syntax
Description
initializes the time values for seconds and nanoseconds based on
time
= rostime(totalSecs
)totalSecs
, which represents the time in seconds as
a floating-point number.
Note
In a future release, ROS Toolbox will use message structures instead of objects for ROS messages.
To use message structures now, set the "DataFormat"
name-value
argument to "struct"
. For more information, see ROS Message Structures.
initializes the time values for seconds and nanoseconds individually. Both
inputs must be integers. Large values for time
= rostime(secs
,nsecs
)nsecs
are
wrapped automatically with the remainder added to
secs
.
returns
the current ROS time. If the time
= rostime("now")use_sim_time
ROS parameter
is set to true
, the rostime
returns
the simulation time published on the clock
topic.
Otherwise, the function returns the system time of your machine. The
time
is a ROS Time
object. If no
output argument is given, the current time (in seconds) is printed to the
screen.
The rostime
can be used to timestamp messages or to
measure time in the ROS network.
[
also returns a Boolean that indicates if time
,issimtime
]
= rostime("now")time
is in
simulation time (true
) or system time
(false
).
always returns the system time of your machine, even if ROS publishes
simulation time on the time
= rostime("now","system")clock
topic. If no output argument
is given, the system time (in seconds) is printed to the screen.
The system time in ROS follows the UNIX® or POSIX® time standard. POSIX time is defined as the time that has elapsed since 00:00:00 Coordinated Universal Time (UTC), 1 January 1970, not counting leap seconds.
uses message structures instead of objects with any of the arguments in
previous syntaxes. For more information, see ROS Message Structures.time
= rostime(___,"DataFormat","struct")