The goal of this repo is to create a simple solution to dealing with time synchronization between multiple multimasters in ROS. The setup necessary will be provided in setup files and then to add a new machine to the network you should only need to add the IP and all the /etc/hosts will be updated.
The network setup is from: https://digital.csic.es/bitstream/10261/133333/1/ROS-systems.pdf
sudo python server/network.py
cd webserver/
export FLASK_APP=app
flask run
sudo python3 client/client_setup.py <SERVER-IP> wlan0 5006
sudo python network/client.py <SERVER-IP>
sudo apt-get install ros-melodic-multimaster-fkie
or https://github.com/fkie/multimaster_fkie
export ROS_MASTER_URI=http://<hostname or IP address>:11311
Install NTP
sudo apt install ntp
Save ntp.conf
in /etc/ntp.conf
sudo cp ntp.conf /etc/ntp.conf
Start the service
sudo service ntp start
Install chrony
sudo apt install chrony
Edit the <host-ip>
with the host ip then save this in /etc/chrony/chrony.conf
server <host-ip> minpoll 0 maxpoll 4 maxdelay .05
initstepslew 2 <host-ip>
keyfile /etc/chrony/chrony.keys
commandkey 1
driftfile /var/lib/chrony/chrony.drift
maxupdateskew 5
dumponexit
dumpdir /var/lib/chrony
pidfile /var/run/chronyd.pid
logchange 0.5
rtcfile /etc/chrony.rtc
rtconutc
rtcdevice /dev/rtc
sched_priority 1
local stratum 10
allow 127.0.0.1/8
Synchronize with the server
systemctl chrony stop
systemctl chrony start
For debugging
chronyc tracking
Testing requires 4 terminals running on each machine.
roscore
rosrun master_discovery_fkie master_discovery _mcast_group:=224.0.0.1
rosrun master_sync_fkie master_sync
python publish_data.py
python recieve_data.py