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

How to synchronize two PC?

asked 2019-01-15 03:29:53 -0500

stevemartin gravatar image

updated 2019-01-15 09:25:14 -0500

I have followed this instruction here : LINK to install chony and edit the conf file and on my Ubuntu PC I have included this line to syncrhonize with my embedded computer (where ros is running):

 server 192.168.86.26 minpoll 0 maxpoll 5 maxdelay .00

But when I type:

ntpdate -q 192.168.86.26

I get this:

15 Jan 01:24:48 ntpdate[4560]: 192.168.86.26 rate limit response from server.
server 192.168.86.26, stratum 2, offset -0.001573, delay 0.03282
15 Jan 01:24:48 ntpdate[4560]: adjust time server 192.168.86.26 offset -0.001573 sec

Why it isn't syncronized?

This is my /etc/chrony/chrony.conf file

pool ntp.ubuntu.com        iburst maxsources 4
pool 0.ubuntu.pool.ntp.org iburst maxsources 1
pool 1.ubuntu.pool.ntp.org iburst maxsources 1
pool 2.ubuntu.pool.ntp.org iburst maxsources 2

# This directive specify the location of the file containing ID/key pairs for
# NTP authentication.
keyfile /etc/chrony/chrony.keys

# This directive specify the file into which chronyd will store the rate
# information.
driftfile /var/lib/chrony/chrony.drift

# Uncomment the following line to turn logging on.
#log tracking measurements statistics

# Log files location.
logdir /var/log/chrony

# Stop bad estimates upsetting machine clock.
maxupdateskew 100.0

# This directive enables kernel synchronisation (every 11 minutes) of the
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
rtcsync

# Step the system clock instead of slewing it if the adjustment is larger than
# one second, but only in the first three clock updates.
makestep 1 3

server 192.168.86.26 minpoll 0 maxpoll 5 maxdelay .00
edit retag flag offensive close merge delete

Comments

Could you share your etc/chrony/chrony.conf files on the client and server side?

curi_ROS gravatar image curi_ROS  ( 2019-01-15 06:43:41 -0500 )edit

@curi_ROS I have updated the answer. Regarding the server side, do I need to add chrony too? I thought only client side is needed.

stevemartin gravatar image stevemartin  ( 2019-01-15 09:25:24 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-01-15 09:46:21 -0500

curi_ROS gravatar image

Does your embedded board have internet access? If it does then you can sync it using the NTP servers.

If it does not have internet, and only a connection to the server (master/PC), then on the server side, include these lines in your chrony.conf:

(assuming the clients are in the 192.168.165.x subnet)

driftfile /var/lib/chrony/drift
local stratum 8
manual
allow 192.168.165
smoothtime 400 0.01

And on the client (embedded system) side include these lines in your chrony.conf:

server master_ip_address iburst
driftfile /var/lib/chrony/drift
logdir /var/log/chrony
log measurements statistics tracking
makestep 1 -1  #change time in steps at any point after boot(1 -1) || in 3 sync steps (1 -3)
rtcsync        #real time clock sync

Note: Ensure the subnet mask is adhered to when writing the allow 192.168.165 (for a subnet 255.255.255.0). For a subnet mask of 255.255.0.0 you would write allow 192.168.

Once you are done, reboot the system, ssh into it, and type date in the terminal. The client should have synchronised with your master/server time.

edit flag offensive delete link more

Comments

@curi_ROS yes my embedded system do have an internet connection. So do you mean I can use NTP server instead of chrony? I thought Chrony is the NTP server, lol)

stevemartin gravatar image stevemartin  ( 2019-01-16 02:06:39 -0500 )edit

@curi_ROS I have added the lines on both embedded and PC but instead of submask, I wrote a full IP of the embedded as they have different IP (my PC address starts at 193). I rebooted but still not synced. I tried to /etc/init.d/chrony start and got this error on embedded:

stevemartin gravatar image stevemartin  ( 2019-01-16 02:29:08 -0500 )edit

1496 ExecStart=/usr/lib/systemd/scripts/chronyd-starter.sh $DAEMON_OPTS (code=exited, s ESCOC

stevemartin gravatar image stevemartin  ( 2019-01-16 02:31:45 -0500 )edit

AFAIK chrony requires you to be on the same subnet to synchronise time.But if you have access to an internet connection look for a tutorial on syncing automatically using the ntp server

curi_ROS gravatar image curi_ROS  ( 2019-01-16 03:28:48 -0500 )edit

@curi_ROS Ok cheers. Also, I found google NTP LINK. It says to remove everything which says word server, do I also need to remove pool?

pool 0.ubuntu.pool.ntp.org iburst
pool 2.ubuntu.pool.ntp.org iburst
pool 1.ubuntu.pool.ntp.org iburst
stevemartin gravatar image stevemartin  ( 2019-01-16 03:32:27 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2019-01-15 03:29:53 -0500

Seen: 2,319 times

Last updated: Jan 15 '19