diff --git a/factory/18.04/stretch_create_catkin_workspace.sh b/factory/18.04/stretch_create_catkin_workspace.sh index 7b1d9df..1082bda 100755 --- a/factory/18.04/stretch_create_catkin_workspace.sh +++ b/factory/18.04/stretch_create_catkin_workspace.sh @@ -45,6 +45,8 @@ if [[ -d $CATKIN_WSDIR ]]; then prompt_yes_no fi +echo "Apt update..." +sudo apt-get --yes update >> $REDIRECT_LOGFILE echo "Deleting $CATKIN_WSDIR if it already exists..." sudo rm -rf $CATKIN_WSDIR # see http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment for details diff --git a/factory/18.04/stretch_initial_setup.sh b/factory/18.04/stretch_initial_setup.sh index e0895de..47f914b 100755 --- a/factory/18.04/stretch_initial_setup.sh +++ b/factory/18.04/stretch_initial_setup.sh @@ -81,8 +81,8 @@ if [ $do_factory_install = 'false' ]; then echo "Expecting robot calibration $HELLO_FLEET_ID to be present in the the home folder. Exiting." exit 1 fi + chmod -R a+r $HOME/$HELLO_FLEET_ID fi -chmod -R a+r $HOME/$HELLO_FLEET_ID echo "Waiting to get online..." while ! timeout 0.2 ping -c 1 -n google.com &> /dev/null @@ -129,7 +129,7 @@ else fi echo "Setting up UDEV rules..." -sudo cp /etc/hello-robot/$HELLO_FLEET_ID/udev/*.rules /etc/udev/rules.d +sudo sh -c "cp /etc/hello-robot/$HELLO_FLEET_ID/udev/*.rules /etc/udev/rules.d" sudo udevadm control --reload echo "Allow shutdown without password..." diff --git a/factory/20.04/stretch_create_catkin_workspace.sh b/factory/20.04/stretch_create_catkin_workspace.sh index 334b271..e013727 100755 --- a/factory/20.04/stretch_create_catkin_workspace.sh +++ b/factory/20.04/stretch_create_catkin_workspace.sh @@ -45,6 +45,8 @@ if [[ -d $CATKIN_WSDIR ]]; then prompt_yes_no fi +echo "Apt update..." +sudo apt-get --yes update >> $REDIRECT_LOGFILE echo "Updating rosdep indices..." rosdep update --include-eol-distros &>> $REDIRECT_LOGFILE echo "Deleting $CATKIN_WSDIR if it already exists..." diff --git a/factory/20.04/stretch_initial_setup.sh b/factory/20.04/stretch_initial_setup.sh index a506e17..91dc609 100755 --- a/factory/20.04/stretch_initial_setup.sh +++ b/factory/20.04/stretch_initial_setup.sh @@ -80,8 +80,8 @@ if [ $do_factory_install = 'false' ]; then echo "Expecting robot calibration $HELLO_FLEET_ID to be present in the the home folder. Exiting." exit 1 fi + chmod -R a+r $HOME/$HELLO_FLEET_ID fi -chmod -R a+r $HOME/$HELLO_FLEET_ID echo "Waiting to get online..." while ! timeout 0.2 ping -c 1 -n google.com &> /dev/null @@ -128,7 +128,7 @@ else fi echo "Setting up UDEV rules..." -sudo cp /etc/hello-robot/$HELLO_FLEET_ID/udev/*.rules /etc/udev/rules.d +sudo sh -c "cp /etc/hello-robot/$HELLO_FLEET_ID/udev/*.rules /etc/udev/rules.d" sudo udevadm control --reload echo "Allow shutdown without password..." diff --git a/factory/22.04/stretch_create_ament_workspace.sh b/factory/22.04/stretch_create_ament_workspace.sh index 579216b..589d426 100755 --- a/factory/22.04/stretch_create_ament_workspace.sh +++ b/factory/22.04/stretch_create_ament_workspace.sh @@ -46,6 +46,9 @@ if [[ -d $AMENT_WSDIR ]]; then prompt_yes_no fi +echo "Apt update..." +sudo apt-get --yes update >> $REDIRECT_LOGFILE + echo "Downgrade to numpy 1.26.4..." pip3 install numpy==1.26.4 &>> $REDIRECT_LOGFILE diff --git a/factory/22.04/stretch_initial_setup.sh b/factory/22.04/stretch_initial_setup.sh index 68d9a82..7e6695b 100755 --- a/factory/22.04/stretch_initial_setup.sh +++ b/factory/22.04/stretch_initial_setup.sh @@ -80,8 +80,8 @@ if [ $do_factory_install = 'false' ]; then echo "Expecting robot calibration $HELLO_FLEET_ID to be present in the the home folder. Exiting." exit 1 fi + chmod -R a+r $HOME/$HELLO_FLEET_ID fi -chmod -R a+r $HOME/$HELLO_FLEET_ID echo "Waiting to get online..." while ! timeout 0.2 ping -c 1 -n google.com &> /dev/null @@ -128,7 +128,7 @@ else fi echo "Setting up UDEV rules..." -sudo cp /etc/hello-robot/$HELLO_FLEET_ID/udev/*.rules /etc/udev/rules.d +sudo sh -c "cp /etc/hello-robot/$HELLO_FLEET_ID/udev/*.rules /etc/udev/rules.d" sudo udevadm control --reload echo "Allow shutdown without password..." diff --git a/factory/24.04/hello_robot_audio.desktop b/factory/24.04/hello_robot_audio.desktop new file mode 100644 index 0000000..2d99cb8 --- /dev/null +++ b/factory/24.04/hello_robot_audio.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=hello_robot_audio +Exec=/usr/bin/hello_robot_audio.sh +Hidden=false +X-GNOME-Autostart-enabled=true diff --git a/factory/24.04/hello_robot_audio.sh b/factory/24.04/hello_robot_audio.sh new file mode 100755 index 0000000..b1a35ea --- /dev/null +++ b/factory/24.04/hello_robot_audio.sh @@ -0,0 +1,6 @@ +#! /bin/bash +sleep 5 +pactl set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo +amixer set Master 80% +paplay --device=alsa_output.pci-0000_00_1f.3.analog-stereo /usr/share/sounds/ubuntu/stereo/desktop-login.ogg + diff --git a/factory/24.04/hello_robot_gamepad_teleop.desktop b/factory/24.04/hello_robot_gamepad_teleop.desktop new file mode 100644 index 0000000..924c0a1 --- /dev/null +++ b/factory/24.04/hello_robot_gamepad_teleop.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=hello_robot_gamepad_teleop +Exec=/usr/bin/hello_robot_gamepad_teleop.sh +Hidden=false +X-GNOME-Autostart-enabled=false diff --git a/factory/24.04/hello_robot_gamepad_teleop.sh b/factory/24.04/hello_robot_gamepad_teleop.sh new file mode 100755 index 0000000..eda051b --- /dev/null +++ b/factory/24.04/hello_robot_gamepad_teleop.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +. /etc/hello-robot/hello-robot.conf +export HELLO_FLEET_ID HELLO_FLEET_ID +export HELLO_FLEET_PATH=$HOME/stretch_user +/usr/bin/python3 $HOME/.local/bin/stretch_gamepad_teleop.py &>> "$HOME/stretch_user/log/hello_robot_gamepad_teleop.`date '+%Y%m%d%H%M'`.log" diff --git a/factory/24.04/hello_robot_lrf_off.desktop b/factory/24.04/hello_robot_lrf_off.desktop new file mode 100644 index 0000000..aec0cb9 --- /dev/null +++ b/factory/24.04/hello_robot_lrf_off.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=hello_robot_lrf_off +Exec= /usr/bin/hello_robot_lrf_off.py +Hidden=false +X-GNOME-Autostart-enabled=true diff --git a/factory/24.04/hello_robot_lrf_off.py b/factory/24.04/hello_robot_lrf_off.py new file mode 100755 index 0000000..9edee8f --- /dev/null +++ b/factory/24.04/hello_robot_lrf_off.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 +import serial +import time +#This script keeps the lrf port open while the computer is on +#This has the effect of keeping the DTR line high to the LRF, which in turn turns the motor off +#So long as one port is open on the serail the DTR remains high (see HUPcL in termios) +#Other programs can still open/close/read/write the port independent of this script +sp=serial.Serial('/dev/hello-lrf',115200,parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=1, dsrdtr=True) +while True: + time.sleep(1.0) diff --git a/factory/24.04/hello_robot_pimu_ping.desktop b/factory/24.04/hello_robot_pimu_ping.desktop new file mode 100644 index 0000000..dd16232 --- /dev/null +++ b/factory/24.04/hello_robot_pimu_ping.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=hello_robot_pimu_ping +Exec= /usr/bin/hello_robot_pimu_ping.sh +Hidden=false +X-GNOME-Autostart-enabled=true diff --git a/factory/24.04/hello_robot_pimu_ping.py b/factory/24.04/hello_robot_pimu_ping.py new file mode 100755 index 0000000..ae128bf --- /dev/null +++ b/factory/24.04/hello_robot_pimu_ping.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import stretch_body.pimu +import time +#This script establishes communications with the Pimu at launch then shutsdown +#This has the effect of letting the Pimu know that Ubuntu Desktop is live (which drives its LightBar state machine) + +print('Starting up Pimu Ping on %s'%time.asctime()) +ping_success=False +for i in range(10): + p = stretch_body.pimu.Pimu() + if p.startup(): + print('Successful ping of Pimu on try %d'%i) + p.stop() + exit(0) + p.stop() + time.sleep(1.0) + +print('Failed to ping Pimu') diff --git a/factory/24.04/hello_robot_pimu_ping.sh b/factory/24.04/hello_robot_pimu_ping.sh new file mode 100755 index 0000000..a6fe92e --- /dev/null +++ b/factory/24.04/hello_robot_pimu_ping.sh @@ -0,0 +1,7 @@ +#! /bin/bash + +. /etc/hello-robot/hello-robot.conf +export HELLO_FLEET_ID HELLO_FLEET_ID +export HELLO_FLEET_PATH=$HOME/stretch_user + +/usr/bin/python3 /usr/bin/hello_robot_pimu_ping.py &>> "$HOME/stretch_user/log/hello_robot_pimu_ping.`date '+%Y%m%d%H%M'`.log" diff --git a/factory/24.04/hello_robot_xbox_teleop.desktop b/factory/24.04/hello_robot_xbox_teleop.desktop new file mode 100644 index 0000000..8af1ad7 --- /dev/null +++ b/factory/24.04/hello_robot_xbox_teleop.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=hello_robot_xbox_teleop +Exec=/usr/bin/hello_robot_xbox_teleop.sh +Hidden=false +X-GNOME-Autostart-enabled=false diff --git a/factory/24.04/hello_robot_xbox_teleop.sh b/factory/24.04/hello_robot_xbox_teleop.sh new file mode 100755 index 0000000..6a95511 --- /dev/null +++ b/factory/24.04/hello_robot_xbox_teleop.sh @@ -0,0 +1,6 @@ +#! /bin/bash + +. /etc/hello-robot/hello-robot.conf +export HELLO_FLEET_ID HELLO_FLEET_ID +export HELLO_FLEET_PATH=$HOME/stretch_user +/usr/bin/python3 $HOME/.local/bin/stretch_xbox_controller_teleop.py &>> "$HOME/stretch_user/log/hello_robot_xbox_teleop.`date '+%Y%m%d%H%M'`.log" diff --git a/factory/24.04/hello_sudoers b/factory/24.04/hello_sudoers new file mode 100644 index 0000000..41457ab --- /dev/null +++ b/factory/24.04/hello_sudoers @@ -0,0 +1 @@ +ALL ALL=(ALL) NOPASSWD: /sbin/shutdown diff --git a/factory/24.04/motd/00-header b/factory/24.04/motd/00-header new file mode 100644 index 0000000..407bfcf --- /dev/null +++ b/factory/24.04/motd/00-header @@ -0,0 +1,30 @@ +#!/bin/sh +# +# 00-header - create the header of the MOTD +# Copyright (C) 2009-2010 Canonical Ltd. +# +# Authors: Dustin Kirkland +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +[ -r /etc/lsb-release ] && . /etc/lsb-release + +if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then + # Fall back to using the very slow lsb_release utility + DISTRIB_DESCRIPTION=$(lsb_release -s -d) +fi + +printf "Welcome to Stretch's %s Distribution\n" "$DISTRIB_RELEASE" +printf "based on %s (%s %s %s)\n" "$DISTRIB_DESCRIPTION" "$(uname -o)" "$(uname -r)" "$(uname -m)" diff --git a/factory/24.04/motd/10-help-text b/factory/24.04/motd/10-help-text new file mode 100644 index 0000000..c74d280 --- /dev/null +++ b/factory/24.04/motd/10-help-text @@ -0,0 +1,25 @@ +#!/bin/sh +# +# 10-help-text - print the help text associated with the distro +# Copyright (C) 2009-2010 Canonical Ltd. +# +# Authors: Dustin Kirkland , +# Brian Murray +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +printf "\n" +printf " * Documentation: https://docs.hello-robot.com/\n" +printf " * Support: https://forum.hello-robot.com/\n\n" diff --git a/factory/24.04/motd/10dpkg_options b/factory/24.04/motd/10dpkg_options new file mode 100644 index 0000000..5f58776 --- /dev/null +++ b/factory/24.04/motd/10dpkg_options @@ -0,0 +1,4 @@ +Dpkg::Options { + "--force-confdef"; + "--force-confold"; +} diff --git a/factory/24.04/stretch_about.png b/factory/24.04/stretch_about.png new file mode 100644 index 0000000..eeee30a Binary files /dev/null and b/factory/24.04/stretch_about.png differ diff --git a/factory/24.04/stretch_create_ament_workspace.sh b/factory/24.04/stretch_create_ament_workspace.sh new file mode 100755 index 0000000..8890399 --- /dev/null +++ b/factory/24.04/stretch_create_ament_workspace.sh @@ -0,0 +1,134 @@ +#!/bin/bash +set -e +export COLCON_EXTENSION_BLOCKLIST=colcon_core.event_handler.desktop_notification + +REDIRECT_LOGDIR="$HOME/stretch_user/log" +AMENT_WSDIR="$HOME/ament_ws" +while getopts l:w: opt; do + case $opt in + l) + if [[ -d $OPTARG ]]; then + REDIRECT_LOGDIR=$OPTARG + fi + ;; + w) + AMENT_WSDIR=$OPTARG + ;; + esac +done +REDIRECT_LOGFILE="$REDIRECT_LOGDIR/stretch_create_ament_workspace.`date '+%Y%m%d%H%M'`_redirected.txt" + +echo "###########################################" +echo "CREATING JAZZY AMENT WORKSPACE at $AMENT_WSDIR" +echo "###########################################" + +echo "Ensuring correct version of ROS is sourced..." +if [[ $ROS_DISTRO && ! $ROS_DISTRO = "jazzy" ]]; then + echo "Cannot create workspace while a conflicting ROS version is sourced. Exiting." + exit 1 +fi +source /opt/ros/jazzy/setup.bash + +if [[ -d $AMENT_WSDIR ]]; then + echo "You are about to delete and replace the existing ament workspace. If you have any personal data in the workspace, please create a back up before proceeding." + prompt_yes_no(){ + read -p "Do you want to continue? Press (y/n for yes/no): " x + if [ $x = "n" ]; then + echo "Exiting the script." + exit 1 + elif [ $x = "y" ]; then + echo "Continuing to create a new ament workspace." + else + echo "Press 'y' for yes or 'n' for no." + prompt_yes_no + fi + } + prompt_yes_no +fi + +echo "Apt update..." +sudo apt-get --yes update >> $REDIRECT_LOGFILE + +echo "Downgrade to numpy 1.26.4..." +export PIP_BREAK_SYSTEM_PACKAGES=1 +pip3 install numpy==1.26.4 &>> $REDIRECT_LOGFILE + +export PATH=${PATH}:~/.local/bin +. /etc/hello-robot/hello-robot.conf +export HELLO_FLEET_ID=$HELLO_FLEET_ID +export HELLO_FLEET_PATH=${HOME}/stretch_user +echo "Updating rosdep indices..." +rosdep update --include-eol-distros &>> $REDIRECT_LOGFILE +echo "Deleting $AMENT_WSDIR if it already exists..." +sudo rm -rf $AMENT_WSDIR +echo "Creating the workspace directory..." +mkdir -p $AMENT_WSDIR/src +echo "Cloning the workspace's packages..." +cd $AMENT_WSDIR/src +vcs import --input ~/stretch_install/factory/24.04/stretch_ros2_jazzy.repos &>> $REDIRECT_LOGFILE +echo "Fetch ROS packages' dependencies (this might take a while)..." +cd $AMENT_WSDIR/ +# The rosdep flags below have been chosen very carefully. Please review the docs before changing them. +# https://docs.ros.org/en/independent/api/rosdep/html/commands.html +rosdep install --rosdistro=jazzy -iy --from-paths src &>> $REDIRECT_LOGFILE +pip3 cache purge &>> $REDIRECT_LOGFILE + +# echo "Install web interface dependencies..." +# cd $AMENT_WSDIR/src/stretch_web_teleop +# pip3 install -r requirements.txt &>> $REDIRECT_LOGFILE +# npm install --force &>> $REDIRECT_LOGFILE +# npx playwright install &>> $REDIRECT_LOGFILE +# echo "Generating web interface certs..." +# cd $AMENT_WSDIR/src/stretch_web_teleop/certificates +# curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64" &>> $REDIRECT_LOGFILE +# chmod +x mkcert-v*-linux-amd64 +# sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert +# CAROOT=`pwd` mkcert --install &>> $REDIRECT_LOGFILE +# mkdir -p ~/.local/share/mkcert +# rm -rf ~/.local/share/mkcert/root* +# cp root* ~/.local/share/mkcert +# mkcert ${HELLO_FLEET_ID} ${HELLO_FLEET_ID}.local ${HELLO_FLEET_ID}.dev localhost 127.0.0.1 0.0.0.0 ::1 &>> $REDIRECT_LOGFILE +# rm mkcert-v*-linux-amd64 +# cd $AMENT_WSDIR/src/stretch_web_teleop +# touch .env +# echo certfile=${HELLO_FLEET_ID}+6.pem >> .env +# echo keyfile=${HELLO_FLEET_ID}+6-key.pem >> .env +# cd $AMENT_WSDIR/ + +# echo "Install FUNMAP dependencies..." +# curl -LsSf https://astral.sh/uv/install.sh | sh &>> $REDIRECT_LOGFILE +# cd $AMENT_WSDIR/src/stretch_ros2/stretch_funmap +# uv venv --system-site-packages --allow-existing .venv &>> $REDIRECT_LOGFILE +# uv sync --frozen &>> $REDIRECT_LOGFILE +# echo "Compile cython modules..." +# pip3 install setuptools==59.6.0 &>> $REDIRECT_LOGFILE # must use <61 for Colcon to correctly build Stretch FUNMAP +# uv run cythonize stretch_funmap/cython_min_cost_path.pyx -3 -i &>> $REDIRECT_LOGFILE +# cd $AMENT_WSDIR/ + +echo "Compile the workspace (this might take a while)..." +# pip3 install setuptools==59.6.0 &>> $REDIRECT_LOGFILE # must use <61 for Colcon to correctly build Stretch FUNMAP +# pip3 uninstall -y setuptools-scm &>> $REDIRECT_LOGFILE +pip3 uninstall -y nose &>> $REDIRECT_LOGFILE +colcon build &>> $REDIRECT_LOGFILE +echo "Source setup.bash file..." +source $AMENT_WSDIR/install/setup.bash +echo "Updating port privledges..." +sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80 &>> $REDIRECT_LOGFILE +echo net.ipv4.ip_unprivileged_port_start=80 | sudo tee --append /etc/sysctl.d/99-sysctl.conf &>> $REDIRECT_LOGFILE +echo "Update ~/.bashrc dotfile to source workspace..." +echo "source $AMENT_WSDIR/install/setup.bash" >> ~/.bashrc +echo "source /usr/share/colcon_cd/function/colcon_cd.sh" >> ~/.bashrc +echo "Updating meshes and xacros to ROS from stretch_urdf package." +/home/$USER/.local/bin/stretch_urdf_ros_update.py -y -v >> $REDIRECT_LOGFILE +echo "Setup uncalibrated robot URDF..." +ros2 run stretch_calibration update_uncalibrated_urdf >> $REDIRECT_LOGFILE +echo "Setup calibrated robot URDF..." +ros2 run stretch_calibration update_with_most_recent_calibration >> $REDIRECT_LOGFILE +colcon build &>> $REDIRECT_LOGFILE + +# echo "Amend FUNMAP executables to use venv..." +# pip3 install -U hello-robot-stretch-factory &>> $REDIRECT_LOGFILE # Necessary for the below CLI +# REx_amend_venv_execs.py stretch_funmap &>> $REDIRECT_LOGFILE + +echo "Downgrade to numpy 1.26.4..." +pip3 install numpy==1.26.4 &>> $REDIRECT_LOGFILE diff --git a/factory/24.04/stretch_initial_setup.sh b/factory/24.04/stretch_initial_setup.sh new file mode 100755 index 0000000..fbf9372 --- /dev/null +++ b/factory/24.04/stretch_initial_setup.sh @@ -0,0 +1,189 @@ +#!/bin/bash +set -e + +do_factory_install=${1:-'false'} + +if $do_factory_install; then + echo "WARNING: Running a FACTORY install. This is only meant to be run at Hello Robot HQ." +fi +echo "WARNING: Run this installation for fresh Ubuntu installs only." + +# Process automation variables from parent script +if [[ -n "$SETUP_FLEET_ID" ]]; then + echo "Using SETUP_FLEET_ID from environment: $SETUP_FLEET_ID" + HELLO_FLEET_ID="$SETUP_FLEET_ID" +elif [[ -n "$SETUP_MODEL" && -n "$SETUP_FLEET_NUMBER" ]]; then + HELLO_FLEET_ID="${SETUP_MODEL}-${SETUP_FLEET_NUMBER}" + echo "Using HELLO_FLEET_ID constructed from environment variables: $HELLO_FLEET_ID" +else + # Original interactive prompt if no automation variables provided + echo "Checking ~/.bashrc doesn't already define HELLO_FLEET_ID..." + if [[ $HELLO_FLEET_ID ]]; then + echo "Expecting var HELLO_FLEET_ID to be undefined. Check end of ~/.bashrc file, delete all lines in 'STRETCH BASHRC SETUP' section, and open a new terminal. Exiting." + exit 1 + fi + + PS3="Select model type: " + + select model in stretch-re1 stretch-re2 stretch-se3 + do + echo "Selected model: $model" + + if [[ "$model" == "stretch-re1" ]] + then + break + fi + + if [[ "$model" == "stretch-re2" ]] + then + break + fi + + if [[ "$model" == "stretch-se3" ]] + then + break + fi + + done + + pre=$model"-" + + echo -n "Enter fleet id xxxx for $pre""xxxx> " + read id + if [[ ! $id =~ ^[0-9]{4}$ ]]; then + echo "Input should be four digits. Exiting." + exit 1 + fi + + HELLO_FLEET_ID="$pre$id" +fi + +echo "HELLO_FLEET_ID will be $HELLO_FLEET_ID." +echo "Plug in charger & attach clip-clamp before proceeding." +read -p "Ready to proceed with installation (y/n)? " -n 1 -r +echo +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Confirmation failed. Will not proceed with installation." + exit 1 +fi + +DIR=`pwd` +echo "Checking Stretch Install cloned to right place..." +if [[ ! -d "$HOME/stretch_install" ]]; then + echo "Expecting Stretch Install to be in home folder. Exiting." + exit 1 +fi + +if [ $do_factory_install = 'false' ]; then + echo "Checking robot calibration data in home folder..." + if [[ ! -d "$HOME/$HELLO_FLEET_ID" ]]; then + echo "Expecting robot calibration $HELLO_FLEET_ID to be present in the the home folder. Exiting." + exit 1 + fi + chmod -R a+r $HOME/$HELLO_FLEET_ID +fi + +echo "Waiting to get online..." +while ! timeout 0.2 ping -c 1 -n google.com &> /dev/null +do + sleep 1 + printf "%c" "." +done + +echo "Checking install repo is up-to-date..." +git remote update &> /dev/null +LOCAL=$(git rev-parse @) +REMOTE=$(git rev-parse @{u}) +if [ ! $LOCAL = $REMOTE ]; then + echo "Repo not up-to-date. Please perform a 'git pull'. Exiting." + exit 1 +fi + +echo "Waiting for apt lock..." +while sudo fuser /var/{lib/{dpkg,apt/lists},cache/apt/archives}/lock >/dev/null 2>&1; do + sleep 1 + printf "%c" "." +done + +echo "Setting up /etc/hello-robot directory..." +echo "HELLO_FLEET_ID=$HELLO_FLEET_ID">>hello-robot.conf +if [ -d "/etc/hello-robot" ]; then + sudo rm -rf /etc/hello-robot +fi +sudo mkdir /etc/hello-robot +sudo mv hello-robot.conf /etc/hello-robot +sudo cp $DIR/stretch_about.png /etc/hello-robot/ + +if $do_factory_install; then + echo "Fetching robot's calibration data from Github..." + cd ~/ + git config --global credential.helper store + git clone https://github.com/hello-robot/stretch_fleet.git + sudo cp -rf ~/stretch_fleet/robots/$HELLO_FLEET_ID /etc/hello-robot/ + rm -rf stretch_fleet +else + echo "Fetching robot's calibration data locally from $HOME/$HELLO_FLEET_ID directory..." + sudo cp -rf ~/$HELLO_FLEET_ID /etc/hello-robot + rm -rf ~/$HELLO_FLEET_ID +fi + +echo "Setting up UDEV rules..." +sudo sh -c "cp /etc/hello-robot/$HELLO_FLEET_ID/udev/*.rules /etc/udev/rules.d" +sudo udevadm control --reload + +echo "Allow shutdown without password..." +sudo cp $DIR/hello_sudoers /etc/sudoers.d/ + +echo "Setting up startup scripts..." +mkdir -p ~/.local/bin +sudo cp $DIR/hello_robot_audio.sh /usr/bin/ +sudo cp $DIR/hello_robot_lrf_off.py /usr/bin/ +sudo cp $DIR/hello_robot_pimu_ping.py /usr/bin/ +sudo cp $DIR/hello_robot_pimu_ping.sh /usr/bin/ +sudo cp $DIR/hello_robot_gamepad_teleop.sh /usr/bin/ + +echo "Setting up apt retries..." +echo 'Acquire::Retries "3";' > 80-retries +sudo mv 80-retries /etc/apt/apt.conf.d/ + +echo "Prevent screen dimming..." +gsettings set org.gnome.desktop.session idle-delay 0 &> /dev/null || true +gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0 &> /dev/null || true +gsettings set org.gnome.settings-daemon.plugins.power idle-dim false &> /dev/null || true + +echo "Setting up motd..." +if [ -d /etc/update-motd.d/ ]; then + sudo cp $DIR/motd/00-header /etc/update-motd.d/00-header + sudo chmod +x /etc/update-motd.d/00-header + sudo cp $DIR/motd/10-help-text /etc/update-motd.d/10-help-text + sudo chmod +x /etc/update-motd.d/10-help-text + sudo cp $DIR/motd/10dpkg_options /etc/apt/apt.conf.d/10dpkg_options +fi +if [ -f /etc/update-motd.d/50-motd-news ]; then + sudo chmod -x /etc/update-motd.d/50-motd-news +fi +if [ -f /etc/update-motd.d/88-esm-announce ]; then + sudo chmod -x /etc/update-motd.d/88-esm-announce +fi +if [ -f /etc/update-motd.d/90-updates-available ]; then + sudo chmod -x /etc/update-motd.d/90-updates-available +fi +if [ -f /etc/update-motd.d/91-release-upgrade ]; then + sudo chmod -x /etc/update-motd.d/91-release-upgrade +fi +if [ -f /etc/update-motd.d/95-hwe-eol ]; then + sudo chmod -x /etc/update-motd.d/95-hwe-eol +fi + +echo "Switching from Wayland to X11..." +if [ -f /etc/gdm3/custom.conf ]; then + sudo sed -i -e 's/#WaylandEnable=false/WaylandEnable=false/g' /etc/gdm3/custom.conf +fi + +echo 'Blacklisting hid_nintendo that conflicts with Xpad driver...' +function blacklist_hid_nintendo { + echo '# Nintendo conflicts with Xpad controller driver' | sudo tee -a /etc/modprobe.d/blacklist.conf + echo 'blacklist hid_nintendo' | sudo tee -a /etc/modprobe.d/blacklist.conf + sudo update-initramfs -u +} +blacklist_hid_nintendo &> /dev/null diff --git a/factory/24.04/stretch_install_arduino.sh b/factory/24.04/stretch_install_arduino.sh new file mode 100755 index 0000000..435ff79 --- /dev/null +++ b/factory/24.04/stretch_install_arduino.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=$HOME/.local/bin/ sh +$HOME/.local/bin/arduino-cli config init +$HOME/.local/bin/arduino-cli core install arduino:samd@1.6.21 +sed -i -e 's#Arduino#repos/stretch_firmware/arduino#g' ~/.arduino15/arduino-cli.yaml + diff --git a/factory/24.04/stretch_install_dev_tools.sh b/factory/24.04/stretch_install_dev_tools.sh new file mode 100755 index 0000000..03bae35 --- /dev/null +++ b/factory/24.04/stretch_install_dev_tools.sh @@ -0,0 +1,66 @@ +#!/bin/bash +set -e + +REDIRECT_LOGDIR="$HOME/stretch_user/log" +if getopts ":l:" opt && [[ $opt == "l" && -d $OPTARG ]]; then + REDIRECT_LOGDIR=$OPTARG +fi +REDIRECT_LOGFILE="$REDIRECT_LOGDIR/stretch_install_dev_tools.`date '+%Y%m%d%H%M'`_redirected.txt" + +echo "#############################################" +echo "INSTALLATION OF DEV TOOLS FOR HELLO ROBOT INTERNAL PRODUCTION" +echo "#############################################" + +echo "Install gh" +function install_gh { + type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) + curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ + && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && sudo apt update \ + && sudo apt install gh -y +} +install_gh &>> $REDIRECT_LOGFILE + +echo "Install Typora" +sudo snap install typora >> $REDIRECT_LOGFILE + +echo "Install PyCharm" +sudo snap install pycharm-community --classic >> $REDIRECT_LOGFILE + +echo "Install VS Code" +sudo snap install code --classic >> $REDIRECT_LOGFILE + +echo "Install tools for system QC and bringup" +pip3 install -q --no-warn-script-location twine &>> $REDIRECT_LOGFILE +pip3 install -q --no-warn-script-location gspread &>> $REDIRECT_LOGFILE +pip3 install -q --no-warn-script-location gspread-formatting &>> $REDIRECT_LOGFILE +pip3 install -q --no-warn-script-location oauth2client rsa==3.4 &>> $REDIRECT_LOGFILE +pip3 install -q --no-warn-script-location mkdocs mkdocs-material mkdocstrings==0.17.0 pytkdocs[numpy-style] jinja2==3.0.3 &>> $REDIRECT_LOGFILE + +echo "Cloning repos" +cd ~/repos/ +git clone https://github.com/hello-robot/stretch_install.git >> $REDIRECT_LOGFILE +git clone https://github.com/hello-robot/stretch_factory.git >> $REDIRECT_LOGFILE +git clone https://github.com/hello-robot/stretch_body.git >> $REDIRECT_LOGFILE +git clone https://github.com/hello-robot/stretch_firmware.git >> $REDIRECT_LOGFILE +git clone https://github.com/hello-robot/stretch_fleet.git >> $REDIRECT_LOGFILE +git clone https://github.com/hello-robot/stretch_production_tools.git >> $REDIRECT_LOGFILE +git clone https://github.com/hello-robot/stretch_production_data.git >> $REDIRECT_LOGFILE +git clone https://github.com/hello-robot/hello-robot.github.io >> $REDIRECT_LOGFILE +git clone https://github.com/hello-robot/stretch_docs >> $REDIRECT_LOGFILE + +echo "Install stretch_production_tools" +cd stretch_production_tools/python +pip3 install -e . + +# update .bashrc to add body code directory to the Python path + +#echo "export PATH=\${PATH}:~/repos/stretch_body/python/bin" >> ~/.bashrc +#echo "export PATH=\${PATH}:~/repos/stretch_factory/python/tools" >> ~/.bashrc + +#echo "export PYTHONPATH=\${PYTHONPATH}:~/repos/stretch_factory/python/tools" >> ~/.bashrc +#echo "export PYTHONPATH=\${PYTHONPATH}:~/repos/stretch_body/python" >> ~/.bashrc + +#echo "Source new bashrc now...Done." +#echo "" diff --git a/factory/24.04/stretch_install_firmware.sh b/factory/24.04/stretch_install_firmware.sh new file mode 100755 index 0000000..a701d9f --- /dev/null +++ b/factory/24.04/stretch_install_firmware.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +REDIRECT_LOGDIR="$HOME/stretch_user/log" +if getopts ":l:" opt && [[ $opt == "l" && -d $OPTARG ]]; then + REDIRECT_LOGDIR=$OPTARG +fi +REDIRECT_LOGFILE="$REDIRECT_LOGDIR/stretch_install_firmware.`date '+%Y%m%d%H%M'`_redirected.txt" + +echo "###########################################" +echo "INSTALLATION OF STRETCH FIRMWARE" +echo "###########################################" +source ~/.bashrc +echo "Read ttyACMx mapping" +REx_firmware_flash.py --map &>> $REDIRECT_LOGFILE +echo "Perform firmware update (this might take a while)" +REx_firmware_updater.py --install --no_prompts &>> $REDIRECT_LOGFILE diff --git a/factory/24.04/stretch_install_system.sh b/factory/24.04/stretch_install_system.sh new file mode 100755 index 0000000..6313ab7 --- /dev/null +++ b/factory/24.04/stretch_install_system.sh @@ -0,0 +1,186 @@ +#!/bin/bash +set -e + +REDIRECT_LOGDIR="$HOME/stretch_user/log" +if getopts ":l:" opt && [[ $opt == "l" && -d $OPTARG ]]; then + REDIRECT_LOGDIR=$OPTARG +fi +REDIRECT_LOGFILE="$REDIRECT_LOGDIR/stretch_install_system.`date '+%Y%m%d%H%M'`_redirected.txt" + +function install { + sudo apt-get install -y "$@" >> $REDIRECT_LOGFILE +} + +echo "###########################################" +echo "INSTALLATION OF SYSTEM WIDE PACKAGES" +echo "###########################################" +echo "Apt update & upgrade (this might take a while)" +sudo apt-add-repository universe -y >> $REDIRECT_LOGFILE +sudo apt-get --yes update >> $REDIRECT_LOGFILE +sudo apt-get --yes upgrade &>> $REDIRECT_LOGFILE +echo "Install zip & unzip" +install zip unzip +echo "Install Curl" +install curl +echo "Install ca-certificates" +install ca-certificates +echo "Install gnupg" +install gnupg +echo "Install Git" +install git +echo "Install rpl" +install rpl +echo "Install ipython3" +install ipython3 +echo "Install pip3" +install python3-pip +echo "Install Emacs packages" +sudo bash -c 'echo "postfix postfix/mailname string my.hostname.example" | debconf-set-selections' +sudo bash -c 'echo "postfix postfix/main_mailer_type string '\''Internet Site'\''" | debconf-set-selections' +install emacs yaml-mode +echo "Install nettools" +install net-tools +echo "Install wget" +install wget +echo "Install vim" +install vim +echo "Install pyserial" +install python3-serial +echo "Install Port Audio" +install portaudio19-dev +echo "Install lm-sensors & nvme-cli" +install lm-sensors +install nvme-cli +echo "Install cheese for camera testing" +install cheese +echo "Install SSH Server" +install ssh +echo "Install Chromium" +install chromium-browser +echo "Install htop" +install htop +echo "Install Ubuntu Sounds" +install ubuntu-sounds +echo "Install BleachBit" +install bleachbit +echo "Install APT HTTPS" +install apt-transport-https +echo "Install Network Security Services libraries" +install libnss3-tools +echo "Install uv" +curl -LsSf https://astral.sh/uv/install.sh | sh &>> $REDIRECT_LOGFILE +echo "" + +# https://docs.ros.org/en/jazzy/Installation/Ubuntu-Install-Debs.html +echo "###########################################" +echo "INSTALLATION OF ROS 2 JAZZY" +echo "###########################################" +echo "Install ros-apt-source" +function install_ros_apt_source { + export ROS_APT_SOURCE_VERSION=$(curl -s https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest | grep -F "tag_name" | awk -F\" '{print $4}') + echo $ROS_APT_SOURCE_VERSION + curl -L -o /tmp/ros2-apt-source.deb "https://github.com/ros-infrastructure/ros-apt-source/releases/download/${ROS_APT_SOURCE_VERSION}/ros2-apt-source_${ROS_APT_SOURCE_VERSION}.$(. /etc/os-release && echo $VERSION_CODENAME)_all.deb" + sudo dpkg -i /tmp/ros2-apt-source.deb +} +install_ros_apt_source &>> $REDIRECT_LOGFILE +echo "Apt update" +sudo apt-get --yes update >> $REDIRECT_LOGFILE +echo "Install ROS 2 Jazzy (this might take a while)" +install ros-jazzy-desktop-full +# https://discourse.ros.org/t/ros-developer-tools-now-in-binary-form/29802 +echo "Install Zenoh middleware" +install ros-jazzy-rmw-zenoh-cpp +echo "Install ROS 2 Dev Tools" +install ros-dev-tools +echo "Install colcon" +install python3-colcon-common-extensions +install python3-colcon-clean +echo "Install rosdep" +install python3-rosdep +echo "Configure rosdep" +if [ -f "/etc/ros/rosdep/sources.list.d/20-default.list" ]; then + sudo rm /etc/ros/rosdep/sources.list.d/20-default.list +fi +sudo rosdep init &>> $REDIRECT_LOGFILE +echo "Install vcstool" +install python3-vcstool +echo "" + +echo "###########################################" +echo "INSTALLATION OF ADDITIONAL ROS JAZZY PKGS" +echo "###########################################" +echo "Install packages to work with URDFs" +install liburdfdom-tools meshlab +install ros-jazzy-urdfdom-py +echo "Install joint state GUI package" +install ros-jazzy-joint-state-publisher-gui +echo "Install IMU visualization plugin for RViz and IMU filter" +install ros-jazzy-rviz-imu-plugin ros-jazzy-imu-filter-madgwick +echo "Install robot localization package for use with IMU and wheel odometry" +install ros-jazzy-robot-localization +echo "Install teleop packages" +install ros-jazzy-teleop-twist-keyboard +echo "" + +echo "###########################################" +echo "INSTALLATION OF INTEL REALSENSE" +echo "###########################################" +echo "Register the librealsense APT server's public key" +function register_librealsense_apt_server { + curl -sSf https://librealsense.intel.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null +} +register_librealsense_apt_server &>> $REDIRECT_LOGFILE +echo "Add the librealsense APT server to the list of APT repositories" +function add_librealsense_apt_server { + echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.intel.com/Debian/apt-repo `lsb_release -cs` main" | sudo tee /etc/apt/sources.list.d/librealsense.list +} +add_librealsense_apt_server &>> $REDIRECT_LOGFILE +echo "Remove old records in case of upgrading" +sudo rm -f /etc/apt/sources.list.d/realsense-public.list +echo "Apt update" +sudo apt-get --yes update >> $REDIRECT_LOGFILE +echo "Install librealsense2 packages" +install librealsense2 librealsense2-udev-rules librealsense2-utils librealsense2-dev librealsense2-dbg +echo "" + +# echo "###########################################" +# echo "INSTALLATION OF WEB INTERFACE" +# echo "###########################################" +# echo "Register the nodesource APT server's public key" +# function register_nodesource_apt_server { +# curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/nodesource.gpg +# } +# register_nodesource_apt_server &>> $REDIRECT_LOGFILE +# echo "Add the nodesource APT server to the list of APT respositories" +# function add_nodesource_apt_server { +# NODE_MAJOR=21 +# echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg, arch=amd64] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list +# } +# add_nodesource_apt_server &>> $REDIRECT_LOGFILE +# echo "Apt update" +# sudo apt-get --yes update >> $REDIRECT_LOGFILE +# echo "Install NodeJS" +# install nodejs +# echo "Install PyPCL and PyKDL" +# install python3-pcl python3-pykdl screen +# echo "Install PM2" +# sudo npm install -g pm2 &>> $REDIRECT_LOGFILE +# echo "" + +echo "###########################################" +echo "INSTALLATION OF REMOTE DESKTOP" +echo "###########################################" +echo "Install Sunshine Remote Desktop Server" +wget https://github.com/LizardByte/Sunshine/releases/download/v2025.628.4510/sunshine-ubuntu-24.04-amd64.deb -O /tmp/sunshine.deb &>> $REDIRECT_LOGFILE +install /tmp/sunshine.deb +echo "Add Sunshine uinput udev rule" +function add_sunshine_uinput_rule { + echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/85-sunshine.rules +} +add_sunshine_uinput_rule &>> $REDIRECT_LOGFILE +echo "Setup Sunshine apps" +sudo cp ./sunshine_apps.json /usr/share/sunshine/apps.json +echo "Setup Sunshine systemd unit" +mkdir -p ~/.config/systemd/user/ +cp ./sunshine.service ~/.config/systemd/user/sunshine.service + diff --git a/factory/24.04/stretch_ros2_jazzy.repos b/factory/24.04/stretch_ros2_jazzy.repos new file mode 100644 index 0000000..4f0e62d --- /dev/null +++ b/factory/24.04/stretch_ros2_jazzy.repos @@ -0,0 +1,21 @@ +repositories: + ros2_numpy: + type: git + url: https://github.com/Box-Robotics/ros2_numpy + version: jazzy + stretch_ros2: + type: git + url: https://github.com/hello-robot/stretch_ros2.git + version: jazzy + sllidar_ros2: + type: git + url: https://github.com/Slamtec/sllidar_ros2.git + version: 34300099fadfc772965962dec837bf436706188f + respeaker_ros2: + type: git + url: https://github.com/hello-binit/respeaker_ros2.git + version: humble + audio_common: + type: git + url: https://github.com/hello-binit/audio_common.git + version: humble diff --git a/factory/24.04/sunshine.service b/factory/24.04/sunshine.service new file mode 100644 index 0000000..f10fb6e --- /dev/null +++ b/factory/24.04/sunshine.service @@ -0,0 +1,12 @@ +[Unit] +Description=Sunshine self-hosted game stream host for Moonlight. +StartLimitIntervalSec=500 +StartLimitBurst=5 + +[Service] +ExecStart=/usr/bin/sunshine +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=graphical-session.target diff --git a/factory/24.04/sunshine_apps.json b/factory/24.04/sunshine_apps.json new file mode 100644 index 0000000..a5d8244 --- /dev/null +++ b/factory/24.04/sunshine_apps.json @@ -0,0 +1,17 @@ +{ + "env": { + "PATH": "$(PATH):$(HOME)\/.local\/bin" + }, + "apps": [ + { + "name": "Desktop", + "image-path": "desktop.png", + "prep-cmd": [ + { + "do": "sh -c \"REx_xrandr_display.py --set ${SUNSHINE_CLIENT_WIDTH}x${SUNSHINE_CLIENT_HEIGHT}x${SUNSHINE_CLIENT_FPS}\"", + "undo": "sh -c \"REx_xrandr_display.py --revert\"" + } + ] + } + ] +} diff --git a/stretch_new_robot_install.sh b/stretch_new_robot_install.sh index 94699c8..efb01ca 100755 --- a/stretch_new_robot_install.sh +++ b/stretch_new_robot_install.sh @@ -100,7 +100,7 @@ fi source /etc/os-release factory_osdir="$VERSION_ID" -if [[ ! $factory_osdir =~ ^(18.04|20.04|22.04)$ ]]; then +if [[ ! $factory_osdir =~ ^(18.04|20.04|22.04|24.04)$ ]]; then echo "Could not identify OS. Please contact Hello Robot Support." exit 1 fi @@ -177,6 +177,6 @@ zip -r $logzip $logdir/ > /dev/null echo "" echo "#############################################" echo "DONE! INSTALLATION COMPLETED SUCCESSFULLY." -echo "Perform post install steps: https://docs.hello-robot.com/0.2/stretch-install/docs/robot_install/#post-install-steps" +echo "Perform post install steps: https://docs.hello-robot.com/0.3/installation/robot_install/#post-install-steps" echo "#############################################" echo "" diff --git a/stretch_new_user_install.sh b/stretch_new_user_install.sh index 497e2be..ecbabf5 100755 --- a/stretch_new_user_install.sh +++ b/stretch_new_user_install.sh @@ -9,7 +9,7 @@ REDIRECT_LOGFILE="$REDIRECT_LOGDIR/stretch_new_user_install.`date '+%Y%m%d%H%M'` source /etc/os-release factory_osdir="$VERSION_ID" -if [[ ! $factory_osdir =~ ^(18.04|20.04|22.04)$ ]]; then +if [[ ! $factory_osdir =~ ^(18.04|20.04|22.04|24.04)$ ]]; then echo "Could not identify OS. Please contact Hello Robot Support." exit 1 fi @@ -42,6 +42,10 @@ else elif [[ $factory_osdir = "22.04" ]]; then echo "export _colcon_cd_root=${HOME}/ament_ws" >> ~/.bashrc echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc + elif [[ $factory_osdir = "24.04" ]]; then + echo "export PIP_BREAK_SYSTEM_PACKAGES=1" >> ~/.bashrc + echo "export RMW_IMPLEMENTATION=rmw_zenoh_cpp" >> ~/.bashrc + echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc fi fi @@ -88,7 +92,7 @@ echo "Updating media assets..." sudo cp $HOME/stretch_install/factory/$factory_osdir/stretch_about.png /etc/hello-robot echo "Installing Arduino CLI..." -~/stretch_install/factory/$factory_osdir/stretch_install_arduino.sh >> $REDIRECT_LOGFILE +~/stretch_install/factory/$factory_osdir/stretch_install_arduino.sh &>> $REDIRECT_LOGFILE echo "Adding user to the dialout group to access Arduino..." sudo adduser $USER dialout >> $REDIRECT_LOGFILE @@ -142,15 +146,42 @@ elif [[ $factory_osdir = "20.04" || $factory_osdir = "22.04" ]]; then echo "Remove setuptools-scm" python3 -m pip -q uninstall -y setuptools-scm &>> $REDIRECT_LOGFILE echo "" +elif [[ $factory_osdir = "24.04" ]]; then + export PIP_BREAK_SYSTEM_PACKAGES=1 + echo "###########################################" + echo "INSTALLATION OF USER LEVEL PIP3 PACKAGES" + echo "###########################################" + echo "Upgrade pip3" + python3 -m pip -q install --no-warn-script-location --user --upgrade pip &>> $REDIRECT_LOGFILE + echo "Clear pip cache" + python3 -m pip cache purge &>> $REDIRECT_LOGFILE + echo "Install Stretch Body" + python3 -m pip -q install --no-warn-script-location --upgrade hello-robot-stretch-body &>> $REDIRECT_LOGFILE + echo "Install Stretch Body Tools" + python3 -m pip -q install --no-warn-script-location --upgrade hello-robot-stretch-body-tools &>> $REDIRECT_LOGFILE + echo "Install Stretch Factory" + python3 -m pip -q install --no-warn-script-location --upgrade hello-robot-stretch-factory &>> $REDIRECT_LOGFILE + echo "Install Stretch Tool Share" + python3 -m pip -q install --no-warn-script-location --upgrade hello-robot-stretch-tool-share &>> $REDIRECT_LOGFILE + echo "Install Stretch Diagnostics" + python3 -m pip -q install --no-warn-script-location --upgrade hello-robot-stretch-diagnostics &>> $REDIRECT_LOGFILE + echo "Install Stretch URDF" + python3 -m pip -q install --no-warn-script-location --upgrade hello-robot-stretch-urdf &>> $REDIRECT_LOGFILE + echo "Upgrade prompt_toolkit" + python3 -m pip -q install --no-warn-script-location -U prompt_toolkit &>> $REDIRECT_LOGFILE + echo "Remove setuptools-scm" + python3 -m pip -q uninstall -y setuptools-scm &>> $REDIRECT_LOGFILE + echo "" fi +echo "###########################################" +echo "CONFIGURATION OF ROBOT PARAMETERS" +echo "###########################################" +echo "Checking params migrated..." export PATH=${PATH}:~/.local/bin export HELLO_FLEET_ID=$HELLO_FLEET_ID export HELLO_FLEET_PATH=${HOME}/stretch_user - -echo "Ensuring correct version of params present..." params_dir_path=$HELLO_FLEET_PATH/$HELLO_FLEET_ID -echo "Checking params directory path: $params_dir_path" # Define file paths based on the provided directory user_params="$params_dir_path/stretch_re1_user_params.yaml" @@ -163,7 +194,7 @@ if [[ ! -f $new_config_params && ! -f $new_user_params ]]; then # Check if the original RE1 files exist if [[ -f $user_params && -f $factory_params ]]; then echo "Old RE1 params are present. Starting param migration..." - /home/$USER/.local/bin/RE1_migrate_params.py --path $dir_path + /home/$USER/.local/bin/RE1_migrate_params.py # Check if the script ran successfully if [ $? -eq 0 ]; then echo "Migration script ran successfully." @@ -173,7 +204,7 @@ if [[ ! -f $new_config_params && ! -f $new_user_params ]]; then fi echo "Migrating contact params..." - /home/$USER/.local/bin/RE1_migrate_contacts.py --path $dir_path + /home/$USER/.local/bin/RE1_migrate_contacts.py # Check if the script ran successfully if [ $? -eq 0 ]; then echo "Migration script ran successfully." @@ -188,6 +219,7 @@ if [[ ! -f $new_config_params && ! -f $new_user_params ]]; then else echo "Required parameter files are present in the directory. Skipping migration." fi +echo "" if [[ $factory_osdir = "18.04" ]]; then ~/stretch_install/factory/$factory_osdir/stretch_create_catkin_workspace.sh -w "$HOME/catkin_ws" -l $REDIRECT_LOGDIR @@ -195,4 +227,6 @@ elif [[ $factory_osdir = "20.04" ]]; then ~/stretch_install/factory/$factory_osdir/stretch_create_catkin_workspace.sh -w "$HOME/catkin_ws" -l $REDIRECT_LOGDIR elif [[ $factory_osdir = "22.04" ]]; then ~/stretch_install/factory/$factory_osdir/stretch_create_ament_workspace.sh -w "$HOME/ament_ws" -l $REDIRECT_LOGDIR +elif [[ $factory_osdir = "24.04" ]]; then + ~/stretch_install/factory/$factory_osdir/stretch_create_ament_workspace.sh -w "$HOME/ament_ws" -l $REDIRECT_LOGDIR fi diff --git a/stretch_update_ros_workspace.sh b/stretch_update_ros_workspace.sh index 9220c7c..2f08f78 100755 --- a/stretch_update_ros_workspace.sh +++ b/stretch_update_ros_workspace.sh @@ -4,7 +4,7 @@ set -o pipefail sudo sleep 0.1 source /etc/os-release factory_osdir="$VERSION_ID" -if [[ ! $factory_osdir =~ ^(18.04|20.04|22.04)$ ]]; then +if [[ ! $factory_osdir =~ ^(18.04|20.04|22.04|24.04)$ ]]; then echo "Could not identify OS. Please contact Hello Robot Support." exit 1 fi @@ -27,6 +27,8 @@ elif [[ $factory_osdir = "20.04" ]]; then ./stretch_create_catkin_workspace.sh -w "$HOME/catkin_ws" elif [[ $factory_osdir = "22.04" ]]; then ./stretch_create_ament_workspace.sh -w "$HOME/ament_ws" +elif [[ $factory_osdir = "24.04" ]]; then + ./stretch_create_ament_workspace.sh -w "$HOME/ament_ws" fi if [ $? -ne 0 ]; then echo_failure_help