Skip to content

Commit 3bad289

Browse files
committed
Added chrony
Updated wifi script
1 parent 7dd4f30 commit 3bad289

File tree

3 files changed

+68
-5
lines changed

3 files changed

+68
-5
lines changed

conf/chrony.conf

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Welcome to the chrony configuration file. See chrony.conf(5) for more
2+
# information about usuable directives.
3+
4+
# This will use (up to):
5+
# - 4 sources from ntp.ubuntu.com which some are ipv6 enabled
6+
# - 2 sources from 2.ubuntu.pool.ntp.org which is ipv6 enabled as well
7+
# - 1 source from [01].ubuntu.pool.ntp.org each (ipv4 only atm)
8+
# This means by default, up to 6 dual-stack and up to 2 additional IPv4-only
9+
# sources will be used.
10+
# At the same time it retains some protection against one of the entries being
11+
# down (compare to just using one of the lines). See (LP: #1754358) for the
12+
# discussion.
13+
#
14+
# About using servers from the NTP Pool Project in general see (LP: #104525).
15+
# Approved by Ubuntu Technical Board on 2011-02-08.
16+
# See http://www.pool.ntp.org/join.html for more information.
17+
pool ntp.ubuntu.com iburst maxsources 4
18+
pool 0.ubuntu.pool.ntp.org iburst maxsources 1
19+
pool 1.ubuntu.pool.ntp.org iburst maxsources 1
20+
pool 2.ubuntu.pool.ntp.org iburst maxsources 2
21+
22+
server 192.168.186.2 presend 0 minpoll 0 maxpoll 0 iburst prefer trust
23+
# Enable serving time to ntp clients on 192.168.186.0 subnet.
24+
allow 192.168.186.0/24
25+
# Allow local sync
26+
local stratum 10
27+
28+
# This directive specify the location of the file containing ID/key pairs for
29+
# NTP authentication.
30+
keyfile /etc/chrony/chrony.keys
31+
32+
# This directive specify the file into which chronyd will store the rate
33+
# information.
34+
driftfile /var/lib/chrony/chrony.drift
35+
36+
# Uncomment the following line to turn logging on.
37+
#log tracking measurements statistics
38+
39+
# Log files location.
40+
logdir /var/log/chrony
41+
42+
# Stop bad estimates upsetting machine clock.
43+
maxupdateskew 100.0
44+
45+
# This directive enables kernel synchronisation (every 11 minutes) of the
46+
# real-time clock. Note that it can’t be used along with the 'rtcfile' directive.
47+
rtcsync
48+
49+
# Step the system clock instead of slewing it if the adjustment is larger than
50+
# one second, but only in the first three clock updates.
51+
makestep 1 3

scripts/turtlebot4_setup.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ sudo apt install -y \
5757
libgpiod-dev \
5858
network-manager \
5959
daemontools \
60-
ros-galactic-robot-upstart
60+
ros-galactic-robot-upstart \
61+
chrony
6162

6263
# Install bluetooth packages
6364
bash $SCRIPT_DIR/bluetooth.sh
@@ -78,6 +79,12 @@ sudo bash $SCRIPT_DIR/swap_off.sh
7879
# Copy udev rules
7980
sudo cp $SETUP_DIR/udev/turtlebot4.rules /etc/udev/rules.d/
8081

82+
# Copy chrony config
83+
sudo cp $SETUP_DIR/conf/chrony.conf /etc/chrony/
84+
85+
# Restart chrony
86+
sudo service chrony restart
87+
8188
# Enable usb0
8289
echo "dtoverlay=dwc2,dr_mode=peripheral" | sudo tee -a /boot/firmware/usercfg.txt
8390
sudo sed -i '${s/$/ modules-load=dwc2,g_ether/}' /boot/firmware/cmdline.txt
@@ -89,9 +96,12 @@ echo "dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=4,i2c_gpio_scl=5
8996
echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" | sudo tee -a ~/.bashrc
9097
echo "export CYCLONEDDS_URI='<CycloneDDS><Domain><General><NetworkInterfaceAddress>wlan0,usb0</></></></>'" | sudo tee -a ~/.bashrc
9198

99+
# Source galactic setup in bashrc
100+
echo "source /opt/ros/galactic/setup.bash" | sudo tee -a ~/.bashrc
101+
92102
# Robot upstart
93103

94-
ros2 run robot_upstart install turtlebot4_bringup/launch/$model.launch.py --job turtlebot4
104+
ros2 run robot_upstart install turtlebot4_bringup/launch/$model.launch.py --job turtlebot4 --rmw rmw_cyclonedds_cpp --rmw_config "'<CycloneDDS><Domain><General><NetworkInterfaceAddress>wlan0,usb0</></></></>'"
95105

96106
sudo systemctl daemon-reload
97107

scripts/wifi.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ echo "SSID: $ssid";
7474
echo "Password: $password";
7575
echo "AP mode: $ap";
7676
echo "Domain: $domain";
77+
read -p "Press enter to apply these settings."
7778

7879
# Create netplan .yaml file
7980
echo -e "network: \n\
@@ -82,6 +83,7 @@ echo -e "network: \n\
8283
eth0: \n\
8384
dhcp4: true \n\
8485
optional: true \n\
86+
addresses: [192.168.185.3/24] \n\
8587
usb0: \n\
8688
dhcp4: false \n\
8789
optional: true \n\
@@ -101,7 +103,7 @@ echo -e "network: \n\
101103

102104
#If reg domain already exists, replace it
103105
if grep -Fq "REGDOMAIN=" /etc/default/crda
104-
then
106+
then
105107
sudo sed -i "s/REGDOMAIN=.*/REGDOMAIN=$domain/g" /etc/default/crda
106108
else
107109
echo "REGDOMAIN=$domain" | sudo tee -a /etc/default/crda
@@ -110,7 +112,7 @@ fi
110112

111113
#If country domain already exists, replace it
112114
if grep -Fq "COUNTRY=" /etc/environment
113-
then
115+
then
114116
sudo sed -i "s/COUNTRY=.*/COUNTRY=$domain/g" /etc/environment
115117
else
116118
echo "COUNTRY=$domain" | sudo tee -a /etc/environment
@@ -123,7 +125,7 @@ case $domain in
123125
create3_domain=FCC
124126
;;
125127

126-
JP)
128+
JP|JP3)
127129
create3_domain=Japan
128130
;;
129131
esac

0 commit comments

Comments
 (0)