ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How use_sim_time works?

asked 2018-04-14 08:15:22 -0600

Rasp gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2018-04-15 21:44:33 -0600

Geoff gravatar image

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.

edit flag offensive delete link more

Comments

thank you so much, I finally understand it.

Rasp gravatar image Rasp  ( 2018-04-25 04:23:59 -0600 )edit

does using use_sim_time have any effect on the values of /clock that are published by rosbag play --clock?

Kansai gravatar image Kansai  ( 2021-09-07 05:15:33 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-14 08:15:22 -0600

Seen: 16,039 times

Last updated: Apr 15 '18