From d035ae7c6559de2c8749a0b696b589ff1f811526 Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Tue, 23 Jan 2018 16:18:01 -0500 Subject: [PATCH 01/12] Update README with chrony instructions --- README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e043ceb..ef1e5f5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,23 @@ -# Canopy Cloud Robotics Framework -This is the ROS node for the client-side application. +# Canopy Client +This is the ROS node for the client-side application of Canopy. + +## Installation +See the [Canopy docs](http://canopy-docs.readthedocs.io/en/latest/client-docs.html#installation). + +## Time Synchronization +This section describes the steps for synchronizing timestamps between your Canopy clients and the Canopy server. + +Install chrony: +``` +sudo apt-get install chrony +``` + +Modify the chrony configuration file `chrony_canopy_client.conf` to reflect your Canopy server's IP address: +``` +server 123.45.67.890 +``` + +Restart chrony with this configuration file: +``` +sudo chronyd -f /chrony_canopy_client.conf +``` \ No newline at end of file From e2128eaec73386148bd64fc9ceab4a8448ec6b5f Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Tue, 23 Jan 2018 18:14:46 -0500 Subject: [PATCH 02/12] Add chrony config file --- chrony_canopy_client.conf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 chrony_canopy_client.conf diff --git a/chrony_canopy_client.conf b/chrony_canopy_client.conf new file mode 100644 index 0000000..b805e8f --- /dev/null +++ b/chrony_canopy_client.conf @@ -0,0 +1,15 @@ +# To synchronize client to server, uncomment line below and replace IP with server's IP: +# server 123.123.12.12 + +maxupdateskew 5 + +driftfile /etc/chrony.drift + +dumponexit +dumpdir /var/log/chrony + +rtcsync + +keyfile /etc/chrony.keys +commandkey 1 +generatecommandkey From c0833756377e96ca7262ed633ae00b782ebf48a3 Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Tue, 23 Jan 2018 18:18:44 -0500 Subject: [PATCH 03/12] Update README --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ef1e5f5..c93c0f0 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ This is the ROS node for the client-side application of Canopy. ## Installation See the [Canopy docs](http://canopy-docs.readthedocs.io/en/latest/client-docs.html#installation). -## Time Synchronization -This section describes the steps for synchronizing timestamps between your Canopy clients and the Canopy server. +## Clock Synchronization +This section describes the _client-side_ instructions for synchronizing the clocks of your Canopy clients and the Canopy server using `chrony`. Install chrony: ``` @@ -14,10 +14,12 @@ sudo apt-get install chrony Modify the chrony configuration file `chrony_canopy_client.conf` to reflect your Canopy server's IP address: ``` -server 123.45.67.890 +# chrony_canopy_client.conf +server 128.31.37.168 +... ``` Restart chrony with this configuration file: ``` -sudo chronyd -f /chrony_canopy_client.conf -``` \ No newline at end of file +sudo chronyd -f /chrony_canopy_client.conf -r -s +``` From b19a14d0b67db63a6b2d3519c8bb4c9f3cf9cbdb Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Wed, 24 Jan 2018 16:16:26 -0500 Subject: [PATCH 04/12] Add iburst option to chrony config and copy config to /etc/chrony/ --- README.md | 9 +++++---- chrony_canopy_client.conf | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c93c0f0..3c34301 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,20 @@ See the [Canopy docs](http://canopy-docs.readthedocs.io/en/latest/client-docs.ht ## Clock Synchronization This section describes the _client-side_ instructions for synchronizing the clocks of your Canopy clients and the Canopy server using `chrony`. -Install chrony: +Install chrony and copy the configuration file to `/etc/chrony`: ``` sudo apt-get install chrony +sudo cp chrony_canopy_client.conf /etc/chrony ``` -Modify the chrony configuration file `chrony_canopy_client.conf` to reflect your Canopy server's IP address: +Modify the chrony configuration file `/etc/chrony/chrony_canopy_client.conf` to reflect your Canopy server's IP address: ``` -# chrony_canopy_client.conf +# /etc/chrony/chrony_canopy_client.conf server 128.31.37.168 ... ``` Restart chrony with this configuration file: ``` -sudo chronyd -f /chrony_canopy_client.conf -r -s +sudo chronyd -f /etc/chrony/chrony_canopy_client.conf -r -s ``` diff --git a/chrony_canopy_client.conf b/chrony_canopy_client.conf index b805e8f..e0f9d5a 100644 --- a/chrony_canopy_client.conf +++ b/chrony_canopy_client.conf @@ -1,5 +1,5 @@ # To synchronize client to server, uncomment line below and replace IP with server's IP: -# server 123.123.12.12 +# server 123.123.12.12 iburst maxupdateskew 5 From 715f196c71ef1901da8ec12270295d33761dd0d4 Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Thu, 25 Jan 2018 18:31:25 -0500 Subject: [PATCH 05/12] Change chrony drift file location --- chrony_canopy_client.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrony_canopy_client.conf b/chrony_canopy_client.conf index e0f9d5a..88b9151 100644 --- a/chrony_canopy_client.conf +++ b/chrony_canopy_client.conf @@ -3,7 +3,7 @@ maxupdateskew 5 -driftfile /etc/chrony.drift +driftfile /var/lib/chrony/chrony.drift dumponexit dumpdir /var/log/chrony From 720461bcc1271a49e557720afd8947afb13a68b9 Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Thu, 25 Jan 2018 18:32:43 -0500 Subject: [PATCH 06/12] Add systemd service file for chrony --- chrony_canopy_client.service | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 chrony_canopy_client.service diff --git a/chrony_canopy_client.service b/chrony_canopy_client.service new file mode 100644 index 0000000..bae4d44 --- /dev/null +++ b/chrony_canopy_client.service @@ -0,0 +1,8 @@ +[Unit] +Description = chrony service for canopy client +Conflicts = ntpd.service + +[Service] +Type = forking +PIDFile = /var/run/chronyd.pid +ExecStart = /usr/sbin/chronyd -f /etc/chrony/chrony_canopy_client.conf -r -s From 7e6b3d5dda5079a7a9dda555d196fbc1e1c1e5d9 Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Thu, 25 Jan 2018 13:55:15 -0500 Subject: [PATCH 07/12] Add canopy client install script --- canopy_client_install.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 canopy_client_install.sh diff --git a/canopy_client_install.sh b/canopy_client_install.sh new file mode 100755 index 0000000..77d826e --- /dev/null +++ b/canopy_client_install.sh @@ -0,0 +1,25 @@ +#!/bin/sh +CANOPY_CLIENT_DIR=$(pwd) + +# trap errors +function err_fn() { + echo 'ERROR - aborting script.' + cd $CANOPY_CLIENT_DIR + trap - ERR +} +trap "err_fn; return" ERR + +# install python packages +pip install -r requirements.txt + +# setup chrony +sudo apt-get update +sudo apt-get install chrony +sudo cp chrony_canopy_client.service /lib/systemd/system +sudo cp chrony_canopy_client.conf /etc/chrony + +# make ros package +cd ../.. +catkin_make +. ./devel/setup.bash +cd $CANOPY_CLIENT_DIR From d68ce1466af5808d3c04aaea78cf7ac64feea2b4 Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Thu, 25 Jan 2018 14:01:32 -0500 Subject: [PATCH 08/12] Update README with instructions for chrony service --- README.md | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3c34301..f0e2e2b 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,52 @@ This is the ROS node for the client-side application of Canopy. ## Installation -See the [Canopy docs](http://canopy-docs.readthedocs.io/en/latest/client-docs.html#installation). +``` +cd /src +git clone https://github.com/baalexander/rospy_message_converter +git clone https://github.com/canopy-ros/canopy_client +cd canopy_client +. ./canopy_client_install.sh +``` ## Clock Synchronization This section describes the _client-side_ instructions for synchronizing the clocks of your Canopy clients and the Canopy server using `chrony`. -Install chrony and copy the configuration file to `/etc/chrony`: -``` -sudo apt-get install chrony -sudo cp chrony_canopy_client.conf /etc/chrony -``` - +### Setting up chrony Modify the chrony configuration file `/etc/chrony/chrony_canopy_client.conf` to reflect your Canopy server's IP address: ``` # /etc/chrony/chrony_canopy_client.conf server 128.31.37.168 ... ``` +Disable and stop the default chrony service: +``` +sudo systemctl stop chrony +sudo systemctl disable chrony +``` + +Enable and start the Canopy chrony service: +``` +sudo systemctl enable chrony_canopy_client +sudo systemctl start chrony_canopy_client +``` + +### Checking chrony setup +To check whether the service is running correctly, run `systemctl status chrony_canopy_client` which should show an active running status: +``` +chrony_canopy_client.service - chrony service for canopy client +Loaded: loaded (/lib/systemd/system/chrony_canopy_client.service; static; vendor preset: enabled) +Active: active (running) +... +``` -Restart chrony with this configuration file: +To check whether the chrony daemon `chronyd` is working correctly, run `chronyc activity` which should return the following: ``` -sudo chronyd -f /etc/chrony/chrony_canopy_client.conf -r -s +200 OK +3 sources online +0 sources offline +0 sources doing burst (return to online) +0 sources doing burst (return to offline) +0 sources with unknown address ``` +If you see the message `506 Cannot talk to daemon`, then `chronyd` is not running properly. From cbf71f68cc11bdf62bdae3b66003b4d138d10c32 Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Thu, 25 Jan 2018 14:03:39 -0500 Subject: [PATCH 09/12] Reset trap in install script --- canopy_client_install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/canopy_client_install.sh b/canopy_client_install.sh index 77d826e..c8eeef7 100755 --- a/canopy_client_install.sh +++ b/canopy_client_install.sh @@ -23,3 +23,5 @@ cd ../.. catkin_make . ./devel/setup.bash cd $CANOPY_CLIENT_DIR +trap - ERR +echo "SUCCESS - script successfully installed." From 3d01d6dc8be945a2e6db268368a923dd5997e58a Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Thu, 25 Jan 2018 14:18:31 -0500 Subject: [PATCH 10/12] Update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f0e2e2b..ad3874c 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,10 @@ Active: active (running) ... ``` -To check whether the chrony daemon `chronyd` is working correctly, run `chronyc activity` which should return the following: +To check whether the chrony daemon `chronyd` is working correctly, first setup chrony on the [Canopy server](https://github.com/canopy-ros/canopy_server_startup/) and ensure that it is running correctly. Then run `chronyc activity` on the client which should return the following: ``` 200 OK -3 sources online +1 sources online 0 sources offline 0 sources doing burst (return to online) 0 sources doing burst (return to offline) From c4ffd9140913946eea5338753badd4539169791b Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Thu, 25 Jan 2018 15:31:38 -0500 Subject: [PATCH 11/12] Make chrony service restart on boot --- chrony_canopy_client.service | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrony_canopy_client.service b/chrony_canopy_client.service index bae4d44..7a01e98 100644 --- a/chrony_canopy_client.service +++ b/chrony_canopy_client.service @@ -4,5 +4,9 @@ Conflicts = ntpd.service [Service] Type = forking +Restart = always PIDFile = /var/run/chronyd.pid ExecStart = /usr/sbin/chronyd -f /etc/chrony/chrony_canopy_client.conf -r -s + +[Install] +WantedBy = default.target \ No newline at end of file From 43285f5b6f27cbef053998cce233dfe1182f223a Mon Sep 17 00:00:00 2001 From: Zareen Choudhury Date: Thu, 25 Jan 2018 15:47:46 -0500 Subject: [PATCH 12/12] Update README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ad3874c..39a5255 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,5 @@ To check whether the chrony daemon `chronyd` is working correctly, first setup c 0 sources with unknown address ``` If you see the message `506 Cannot talk to daemon`, then `chronyd` is not running properly. + +Finally run `chronyc sources` and you should see your Canopy server's IP address listed. If you are connecting the chrony client to the chrony server for the first time, it may take several minutes before the correct IP is listed under sources.