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

How to set use_sim_time

asked 2019-06-13 08:15:50 -0500

GabrielBagon44 gravatar image

Hi, I am wondering how you can set use_sim_time to true, or enable it for my nodes. Do I have to do it within my nodes? or in my launch file? Also, is this something you must do for all your nodes and/or launch files? Thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
7

answered 2019-06-13 09:20:04 -0500

ChuiV gravatar image

updated 2022-02-01 10:06:00 -0500

130s gravatar image

If you need to set use_sim_time from the commandline, then rosparamis your friend. Please read https://wiki.ros.org/rosparam

If you need to set it from a launch file, you can use either the <rosparam>tag to read a yaml file of parameters (https://wiki.ros.org/roslaunch/XML/ro...) or you can use the <param> tag to set a particular parameter, like use_sim_time(https://wiki.ros.org/roslaunch/XML/param). For example, add <param name="/use_sim_time" value="true" />

Reading the documentation helps alot.

Also helpful is the documentation regarding the ros clock: https://wiki.ros.org/roslaunch/XML/ro...

You only need to set the /use_sim_time (note that it is in the root namespace) parameter once, and all your nodes will start using simulation time.

edit flag offensive delete link more

Comments

Thanks for the informative response!

GabrielBagon44 gravatar image GabrielBagon44  ( 2019-06-13 12:04:10 -0500 )edit
2

The example: <param name="/use_sim_time" value="true"> is missing the closing /. If you copy paste this, use: <param name="/use_sim_time" value="true"/>

FantasticMrFox gravatar image FantasticMrFox  ( 2021-08-05 01:51:11 -0500 )edit

Applied @FantasticMrFox's suggestion to add closing slash.

130s gravatar image 130s  ( 2022-02-01 10:06:35 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2019-06-13 08:15:50 -0500

Seen: 21,916 times

Last updated: Feb 01 '22