I'd like to know how the clock signal works when running a ROS sytem across multiple machines
with "clock signal" are you referring to the clock
topic?
If you are, then I believe the wiki/Clock page has a good bit of information on how that works:
Normally, the ROS client libraries will use your computer's system clock as a time source, also known as the "wall-clock" or "wall-time" (like the clock on the wall of your lab). When you are running a simulation or playing back logged data, however, it is often desirable to instead have the system use a simulated clock so that you can have accelerated, slowed, or stepped control over your system's perceived time. For example, if you are playing back sensor data into your system, you may wish to have your time correspond to the timestamps of the sensor data.
To support this, the ROS client libraries can listen to the /clock
topic that is used to publish "simulation time".
Summarising:
- normal operation: ROS nodes use the system's clock
- simulation: nodes use simulation time (published by the simulator) coming in on the
clock
topic
The same page has this to say about multi-machine setups:
When using wall-clock time on multiple machines, it is important that you synchronize time between them. ROS does not provide this functionality as there are already well-established methods (e.g. ntp, our recommended syncronization tool is chrony) for doing this. If you do not synchronize the wall-clocks of multiple machines, they will not agree on temporal calculations like those used in tf.
So coming back to your question:
Does the ROS Master set the clock signal for all nodes on all machines? Or does each machine have its own clock signal?
The ROS master doesn't do anything with /clock
, nor does a non-simulation setup do anything with /clock
. And with a multi-machine ROS setup, you are responsible for making sure all system clocks are synchronised (which is not a ROS-specific task, so generic tools can be used).