If you run "rosbag play --clock ...
" before your other nodes, it will set use_sim_time
for you. If you prefer to launch the other nodes first, be sure to set it yourself, as @michikarg recommends.
In addition, the --clock
option causes rosbag play
to publish simulated time synchronized to the messages in the bag file to the /clock
topic. That way, your other nodes run as if they were executing when those messages were originally published.
CORRECTION: My mistake, rosbag play
does not set use_sim_time
for you. Setting it yourself is a good idea. That typically needs to be done before the other nodes start up.