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

How to use chrony for two ROS masters on one computer?

asked 2019-05-29 08:26:08 -0500

kump gravatar image

updated 2019-05-29 08:56:34 -0500

I am running two ROS masters on one computer and I'm using the Multimaster FKIE package to connect the two ROS masters. I think I need to synchronize the time of both ROS masters to make my scenario work. From a quick search for some solutions I found this chrony protocol that is recommended to be use for multi-computer ROS synchronization. However I have never studied networking and from reading the documentation on chrony webpage I couldn't understand how to use it. I have installed the chrony on my computer and now I need some further rookie instructions.

How to set it and how to run it? What can I expect from using chrony? The both ROS masters are running at the localhost just different ports.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-05-29 08:28:09 -0500

gvdhoorn gravatar image

updated 2019-05-29 08:30:02 -0500

The both ROS masters are running at the localhost just different ports.

then you don't need chrony.

From the chrony website:

chrony is a versatile implementation of the Network Time Protocol (NTP). It can synchronise the system clock with NTP servers, reference clocks (e.g. GPS receiver), and manual input using wristwatch and keyboard. It can also operate as an NTPv4 (RFC 5905) server and peer to provide a time service to other computers in the network.

Note the "other computers in the network" and "synchronise [..] clock with NTP servers".

Using chrony -- or any kind of time synchronisation infrastructure -- is only necessary if you have multiple different computers on which you run ROS (and are exchanging time-sensitive data between them).

edit flag offensive delete link more

Comments

Then what do I need to synchronize two ROS masters at one computer? I guess I need to synchronize the sim_time. The chrony won't help with that? What does?

kump gravatar image kump  ( 2019-05-29 08:55:43 -0500 )edit

That's something entirely different.

sim_time (I think you mean use_sim_time) is a ROS parameter. If you want all nodes in your two node graphs to use simulation time you'll have to set that parameter on both ROS masters. FKIE Multimaster doesn't sync parameters as far as I know, so you'll have to do that manually (or set it in a .launch file).

gvdhoorn gravatar image gvdhoorn  ( 2019-05-29 09:02:35 -0500 )edit

@gvdhoorn, I think I have that, Each of the launch file has use_sim_time set to True. When I use this command

$ rosparam get /use_sim_time
true

on both ROS masters I get true.

But inside the simulations each of the sim_times are different. The simulation run at different speed. I think that what gives me trouble and that is what I need to synchronize.

kump gravatar image kump  ( 2019-05-29 09:26:04 -0500 )edit

You'll need to make sure there is only a single Clock publisher in your entire network. Otherwise different nodes will use different time bases. That is not going to work.

I've not done this myself, but I assume you'll have to use MFKIE to sync the clock topic from one of the node graphs to the other.

gvdhoorn gravatar image gvdhoorn  ( 2019-05-29 09:30:12 -0500 )edit

Tbh, I'm not quite sure why someone would want to use two masters and then MFKIE on the same machine, but you've most likely already concluded that it's necessary.

if you used a single master, there would be no problem here afaict.

gvdhoorn gravatar image gvdhoorn  ( 2019-05-29 09:30:53 -0500 )edit

@gvdhoorn, I would gladly use only one master (although I'm not sure that would solve my problem). I am using two ROS masters, because I need to run two Gazebo simulations. Each of the Gazebo simulations communicate with ROS through a topic called /gazebo, so if two Gazebo's are running, the ROS cannot distinguish between them. And when I was trying to launch each Gazebo in a its own namespace, I couldn't get them to load correctly.

But anyway, I think that the Sim Time is dependent on the step size, RT update rate and the complexity of the simulation, so I would assume not even running two simulations in one ROS master would ensure synchronous time? I don't quite understand this.

kump gravatar image kump  ( 2019-05-29 09:40:56 -0500 )edit
1

Running two instances of Gazebo is going to introduce some complexities, yes. Especially when it comes to comparing time-stamped data between the two.

I'm not aware of any techniques that allow you to sync two instances. That would be something to ask over at Gazebo Answers.

Multiple instances in namespaces should work, but sometimes isn't straightforward.

gvdhoorn gravatar image gvdhoorn  ( 2019-05-29 09:54:05 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-05-29 08:26:08 -0500

Seen: 1,087 times

Last updated: May 29 '19