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

When should you set use_sim_time to true

asked 2023-05-06 17:28:51 -0500

sdu568 gravatar image

Hello all,

I am currently a little bit confused by when should I set the 'use_sim_time' parameter in my node to be true? Because from looking at the example in some projects, such as Nav2, all their node launch with 'use_sim_time' to be true.

But then, when I looked at other projects, such as nmea, and imu_filter, they did not have use_sim_time to be true initially.

Thus, I am wondering if my understanding below is correct? I should only turn on 'use_sim_time' to be true for any code that is not related to any physical hardware, such as GPS, IMU, .. And for those nodes involving interacting with the physical component of the robot, should I set 'use_sim_time' to false?

I guess my question is, for what kind of node should I set 'use_sim_time' to be false or true?

Thanks in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-05-08 03:03:15 -0500

gvdhoorn gravatar image

use_sim_time should typically only be set to true if you are using a simulator/simulation environment, and your ROS nodes interface (ie: get their data, and send their data) with that simulator/simulation environment.

There are some situations in which more 'advanced' usage of it could be used to run partial systems on simulated time, but I would suggest to not do that if you're just starting out.

Thus, I am wondering if my understanding below is correct? I should only turn on 'use_sim_time' to be true for any code that is not related to any physical hardware, such as GPS, IMU, .. And for those nodes involving interacting with the physical component of the robot, should I set 'use_sim_time' to false?

Driver nodes (what you describe as "nodes involving interacting with the physical component of the robot" can typically not be used with simulated hardware (ie: a robot in Gazebo), so they are typically not started in such situations.

I've always considered Gazebo sensor and actuator plugins the equivalent of ROS drivers for real hw.

So, no, I don't believe what you write is correct.

I would suggest the following rule of thumb:

  • using a simulation? Set use_sim_time to true for all nodes you start
  • otherwise: set use_sim_time to false (or: don't set the parameter at all, as false is the default)
edit flag offensive delete link more

Comments

That's all fair, and intuitively correct. But what exactly changes when the flag is toggled? I've had some real Hardware (Sensors) running just fine with use_sim_timeTrue and vice versa some gazebo simulation + Nav2 Nodes running fine with False.

scoeerg gravatar image scoeerg  ( 2023-07-26 06:54:29 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2023-05-06 17:28:51 -0500

Seen: 893 times

Last updated: May 08 '23