diff --git a/scripts/bluetooth.sh b/scripts/bluetooth.sh deleted file mode 100755 index 52716b4..0000000 --- a/scripts/bluetooth.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -sudo apt install -y \ -bluez \ -bluez-tools \ -pi-bluetooth diff --git a/scripts/create_update.sh b/scripts/create_update.sh index 241fb7b..5847051 100755 --- a/scripts/create_update.sh +++ b/scripts/create_update.sh @@ -5,7 +5,7 @@ Help() { - echo "Create 3 update script for robots running G.2.1 or higher" + echo "Create 3 update script for robots running H.1.0 or higher" echo echo "usage: bash create_update.sh /path/to/image.swu [-h]" echo "options:" diff --git a/scripts/create_update_0.4.0.sh b/scripts/create_update_0.4.0.sh deleted file mode 100755 index 10371de..0000000 --- a/scripts/create_update_0.4.0.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -# Flags: -# -h Help - -Help() -{ - echo "Create 3 update script for robots running 0.4.0" - echo - echo "usage: bash create_update.sh /path/to/image.swu [-h]" - echo "options:" - echo " -h Print this help statement" - echo -} - -while getopts "h" flag -do - case "${flag}" in - h) - Help - exit;; - \?) - echo "Error: Invalid flag" - exit;; - esac -done - -echo "Image path: $1"; - -curl -F fileupload=@$1 http://192.168.186.2/cgi-bin/update.sh diff --git a/scripts/install.py b/scripts/install.py deleted file mode 100755 index 7fb5cbb..0000000 --- a/scripts/install.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python3 -# Copyright 2022 Clearpath Robotics, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# @author Roni Kreinin (rkreinin@clearpathrobotics.com) - -import argparse -import os -import sys - -import robot_upstart - -parser = argparse.ArgumentParser() - -parser.add_argument('model', type=str) - -args = parser.parse_args() - -if args.model != 'lite' and args.model != 'standard': - print('Invalid model: {0}'.format(args.model)) - parser.print_help() - sys.exit(1) - -model = args.model -domain_id = os.environ['ROS_DOMAIN_ID'] or 0 -rmw = os.environ['RMW_IMPLEMENTATION'] or 'rmw_fastrtps_cpp' -workspace = os.environ['ROBOT_SETUP'] or '/opt/ros/humble/setup.bash' - -print('Installing TurtleBot 4 {0}. ROS_DOMAIN_ID={1}, RMW_IMPLEMENTATION={2}'.format(model, domain_id, rmw)) - -if rmw == 'rmw_cyclonedds_cpp': - rmw_config = os.environ['CYCLONEDDS_URI'] -else: - rmw_config = os.environ['FASTRTPS_DEFAULT_PROFILES_FILE'] - -turtlebot4_job = robot_upstart.Job(name='turtlebot4', - rmw=rmw, - rmw_config=rmw_config, - workspace_setup=workspace, - ros_domain_id=domain_id) - -turtlebot4_job.symlink = True -turtlebot4_job.add(package='turtlebot4_bringup', filename='launch/{0}.launch.py'.format(model)) -turtlebot4_job.install() diff --git a/scripts/ros_config.sh b/scripts/ros_config.sh deleted file mode 100755 index 3f7609a..0000000 --- a/scripts/ros_config.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env bash - -# Flags: -# -h Help - -Help() -{ - echo "TurtleBot 4 ROS configuration" - echo - echo "usage: sudo bash ros_config.sh [-h]" - echo "options:" - echo " -h Print this help statement" - echo -} - -while getopts "h" flag -do - case "${flag}" in - h) - Help - exit;; - \?) - echo "Error: Invalid flag" - exit;; - esac -done - -read -p "ROS_DOMAIN_ID (default 0): " ros_domain_id -ros_domain_id=${ros_domain_id:-0} -#read -p "ROS namespace (default empty): " namespace -read -p "RMW Implementation [rmw_cyclonedds_cpp,rmw_fastrtps_cpp] (default rmw_fastrtps_cpp): " rmw -rmw=${rmw:-rmw_fastrtps_cpp} - -echo "ROS_DOMAIN_ID: $ros_domain_id"; -#echo "Namespace: $namespace"; -echo "RMW_IMPLEMENTATION: $rmw"; -read -p "Press enter to apply these settings." - -ttb4=$( cat /etc/turtlebot4 ) - -model="standard" - -case $ttb4 in - *"lite"*) - model="lite";; -esac - -# Set Create 3 configuration -curl -d "ros_domain_id=$ros_domain_id&ros_namespace=&rmw_implementation=$rmw" -X POST http://192.168.186.2/ros-config-save-main -o /dev/null - -# Reboot Create 3 -curl -X POST http://192.168.186.2/api/reboot - -# Stop running turtlebot4 service -sudo systemctl stop turtlebot4.service - -# Uninstall robot_upstart job -uninstall.py - -# Install robot_upstart job with new ROS_DOMAIN_ID -install.py $model --domain $ros_domain_id --rmw $rmw - -# Start job -sudo systemctl daemon-reload && sudo systemctl start turtlebot4 - -# Add settings to .bashrc -if grep -Fq "export RMW_IMPLEMENTATION=" ~/.bashrc -then - sudo sed -i "s/export RMW_IMPLEMENTATION=.*/export RMW_IMPLEMENTATION=$rmw/g" ~/.bashrc -else - echo "export RMW_IMPLEMENTATION=$rmw" | sudo tee -a ~/.bashrc -fi - -if grep -Fq "export ROS_DOMAIN_ID=" ~/.bashrc -then - sudo sed -i "s/export ROS_DOMAIN_ID=.*/export ROS_DOMAIN_ID=$ros_domain_id/g" ~/.bashrc -else - echo "export ROS_DOMAIN_ID=$ros_domain_id" | sudo tee -a ~/.bashrc -fi - -echo "Source ~/.bashrc to apply these changes to this terminal." \ No newline at end of file diff --git a/scripts/uninstall.py b/scripts/uninstall.py deleted file mode 100755 index 337af9a..0000000 --- a/scripts/uninstall.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python3 -# Copyright 2022 Clearpath Robotics, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# @author Roni Kreinin (rkreinin@clearpathrobotics.com) - -import os - -import robot_upstart - -turtlebot4_job = robot_upstart.Job(name='turtlebot4', - workspace_setup=os.environ['ROBOT_SETUP']) - -turtlebot4_job.uninstall() diff --git a/scripts/wifi.sh b/scripts/wifi.sh deleted file mode 100755 index 47c3b5c..0000000 --- a/scripts/wifi.sh +++ /dev/null @@ -1,140 +0,0 @@ -#!/usr/bin/env bash - -# Flags: -# -s SSID -# -p Password -# -ap Access Point mode - -Help() -{ - echo "Raspberry PI 4B WiFi Setup script." - echo - echo "usage: bash wifi.sh [-s] \"SSID\" [-p] \"PASSWORD\" [-a] [value] [-c] [value] [-h]" - echo "options:" - echo " s WiFi SSID" - echo " p WiFi Password" - echo " a Access Point mode. Default SSID and password: Turtlebot4" - echo " c Send WiFi credentials to Create 3." - echo " r Regulatory domain. Default CA" - echo " h Print this help statement" - echo -} - -ap=0; -create3=0; - -while getopts "s:p:cr:ha" flag -do - case "${flag}" in - s) ssid=${OPTARG};; - p) password=${OPTARG};; - a) ap=1;; - c) create3=1;; - r) domain=${OPTARG};; - h) - Help - exit;; - \?) - echo "Error: Invalid flag" - exit;; - esac -done - -# AP mode -if [ $ap -eq 1 ] -then - if [ -z "$ssid" ] && [ -z "$password" ] - then - ssid="Turtlebot4"; - password="Turtlebot4"; - fi -else - if [ -z "$ssid" ] - then - echo "Invalid ssid"; - Help - exit 1 - fi -fi - -# Comment out AP mode if not using -if [ $ap -eq 0 ] -then - ap_comment="#"; -else - ap_comment=""; -fi - -if [ -z $domain ] -then - domain="CA"; -fi - -echo "SSID: $ssid"; -echo "Password: $password"; -echo "AP mode: $ap"; -echo "Domain: $domain"; -read -p "Press enter to apply these settings." - -# Create netplan .yaml file -echo -e "network: \n\ - version: 2 \n\ - ethernets: \n\ - eth0: \n\ - dhcp4: true \n\ - optional: true \n\ - addresses: [192.168.185.3/24] \n\ - usb0: \n\ - dhcp4: false \n\ - optional: true \n\ - addresses: [192.168.186.3/24] \n\ - version: 2 \n\ - wifis: \n\ - renderer: NetworkManager \n\ - wlan0: \n\ - optional: true \n\ - access-points: \n\ - "$ssid": \n\ - password: "$password" \n\ - $ap_comment mode: ap \n\ - $ap_comment band: 5GHz \n\ - dhcp4: true\n" | sudo tee /etc/netplan/50-cloud-init.yaml - -# Add regulatory domain - -#If reg domain already exists, replace it -if grep -Fq "REGDOMAIN=" /etc/default/crda -then - sudo sed -i "s/REGDOMAIN=.*/REGDOMAIN=$domain/g" /etc/default/crda -else - echo "REGDOMAIN=$domain" | sudo tee -a /etc/default/crda -fi - - -#If country domain already exists, replace it -if grep -Fq "COUNTRY=" /etc/environment -then - sudo sed -i "s/COUNTRY=.*/COUNTRY=$domain/g" /etc/environment -else - echo "COUNTRY=$domain" | sudo tee -a /etc/environment -fi - -create3_domain=ETSI; - -case $domain in - AS|CA|FM|GU|KY|MP|PR|TW|UM|US|VI) - create3_domain=FCC - ;; - - JP|JP3) - create3_domain=Japan - ;; -esac - -if [ $create3 -eq 1 ] -then - curl -X POST -d "ssids=$ssid&pass=$password&countryids=$create3_domain" "http://192.168.186.2/wifi-action-change" -fi - -sudo netplan generate -sudo netplan apply