Skip to content

Commit d7c2278

Browse files
committed
v0.1.2
1 parent 3bad289 commit d7c2278

File tree

9 files changed

+140
-49
lines changed

9 files changed

+140
-49
lines changed

conf/cyclonedds_pc.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<CycloneDDS>
2+
<Domain>
3+
<General>
4+
<DontRoute>true</DontRoute>
5+
</General>
6+
</Domain>
7+
</CycloneDDS>

conf/cyclonedds_rpi.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<CycloneDDS>
2+
<Domain>
3+
<General>
4+
<NetworkInterfaceAddress>wlan0,usb0</NetworkInterfaceAddress>
5+
</General>
6+
</Domain>
7+
</CycloneDDS>

scripts/galactic.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
sudo apt update && sudo apt install curl gnupg lsb-release -y
33
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
4-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
4+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2-testing/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
55
sudo apt update
66
sudo apt install -y \
77
ros-galactic-ros-base \

scripts/install.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env python3
2+
# Copyright 2022 Clearpath Robotics, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# @author Roni Kreinin ([email protected])
17+
18+
import sys
19+
20+
import robot_upstart
21+
22+
23+
def help():
24+
print('TurtleBot 4 robot_upstart install script.')
25+
print('Usage: install.py [model] <ROS_DOMAIN_ID>')
26+
print('models: lite, standard')
27+
print('ROS_DOMAIN_ID: optional, defaults to 0')
28+
29+
30+
argc = len(sys.argv)
31+
32+
if argc == 1:
33+
print('Model required.')
34+
help()
35+
sys.exit(1)
36+
37+
model = sys.argv[1]
38+
if model != 'lite' and model != 'standard':
39+
print('Invalid model {0}'.format(model))
40+
help()
41+
sys.exit(2)
42+
43+
domain_id = 0
44+
if argc == 3:
45+
try:
46+
domain_id = int(sys.argv[2])
47+
except ValueError:
48+
print('Invalid ROS_DOMAIN_ID {0}'.format(sys.argv[2]))
49+
help()
50+
sys.exit(3)
51+
52+
print('Installing TurtleBot 4 {0}. ROS_DOMAIN_ID={1}'.format(model, domain_id))
53+
54+
turtlebot4_job = robot_upstart.Job(name='turtlebot4',
55+
rmw='rmw_cyclonedds_cpp',
56+
rmw_config='/etc/cyclonedds_rpi.xml',
57+
workspace_setup='/opt/ros/galactic/setup.bash',
58+
ros_domain_id=domain_id)
59+
60+
turtlebot4_job.symlink = True
61+
turtlebot4_job.add(package='turtlebot4_bringup', filename='launch/{0}.launch.py'.format(model))
62+
turtlebot4_job.install()

scripts/oakd.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/turtlebot4_setup.sh

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
#!/usr/bin/env bash
22

3+
# Copyright 2022 Clearpath Robotics, Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
# @author Roni Kreinin ([email protected])
18+
319
# Flags:
420
# -m Turtlebot4 Model (lite, standard)
5-
# -c OAK-D Camera Model (lite, pro)
621

722
Help()
823
{
@@ -49,32 +64,14 @@ SETUP_DIR=${SCRIPT_DIR%/*}
4964
bash $SCRIPT_DIR/galactic.sh
5065
source /opt/ros/galactic/setup.bash
5166

52-
# Install source packages
53-
vcs import src < $SETUP_DIR/turtlebot4_packages.repos
54-
55-
# Install additional packages
67+
# Install packages
5668
sudo apt install -y \
57-
libgpiod-dev \
5869
network-manager \
5970
daemontools \
6071
ros-galactic-robot-upstart \
61-
chrony
62-
63-
# Install bluetooth packages
64-
bash $SCRIPT_DIR/bluetooth.sh
65-
# Install OAK-D drivers
66-
bash $SCRIPT_DIR/oakd.sh
67-
68-
# Run rosdep
69-
sudo rosdep init
70-
rosdep update
71-
rosdep install -r --from-paths src -i -y --rosdistro galactic
72-
73-
# Add swap memory and build packages
74-
sudo bash $SCRIPT_DIR/swap_on.sh
75-
colcon build --symlink-install
76-
source install/setup.bash
77-
sudo bash $SCRIPT_DIR/swap_off.sh
72+
chrony \
73+
ros-galactic-turtlebot4-robot \
74+
ros-galactic-irobot-create-control
7875

7976
# Copy udev rules
8077
sudo cp $SETUP_DIR/udev/turtlebot4.rules /etc/udev/rules.d/
@@ -93,21 +90,32 @@ sudo sed -i '${s/$/ modules-load=dwc2,g_ether/}' /boot/firmware/cmdline.txt
9390
echo "dtoverlay=i2c-gpio,bus=3,i2c_gpio_delay_us=1,i2c_gpio_sda=4,i2c_gpio_scl=5" | sudo tee -a /boot/firmware/usercfg.txt
9491

9592
# Configure cyclonedds
93+
sudo cp $SETUP_DIR/conf/cyclonedds_rpi.xml /etc/
9694
echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" | sudo tee -a ~/.bashrc
97-
echo "export CYCLONEDDS_URI='<CycloneDDS><Domain><General><NetworkInterfaceAddress>wlan0,usb0</></></></>'" | sudo tee -a ~/.bashrc
95+
echo "export CYCLONEDDS_URI=/etc/cyclonedds_rpi.xml" | sudo tee -a ~/.bashrc
9896

9997
# Source galactic setup in bashrc
10098
echo "source /opt/ros/galactic/setup.bash" | sudo tee -a ~/.bashrc
10199

102100
# Robot upstart
103-
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</></></></>'"
101+
$SCRIPT_DIR/install.py $model
105102

106103
sudo systemctl daemon-reload
107104

108105
# Copy scripts to local bin
109-
sudo cp $SETUP_DIR/scripts/wifi.sh $SETUP_DIR/scripts/create_update.sh $SETUP_DIR/scripts/swap_on.sh $SETUP_DIR/scripts/swap_off.sh /usr/local/bin
110-
111-
read -p "Installation complete, press enter to reboot."
112-
113-
sudo reboot
106+
sudo cp $SCRIPT_DIR/wifi.sh \
107+
$SCRIPT_DIR/create_update_0.4.0.sh \
108+
$SCRIPT_DIR/create_update.sh \
109+
$SCRIPT_DIR/swap_on.sh \
110+
$SCRIPT_DIR/swap_off.sh \
111+
$SCRIPT_DIR/bluetooth.sh \
112+
$SCRIPT_DIR/install.py \
113+
$SCRIPT_DIR/uninstall.py /usr/local/bin
114+
115+
# Set image information
116+
sudo touch /etc/turtlebot4
117+
echo "TurtleBot 4 $model v0.1.2" | sudo tee /etc/turtlebot4
118+
119+
echo "Installation complete, press enter to reboot in AP mode."
120+
121+
sudo $SETUP_DIR/scripts/wifi.sh -a && sudo reboot

scripts/uninstall.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
# Copyright 2022 Clearpath Robotics, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# @author Roni Kreinin ([email protected])
17+
18+
import robot_upstart
19+
20+
turtlebot4_job = robot_upstart.Job(name='turtlebot4',
21+
workspace_setup='/opt/ros/galactic/setup.bash')
22+
23+
turtlebot4_job.uninstall()

scripts/wifi.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ echo -e "network: \n\
9797
$ssid: \n\
9898
password: $password \n\
9999
$ap_comment mode: ap \n\
100+
$ap_comment band: 5GHz \n\
100101
dhcp4: true\n" | sudo tee /etc/netplan/50-cloud-init.yaml
101102

102103
# Add regulatory domain

turtlebot4_packages.repos

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)