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
1

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 imageRasp ( 2018-04-25 04:23:59 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 1,541 times

Last updated: Apr 15 '18