Current Time
Retrieve current ROS time or system time
- 库:
ROS Toolbox / ROS
Description
TheCurrent Timeblock outputs the current ROS or system time.ROS Timeis based on the system clock of your computer or the/clock
topic being published on the ROS node.
Use this block to synchronize your simulation time with your connected ROS node.
If theuse_sim_time
ROS parameter is set totrue
, the block returns the simulation time published on the/clock
topic. Otherwise, the block returns the system time of your machine.
Ports
Output
Parameters
Model Examples
Tips
To set the
use_sim_time
parameters and get time from a/clock
topic:Connect to a ROS network, then use theSet Parameterblock or set the parameter in the MATLAB®command window:
ptree = rosparam; set(ptree,'/use_sim_time',true)
Usually, the ROS node that publishes on the
/clock
topic sets up the parameter.