0
$\begingroup$

Rosanswers logo

Hello ROS community !

I have question about Time in ROS (I'm in Fuerte on Ubuntu 12.04). Let me explain the situation : I have a basic simulator written with ROS, that receive an /action topic, publish a /perception topic, with the relevant custom messages. On the other hand, I have two nodes, a Perceptive one, that transform perception into state, and a Controller that use state and compute an action, that is sent to the simulator. The connection is :

Simulator -> /perceptiontopic -> (Percept -> /state -> Controller) -> /action -> Simulator

All my nodes are firing Timers at a certain NODERATE that trigger (or not):

  • world update for the Simulator : if the relevant time in second has gone, the world changes. The world change is independent from the NODERATE itself has the world evolution has its own "dynamic".

  • Perception update and State publishing for the perceptive node : if we received a /perception message or some time in second has gone, we publish a /state message. The involved durations are also independent from NODERATE.

  • Action computation for the Controller. When it receives a /state message, it computes the action message and publish it to the simulator.

I'm wondering about the time consistency as my simulator doesn't publish a /clock topic (nor my others nodes subscribe to /clock). I had the same NODERATE for the simulator and others nodes and a certain behavior. I changed the Perceptive and Controller nodes' NODERATE (lower than simulation one) and now the behaviour is different. In my understanding, it shouldn't as the time aspects of my nodes are supposed to be independent.

So :

  • Is it necessary to have a /clock (from the simulator) to ensure time consistency between nodes that commuicate together ?

  • If so, what time should my simulator publish ? A ros::Time::now() (+/use_sim_time setup) ? How my perceptive and control nodes handle that ? Should they explicitly subscribe to /clock and have a callback on that ? What's the difference with my ros::Timer ?

  • I understand that no realtime is guaranteed with such tools, but what is the range of frequency / period ROS can handle without risk of inconsistency ?

Thanks for reading, Erwan


Originally posted by Erwan R. on ROS Answers with karma: 697 on 2014-02-05

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I don't think publishing a /clock topic will help you. AFAIK it is more of a tool to enable simulators to control time (e.g. run faster or slower than realtime) rather than a means for synchronization.


Originally posted by demmeln with karma: 4306 on 2014-02-11

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Erwan R. on 2014-02-17:
Ok, thank you for you answer.

Comment by Craigstar on 2020-03-27:
Hi, this question is not about Publishing to a clock, it is instead about how to coordinate time between nodes, for which you though publishing to the /clock would be an option. However, it is not about how to publish to the /clock. It would be good if you could rename it, as it currently comes up in any searches about publishing to the /clock.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.