ros-chrony
ROS package that interfaces the time synchronization chrony daemon and provide status of synchronization on ROS topics.
GPSD and Chrony Synchronization
Installation of GPSD
- Download the lastest version of GPS here -> choose at least v3.22 because lower versions can give you bugs according to official doc.
- untar the file with
tar -xzf gpsd-XX.Y.tar.gz
- go to the gpsd directory with
cd gpsd-XX.Y
- go in root mode with
sudo su
to avoid any permissions problems - do
scons && scons check && scons udev-install
(you may need to install scons beforesudo apt install scons
) - This should work and you can start the daemon with gpsd to see if it is installed successfully.
- Official tutorial here if you got any problems.
Installation of Chrony
- Download lastest release of chrony here
- Extract the file.
- Go to the directory
cd chrony-X.Y
- To avoid any permissions problems go in root mode
sudo su
- Do
./configure
and wait until the end. - Once step 6 is done, do
make
to build programs - After step 6 do
make docs
to have HTML docs. -
make install
to install compiled programs of step 6. -
make install-docs
to install docs. - You should be able to run
chronyd
in a terminal.
Configuring GPSD and Chrony
GPSD
For GPSD you can have a port listening problem, you maybe have to create a file in /etc/systemd/system/gpsd.socket.d/
-> create a file named socket.conf
configure with this :
[Socket]
#First blank ListenStream clears the system defaults
ListenStream=
ListenStream=2947
ListenStream=/var/run/gpsd.sock
Chrony
To synchronize GPS with chrony we need to modify this file nano /etc/chrony/chrony.conf
.
In this file we have to add those lines at the end :
refclock SOCK /var/run/chrony.ttyS0.sock delay 0.0 refid GPS refclock SHM 1 offset 0.0 delay 0.0 refid PPS
ttyS0 was our serial port you may be have to change that.
You can try to follow this tutorial here this is official GPSD documentation, but the refclock SOCK /run/chrony.ppsX.sock
didn't work for us.
After this you can start both daemons with
sudo chronyd -f /etc/chrony/chrony.conf
sudo gpsd -n /dev/ttyS0
-> S0 is 1st serial port, you may need to change.
To check if it's working do : chronyc sources -v
(-v is useful to understand symbols)
You should have something like : #- GPS or #+ GPS
and under #* PPS
If you have those sign, sources are synchronized.
Authors and acknowledgment
Corentin Boulongne & Gérald Dherbomez
License
MIT License