0
$\begingroup$

Rosanswers logo

I am currently working on VIORB SLAM which using both camera and imu. I have to make the system work without ROS, but currently I successfully run the recorded datasets using use_sim_time only. This link and link doesn't provide me any detail in depth about how it work. Can anyone explain me how use_sim_time works?


Originally posted by Rasp on ROS Answers with karma: 3 on 2018-04-14

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The documentation you link to does describe how it works. As stated in section 2, when the parameter use_sim_time is true, the ROS API used to get times (e.g. ros::Time time = ros::Time::now()) will retrieve time data from the /clock topic rather than using the system clock. If you have something publishing time values to that topic (such as rosbag or Gazebo) then this means any nodes using the ROS time APIs will act as though the time is what /clock says it is.

If you turn use_sim_time off then any time values published to /clock will be ignored, meaning that any data published by rosbag will have time stamps that are different (probably massively different) from the current system time, and so data processing nodes may ignore that data as being out of date.

The /clock topic is useful for more than just playing back older data. If you write your nodes to process data based on times from the ros::Time API and not from its own loop, then you can effectively slow down and even stop the functioning of your system by controlling the /clock topic. This is particularly useful when working with simulations.


Originally posted by Geoff with karma: 4203 on 2018-04-15

This answer was ACCEPTED on the original site

Post score: 6


Original comments

Comment by Rasp on 2018-04-25:
thank you so much, I finally understand it.

Comment by Kansai on 2021-09-07:
does using use_sim_time have any effect on the values of /clock that are published by rosbag play --clock?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.