From ce7055252905d831d0a7f9f44dd751ad2b9ab6bc Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Apr 2022 14:00:34 -0700 Subject: [PATCH 01/14] remove xhost +x --- mushr_utils/install/mushr_install.bash | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 3591531..ad0a213 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -134,6 +134,11 @@ if ! grep -Fq "export OS_TYPE=" ~/$SHELL_PROFILE || [[ $BUILD_FROM_SCRATCH=1 ]] echo "export OS_TYPE=${OS_TYPE}" >> ~/$SHELL_PROFILE fi +# Shortcuts +if ! grep -Fq "alias mushr_noetic=" ~/$SHELL_PROFILE ; then + echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run -p 9090:9090 mushr_noetic bash\"" >> ~/$SHELL_PROFILE +fi + # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils if [[ $REAL_ROBOT == 0 ]]; then touch $WS_PATH/catkin_ws/src/mushr/mushr_hardware/push_button_utils/CATKIN_IGNORE @@ -141,22 +146,7 @@ if [[ $REAL_ROBOT == 0 ]]; then touch $WS_PATH/catkin_ws/src/mushr/mushr_hardware/realsense/realsense2_camera/CATKIN_IGNORE fi -# Shortcuts -if ! grep -Fq "alias mushr_noetic=" ~/$SHELL_PROFILE ; then - echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run -p 9090:9090 mushr_noetic bash\"" >> ~/$SHELL_PROFILE -fi - # Make sure all devices are visible if [[ $REAL_ROBOT == 1 ]]; then sudo udevadm control --reload-rules && sudo udevadm trigger fi - -# Display permissions -if ! grep -Fxq "xhost + >> /dev/null" ~/$SHELL_PROFILE ; then - read -p $'Add "xhost +" to $SHELL_PROFILE? This enables GUI from docker but is a security risk.\nIf no, each time you run the docker container you will need to execute this command.\nAdd xhost + $SHELL_PROFILE? (y/n) ' -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - echo WARNING: Adding "xhost +" to $SHELL_PROFILE - echo "xhost + >> /dev/null" >> ~/$SHELL_PROFILE && source ~/$SHELL_PROFILE - fi -fi From 8e2ce8e0acc2d15ab4fd9219d27503b828b8e968 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Apr 2022 14:00:50 -0700 Subject: [PATCH 02/14] remove network:host from compose --- mushr_utils/install/docker-compose-cpu.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/mushr_utils/install/docker-compose-cpu.yml b/mushr_utils/install/docker-compose-cpu.yml index a9cd340..480ac12 100644 --- a/mushr_utils/install/docker-compose-cpu.yml +++ b/mushr_utils/install/docker-compose-cpu.yml @@ -2,7 +2,6 @@ version: "3.4" services: mushr_noetic: image: mushr/mushr:${OS_TYPE} - network_mode: "host" privileged: true devices: - "/dev:/dev" From a540b47bd574a3c074a0c863a73ed9711d870d47 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Apr 2022 15:55:58 -0700 Subject: [PATCH 03/14] mushr_noetic as a script --- mushr_utils/install/mushr_install.bash | 54 +++++++++++--------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index ad0a213..a916fa8 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -49,12 +49,13 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then fi # curl and dep keys -if [[ $OS_TYPE != "Darwin" ]]; then - sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' - sudo apt-get update - sudo apt-get install -y curl - curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - -fi +#if [[ $OS_TYPE != "Darwin" ]]; then + # TODO uncomment + #sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' + #sudo apt-get update + #sudo apt-get install -y curl + #curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - +#fi # Robot specific settings if [[ $REAL_ROBOT == 1 ]]; then @@ -100,11 +101,12 @@ if [[ $REAL_ROBOT == 1 ]]; then fi # vcstool https://github.com/dirk-thomas/vcstool -if [[ $OS_TYPE != "Darwin" ]]; then - sudo apt-get update && sudo apt install -y python3-vcstool -else - sudo pip install vcstool -fi +# TODO uncomment +#if [[ $OS_TYPE != "Darwin" ]]; then + #sudo apt-get update && sudo apt install -y python3-vcstool +#else +# pip install vcstool +#fi # Make catkin_ws outside container for easy editing if [[ ! -d "../../../../../catkin_ws" ]]; then @@ -117,26 +119,16 @@ export WS_PATH=$(pwd | sed 's:/catkin_ws.*::') cd $WS_PATH/catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs import < mushr/nav-repos.yaml cd mushr/mushr_utils/install/ && export INSTALL_PATH=$(pwd) -# Make sure environment Variables are always set -if ! grep -Fq "export INSTALL_PATH=" ~/$SHELL_PROFILE || [[ $BUILD_FROM_SCRATCH ]] ; then - echo "export INSTALL_PATH=${INSTALL_PATH}" >> ~/$SHELL_PROFILE -fi -if ! grep -Fq "export REAL_ROBOT=" ~/$SHELL_PROFILE || [[ $BUILD_FROM_SCRATCH ]] ; then - echo "export REAL_ROBOT=${REAL_ROBOT}" >> ~/$SHELL_PROFILE -fi -if ! grep -Fq "export WS_PATH=" ~/$SHELL_PROFILE || [[ $BUILD_FROM_SCRATCH ]] ; then - echo "export WS_PATH=${WS_PATH}" >> ~/$SHELL_PROFILE -fi -if ! grep -Fq "export COMPOSE_FILE=" ~/$SHELL_PROFILE || [[ $BUILD_FROM_SCRATCH=1 ]] ; then - echo "export COMPOSE_FILE=${COMPOSE_FILE}" >> ~/$SHELL_PROFILE -fi -if ! grep -Fq "export OS_TYPE=" ~/$SHELL_PROFILE || [[ $BUILD_FROM_SCRATCH=1 ]] ; then - echo "export OS_TYPE=${OS_TYPE}" >> ~/$SHELL_PROFILE -fi - -# Shortcuts -if ! grep -Fq "alias mushr_noetic=" ~/$SHELL_PROFILE ; then - echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run -p 9090:9090 mushr_noetic bash\"" >> ~/$SHELL_PROFILE +# Make custom mushr_noetic script +if [[ ! -f "${INSTALL_PATH}/mushr_noetic" ]]; then + touch ${INSTALL_PATH}/mushr_noetic + echo "export INSTALL_PATH=${INSTALL_PATH}" >> ${INSTALL_PATH}/mushr_noetic + echo "export REAL_ROBOT=${REAL_ROBOT}" >> ${INSTALL_PATH}/mushr_noetic + echo "export WS_PATH=${WS_PATH}" >> ${INSTALL_PATH}/mushr_noetic + echo "export COMPOSE_FILE=${COMPOSE_FILE}" >> ${INSTALL_PATH}/mushr_noetic + echo "export OS_TYPE=${OS_TYPE}" >> ${INSTALL_PATH}/mushr_noetic + echo "docker-compose -f \$INSTALL_PATH/\$COMPOSE_FILE run -p 9090:9090 mushr_noetic bash" >> ${INSTALL_PATH}/mushr_noetic + chmod +x ${INSTALL_PATH}/mushr_noetic fi # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils From 7e075ab4caf9c7368dcbd8ed5762fac5fc80695b Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Apr 2022 16:04:42 -0700 Subject: [PATCH 04/14] MUSHR prefix and delete old stuff --- mushr_utils/install/Dockerfile | 1 - mushr_utils/install/docker-compose-build.yml | 10 +-- mushr_utils/install/docker-compose-cpu.yml | 4 +- mushr_utils/install/docker-compose-gpu.yml | 5 +- mushr_utils/install/mushr_install.bash | 68 ++++++++++---------- 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/mushr_utils/install/Dockerfile b/mushr_utils/install/Dockerfile index 8fbd9fb..b8b867f 100644 --- a/mushr_utils/install/Dockerfile +++ b/mushr_utils/install/Dockerfile @@ -13,7 +13,6 @@ RUN apt-get update -y \ RUN mkdir install_scripts # ROS Noetic -#ADD $INSTALL_PATH/install_scripts/mushr_install_ros.bash install_scripts/mushr_install_ros.bash ADD src/mushr/mushr_utils/install/install_scripts/mushr_install_ros.bash install_scripts/mushr_install_ros.bash RUN chmod +x install_scripts/mushr_install_ros.bash && install_scripts/mushr_install_ros.bash diff --git a/mushr_utils/install/docker-compose-build.yml b/mushr_utils/install/docker-compose-build.yml index 9aae4da..ab57d91 100644 --- a/mushr_utils/install/docker-compose-build.yml +++ b/mushr_utils/install/docker-compose-build.yml @@ -1,13 +1,13 @@ version: "3.4" services: mushr_noetic: - image: mushr/mushr:${OS_TYPE} + image: mushr/mushr:${MUSHR_OS_TYPE} build: - context: ${WS_PATH}/catkin_ws - dockerfile: ${INSTALL_PATH}/Dockerfile + context: ${MUSHR_WS_PATH}/catkin_ws + dockerfile: ${MUSHR_INSTALL_PATH}/Dockerfile args: REAL: ${REAL_ROBOT} - WS_PATH: ${WS_PATH} + MUSHR_WS_PATH: ${MUSHR_WS_PATH} network_mode: "host" privileged: true devices: @@ -28,7 +28,7 @@ services: - /tmp/.X11-unix:/tmp/.X11-unix - /dev:/dev - /dev/input:/dev/input - - ${WS_PATH}/catkin_ws:/root/catkin_ws # Runtime attach + - ${MUSHR_WS_PATH}/catkin_ws:/root/catkin_ws # Runtime attach environment: - DISPLAY=${DISPLAY} - QT_X11_NO_MITSHM=1 diff --git a/mushr_utils/install/docker-compose-cpu.yml b/mushr_utils/install/docker-compose-cpu.yml index 480ac12..988031a 100644 --- a/mushr_utils/install/docker-compose-cpu.yml +++ b/mushr_utils/install/docker-compose-cpu.yml @@ -1,7 +1,7 @@ version: "3.4" services: mushr_noetic: - image: mushr/mushr:${OS_TYPE} + image: mushr/mushr:${MUSHR_OS_TYPE} privileged: true devices: - "/dev:/dev" @@ -12,7 +12,7 @@ services: - /tmp/.X11-unix:/tmp/.X11-unix - /dev:/dev - /dev/input:/dev/input - - ${WS_PATH}/catkin_ws:/root/catkin_ws # Runtime attach + - ${MUSHR_WS_PATH}/catkin_ws:/root/catkin_ws # Runtime attach environment: - DISPLAY=${DISPLAY} - QT_X11_NO_MITSHM=1 diff --git a/mushr_utils/install/docker-compose-gpu.yml b/mushr_utils/install/docker-compose-gpu.yml index 53d26b6..d1461b6 100644 --- a/mushr_utils/install/docker-compose-gpu.yml +++ b/mushr_utils/install/docker-compose-gpu.yml @@ -1,8 +1,7 @@ version: "3.4" services: mushr_noetic: - image: mushr/mushr:${OS_TYPE} - network_mode: "host" + image: mushr/mushr:${MUSHR_OS_TYPE} privileged: true devices: - "/dev:/dev" @@ -22,7 +21,7 @@ services: - /tmp/.X11-unix:/tmp/.X11-unix - /dev:/dev - /dev/input:/dev/input - - ${WS_PATH}/catkin_ws:/root/catkin_ws # Runtime attach + - ${MUSHR_WS_PATH}/catkin_ws:/root/catkin_ws # Runtime attach environment: - DISPLAY=${DISPLAY} - QT_X11_NO_MITSHM=1 diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index a916fa8..023e656 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -1,42 +1,40 @@ #!/bin/bash # Detect OS -export OS_TYPE="$(uname -s)" -if [[ $OS_TYPE == "Darwin" ]]; then - export SHELL_PROFILE=".zshrc" -else - export OS_TYPE="$(uname -i)" - export SHELL_PROFILE=".bashrc" +export MUSHR_OS_TYPE="$(uname -s)" +if [[ $MUSHR_OS_TYPE == "Linux" ]]; then + export MUSHR_OS_TYPE="$(uname -i)" fi + # Are we in the right place to be running this? if [[ ! -f mushr_install.bash ]]; then echo Wrong directory! Change directory to the one containing mushr_install.bash exit 1 fi -export INSTALL_PATH=$(pwd) +export MUSHR_INSTALL_PATH=$(pwd) # Real robot or on a laptop? read -p "Are you installing on robot and need all the sensor drivers? (y/n) " -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then - export REAL_ROBOT=1 - export OS_TYPE=robot + export MUSHR_REAL_ROBOT=1 + export MUSHR_OS_TYPE=robot else - export REAL_ROBOT=0 + export MUSHR_REAL_ROBOT=0 fi # NVIDIA GPU? read -p "Do you have a nvidia gpu with installed drivers? (y/n) " -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then - if [[ $REAL_ROBOT == 1 ]]; then - export COMPOSE_FILE=docker-compose-robot.yml + if [[ $MUSHR_REAL_ROBOT == 1 ]]; then + export MUSHR_COMPOSE_FILE=docker-compose-robot.yml else - export COMPOSE_FILE=docker-compose-gpu.yml + export MUSHR_COMPOSE_FILE=docker-compose-gpu.yml fi else - export COMPOSE_FILE=docker-compose-cpu.yml + export MUSHR_COMPOSE_FILE=docker-compose-cpu.yml fi # Build from scratch (assumes GPU)? @@ -45,11 +43,11 @@ echo export BUILD_FROM_SCRATCH=0 if [[ $REPLY =~ ^[Yy]$ ]]; then export BUILD_FROM_SCRATCH=1 - export COMPOSE_FILE=docker-compose-build.yml + export MUSHR_COMPOSE_FILE=docker-compose-build.yml fi # curl and dep keys -#if [[ $OS_TYPE != "Darwin" ]]; then +#if [[ $MUSHR_OS_TYPE != "Darwin" ]]; then # TODO uncomment #sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' #sudo apt-get update @@ -58,7 +56,7 @@ fi #fi # Robot specific settings -if [[ $REAL_ROBOT == 1 ]]; then +if [[ $MUSHR_REAL_ROBOT == 1 ]]; then echo Running robot specific commands # Don't need sudo for docker @@ -102,7 +100,7 @@ fi # vcstool https://github.com/dirk-thomas/vcstool # TODO uncomment -#if [[ $OS_TYPE != "Darwin" ]]; then +#if [[ $MUSHR_OS_TYPE != "Darwin" ]]; then #sudo apt-get update && sudo apt install -y python3-vcstool #else # pip install vcstool @@ -115,30 +113,30 @@ if [[ ! -d "../../../../../catkin_ws" ]]; then fi # Pull repos -export WS_PATH=$(pwd | sed 's:/catkin_ws.*::') -cd $WS_PATH/catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs import < mushr/nav-repos.yaml -cd mushr/mushr_utils/install/ && export INSTALL_PATH=$(pwd) +export MUSHR_WS_PATH=$(pwd | sed 's:/catkin_ws.*::') +cd $MUSHR_WS_PATH/catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs import < mushr/nav-repos.yaml +cd mushr/mushr_utils/install/ && export MUSHR_INSTALL_PATH=$(pwd) # Make custom mushr_noetic script -if [[ ! -f "${INSTALL_PATH}/mushr_noetic" ]]; then - touch ${INSTALL_PATH}/mushr_noetic - echo "export INSTALL_PATH=${INSTALL_PATH}" >> ${INSTALL_PATH}/mushr_noetic - echo "export REAL_ROBOT=${REAL_ROBOT}" >> ${INSTALL_PATH}/mushr_noetic - echo "export WS_PATH=${WS_PATH}" >> ${INSTALL_PATH}/mushr_noetic - echo "export COMPOSE_FILE=${COMPOSE_FILE}" >> ${INSTALL_PATH}/mushr_noetic - echo "export OS_TYPE=${OS_TYPE}" >> ${INSTALL_PATH}/mushr_noetic - echo "docker-compose -f \$INSTALL_PATH/\$COMPOSE_FILE run -p 9090:9090 mushr_noetic bash" >> ${INSTALL_PATH}/mushr_noetic - chmod +x ${INSTALL_PATH}/mushr_noetic +if [[ ! -f "${MUSHR_INSTALL_PATH}/mushr_noetic" ]]; then + touch ${MUSHR_INSTALL_PATH}/mushr_noetic + echo "export MUSHR_INSTALL_PATH=${MUSHR_INSTALL_PATH}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic + echo "export MUSHR_REAL_ROBOT=${MUSHR_REAL_ROBOT}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic + echo "export MUSHR_WS_PATH=${MUSHR_WS_PATH}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic + echo "export MUSHR_COMPOSE_FILE=${MUSHR_COMPOSE_FILE}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic + echo "export MUSHR_OS_TYPE=${MUSHR_OS_TYPE}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic + echo "docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash" >> ${MUSHR_INSTALL_PATH}/mushr_noetic + chmod +x ${MUSHR_INSTALL_PATH}/mushr_noetic fi # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils -if [[ $REAL_ROBOT == 0 ]]; then - touch $WS_PATH/catkin_ws/src/mushr/mushr_hardware/push_button_utils/CATKIN_IGNORE - touch $WS_PATH/catkin_ws/src/mushr/mushr_hardware/ydlidar/CATKIN_IGNORE - touch $WS_PATH/catkin_ws/src/mushr/mushr_hardware/realsense/realsense2_camera/CATKIN_IGNORE +if [[ $MUSHR_REAL_ROBOT == 0 ]]; then + touch $MUSHR_WS_PATH/catkin_ws/src/mushr/mushr_hardware/push_button_utils/CATKIN_IGNORE + touch $MUSHR_WS_PATH/catkin_ws/src/mushr/mushr_hardware/ydlidar/CATKIN_IGNORE + touch $MUSHR_WS_PATH/catkin_ws/src/mushr/mushr_hardware/realsense/realsense2_camera/CATKIN_IGNORE fi # Make sure all devices are visible -if [[ $REAL_ROBOT == 1 ]]; then +if [[ $MUSHR_REAL_ROBOT == 1 ]]; then sudo udevadm control --reload-rules && sudo udevadm trigger fi From 928fbbb1eddab351a731a22a6c4e8c5c121ce362 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Apr 2022 16:08:33 -0700 Subject: [PATCH 05/14] pushd/popd --- mushr_utils/install/mushr_install.bash | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 023e656..892d0b7 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -1,4 +1,5 @@ #!/bin/bash +pushd `dirname $0` # Detect OS export MUSHR_OS_TYPE="$(uname -s)" @@ -140,3 +141,4 @@ fi if [[ $MUSHR_REAL_ROBOT == 1 ]]; then sudo udevadm control --reload-rules && sudo udevadm trigger fi +popd From d23e0bb18c70cbf8583e8f5b69535a5a98e4ee29 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Apr 2022 16:11:19 -0700 Subject: [PATCH 06/14] remove making the catkin_ws for them --- mushr_utils/install/mushr_install.bash | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 892d0b7..648838f 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -7,7 +7,6 @@ if [[ $MUSHR_OS_TYPE == "Linux" ]]; then export MUSHR_OS_TYPE="$(uname -i)" fi - # Are we in the right place to be running this? if [[ ! -f mushr_install.bash ]]; then echo Wrong directory! Change directory to the one containing mushr_install.bash @@ -107,12 +106,6 @@ fi # pip install vcstool #fi -# Make catkin_ws outside container for easy editing -if [[ ! -d "../../../../../catkin_ws" ]]; then - mkdir -p ../../../catkin_ws/src - cd ../../../ && mv mushr catkin_ws/src/mushr -fi - # Pull repos export MUSHR_WS_PATH=$(pwd | sed 's:/catkin_ws.*::') cd $MUSHR_WS_PATH/catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs import < mushr/nav-repos.yaml From f2ff0279f71e40ad9f2241fb850f02a73ecb78c3 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 25 Apr 2022 16:33:07 -0700 Subject: [PATCH 07/14] move mushr_noetic to /usr/local/bin --- mushr_utils/install/mushr_install.bash | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 648838f..4d00c81 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -47,13 +47,12 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then fi # curl and dep keys -#if [[ $MUSHR_OS_TYPE != "Darwin" ]]; then - # TODO uncomment - #sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' - #sudo apt-get update - #sudo apt-get install -y curl - #curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - -#fi +if [[ $MUSHR_OS_TYPE != "Darwin" ]]; then + sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' + sudo apt-get update + sudo apt-get install -y curl + curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - +fi # Robot specific settings if [[ $MUSHR_REAL_ROBOT == 1 ]]; then @@ -99,12 +98,11 @@ if [[ $MUSHR_REAL_ROBOT == 1 ]]; then fi # vcstool https://github.com/dirk-thomas/vcstool -# TODO uncomment -#if [[ $MUSHR_OS_TYPE != "Darwin" ]]; then - #sudo apt-get update && sudo apt install -y python3-vcstool -#else -# pip install vcstool -#fi +if [[ $MUSHR_OS_TYPE != "Darwin" ]]; then + sudo apt-get update && sudo apt install -y python3-vcstool +else + pip install vcstool +fi # Pull repos export MUSHR_WS_PATH=$(pwd | sed 's:/catkin_ws.*::') @@ -121,6 +119,7 @@ if [[ ! -f "${MUSHR_INSTALL_PATH}/mushr_noetic" ]]; then echo "export MUSHR_OS_TYPE=${MUSHR_OS_TYPE}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic echo "docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash" >> ${MUSHR_INSTALL_PATH}/mushr_noetic chmod +x ${MUSHR_INSTALL_PATH}/mushr_noetic + sudo mv ${MUSHR_INSTALL_PATH}/mushr_noetic /usr/local/bin/ fi # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils From 08a396a80d875d4484d241912d8b43f64a4750c2 Mon Sep 17 00:00:00 2001 From: Matt Schmittle Date: Thu, 28 Apr 2022 14:09:31 -0700 Subject: [PATCH 08/14] Update mushr_utils/install/mushr_install.bash Co-authored-by: Brian Hou --- mushr_utils/install/mushr_install.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 4d00c81..ec134d7 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -124,9 +124,9 @@ fi # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils if [[ $MUSHR_REAL_ROBOT == 0 ]]; then - touch $MUSHR_WS_PATH/catkin_ws/src/mushr/mushr_hardware/push_button_utils/CATKIN_IGNORE - touch $MUSHR_WS_PATH/catkin_ws/src/mushr/mushr_hardware/ydlidar/CATKIN_IGNORE - touch $MUSHR_WS_PATH/catkin_ws/src/mushr/mushr_hardware/realsense/realsense2_camera/CATKIN_IGNORE + for ignored_package in push_button_utils ydlidar realsense/realsense2_camera; do + touch $MUSHR_WS_PATH/catkin_ws/src/mushr/mushr_hardware/${ignored_package}/CATKIN_IGNORE + done fi # Make sure all devices are visible From 905d66ebeacec45f968a6c7457567012b6949109 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 28 Apr 2022 14:16:18 -0700 Subject: [PATCH 09/14] small tweaks from feedback --- mushr_utils/install/mushr_install.bash | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 4d00c81..2c7cecb 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -47,7 +47,7 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then fi # curl and dep keys -if [[ $MUSHR_OS_TYPE != "Darwin" ]]; then +if [[ $MUSHR_OS_TYPE == "Linux" ]]; then sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo apt-get update sudo apt-get install -y curl @@ -105,9 +105,8 @@ else fi # Pull repos -export MUSHR_WS_PATH=$(pwd | sed 's:/catkin_ws.*::') +export MUSHR_WS_PATH=$(echo $MUSHR_INSTALL_PATH | sed 's:/catkin_ws.*::') cd $MUSHR_WS_PATH/catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs import < mushr/nav-repos.yaml -cd mushr/mushr_utils/install/ && export MUSHR_INSTALL_PATH=$(pwd) # Make custom mushr_noetic script if [[ ! -f "${MUSHR_INSTALL_PATH}/mushr_noetic" ]]; then @@ -119,7 +118,7 @@ if [[ ! -f "${MUSHR_INSTALL_PATH}/mushr_noetic" ]]; then echo "export MUSHR_OS_TYPE=${MUSHR_OS_TYPE}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic echo "docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash" >> ${MUSHR_INSTALL_PATH}/mushr_noetic chmod +x ${MUSHR_INSTALL_PATH}/mushr_noetic - sudo mv ${MUSHR_INSTALL_PATH}/mushr_noetic /usr/local/bin/ + sudo ln -s ${MUSHR_INSTALL_PATH}/mushr_noetic /usr/local/bin/ fi # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils From a26bfc1f70be22703cd6dba1a2f18a3f79c10783 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 28 Apr 2022 14:39:19 -0700 Subject: [PATCH 10/14] heredoc --- mushr_utils/install/mushr_install.bash | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 2e0af61..8e0feef 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -110,15 +110,16 @@ cd $MUSHR_WS_PATH/catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs im # Make custom mushr_noetic script if [[ ! -f "${MUSHR_INSTALL_PATH}/mushr_noetic" ]]; then - touch ${MUSHR_INSTALL_PATH}/mushr_noetic - echo "export MUSHR_INSTALL_PATH=${MUSHR_INSTALL_PATH}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic - echo "export MUSHR_REAL_ROBOT=${MUSHR_REAL_ROBOT}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic - echo "export MUSHR_WS_PATH=${MUSHR_WS_PATH}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic - echo "export MUSHR_COMPOSE_FILE=${MUSHR_COMPOSE_FILE}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic - echo "export MUSHR_OS_TYPE=${MUSHR_OS_TYPE}" >> ${MUSHR_INSTALL_PATH}/mushr_noetic - echo "docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash" >> ${MUSHR_INSTALL_PATH}/mushr_noetic - chmod +x ${MUSHR_INSTALL_PATH}/mushr_noetic - sudo ln -s ${MUSHR_INSTALL_PATH}/mushr_noetic /usr/local/bin/ + cat <<- EOF > ${MUSHR_INSTALL_PATH}/mushr_noetic + export MUSHR_INSTALL_PATH=${MUSHR_INSTALL_PATH} + export MUSHR_REAL_ROBOT=${MUSHR_REAL_ROBOT} + export MUSHR_WS_PATH=${MUSHR_WS_PATH} + export MUSHR_COMPOSE_FILE=${MUSHR_COMPOSE_FILE} + export MUSHR_OS_TYPE=${MUSHR_OS_TYPE} + docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash + EOF + chmod +x ${MUSHR_INSTALL_PATH}/mushr_noetic + sudo ln -s ${MUSHR_INSTALL_PATH}/mushr_noetic /usr/local/bin/ fi # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils From 48353e3f0963e52b8676ae108d9c6c721fe7e32c Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 28 Apr 2022 14:40:09 -0700 Subject: [PATCH 11/14] remove gpu compose --- mushr_utils/install/docker-compose-gpu.yml | 29 ---------------------- mushr_utils/install/mushr_install.bash | 15 +---------- 2 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 mushr_utils/install/docker-compose-gpu.yml diff --git a/mushr_utils/install/docker-compose-gpu.yml b/mushr_utils/install/docker-compose-gpu.yml deleted file mode 100644 index d1461b6..0000000 --- a/mushr_utils/install/docker-compose-gpu.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: "3.4" -services: - mushr_noetic: - image: mushr/mushr:${MUSHR_OS_TYPE} - privileged: true - devices: - - "/dev:/dev" - - "/dev/ydlidar:/dev/ydlidar" - - "/dev/vesc:/dev/vesc" - - "/dev/input/js0:/dev/input/js0" - deploy: - resources: - reservations: - devices: - - driver: nvidia - capabilities: [gpu] - volumes: - - /usr/bin/tegrastats:/usr/bin/tegrastats - - /etc/udev:/etc/udev - - /sys/class/gpio:/sys/class/gpio - - /tmp/.X11-unix:/tmp/.X11-unix - - /dev:/dev - - /dev/input:/dev/input - - ${MUSHR_WS_PATH}/catkin_ws:/root/catkin_ws # Runtime attach - environment: - - DISPLAY=${DISPLAY} - - QT_X11_NO_MITSHM=1 - - NEVIAID_DRIVER_CAPABILITIES=all - - NVIDIA_VISIBLE_DEVICES=all diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 8e0feef..ae0e429 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -24,20 +24,7 @@ else export MUSHR_REAL_ROBOT=0 fi -# NVIDIA GPU? -read -p "Do you have a nvidia gpu with installed drivers? (y/n) " -r -echo -if [[ $REPLY =~ ^[Yy]$ ]]; then - if [[ $MUSHR_REAL_ROBOT == 1 ]]; then - export MUSHR_COMPOSE_FILE=docker-compose-robot.yml - else - export MUSHR_COMPOSE_FILE=docker-compose-gpu.yml - fi -else - export MUSHR_COMPOSE_FILE=docker-compose-cpu.yml -fi - -# Build from scratch (assumes GPU)? +# Build from scratch read -p "Build from scratch? (Not recommended, takes much longer than pulling ready-made image) (y/n) " -r echo export BUILD_FROM_SCRATCH=0 From b4ce7acf5a2b23a54d32f00e4e121b1a2b29134e Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 28 Apr 2022 14:41:08 -0700 Subject: [PATCH 12/14] add sbpl install --- mushr_utils/install/install_scripts/mushr_install_deps.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index 2cccd24..020a1b4 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -10,7 +10,7 @@ apt-get update apt-get install -y python3-vcstool python3-pip # Install extra ROS packages -apt-get install -y ros-noetic-ackermann-msgs ros-noetic-map-server ros-noetic-urg-node ros-noetic-robot-state-publisher ros-noetic-xacro ros-noetic-joy ros-noetic-ddynamic-reconfigure ros-noetic-fake-localization ros-noetic-gmapping ros-noetic-rosbridge-suite +apt-get install -y ros-noetic-ackermann-msgs ros-noetic-map-server ros-noetic-urg-node ros-noetic-robot-state-publisher ros-noetic-xacro ros-noetic-joy ros-noetic-ddynamic-reconfigure ros-noetic-fake-localization ros-noetic-gmapping ros-noetic-rosbridge-suite ros-noetic-sbpl # Install catkin tools wget http://packages.ros.org/ros.key -O - | apt-key add - From 59150b1f770e9329c4238901c87cbf3f92a44a88 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 28 Apr 2022 17:51:56 -0700 Subject: [PATCH 13/14] interface on laptop set to eth0 --- mushr_utils/install/install_scripts/mushr_install_deps.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index 020a1b4..69882fa 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -37,4 +37,8 @@ mkdir ~/.rviz cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ # Set ROS_IP -echo "export ROS_IP=\$(ifconfig wlan0 | grep 'inet ' | awk '{print \$2}')" >> ~/.bashrc +if [[ $MUSHR_REAL_ROBOT == 1 ]]; then + echo "export ROS_IP=\$(ifconfig wlan0 | grep 'inet ' | awk '{print \$2}')" >> ~/.bashrc +else + echo "export ROS_IP=\$(ifconfig eth0 | grep 'inet ' | awk '{print \$2}')" >> ~/.bashrc +fi From 9e8627787d6089ab8a082b79f26aa86be62d9a25 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Tue, 31 May 2022 12:19:02 -0700 Subject: [PATCH 14/14] robot --> aarch64 docker image --- mushr_utils/install/docker-compose-build.yml | 2 +- mushr_utils/install/docker-compose-robot.yml | 2 +- mushr_utils/install/mushr_install.bash | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mushr_utils/install/docker-compose-build.yml b/mushr_utils/install/docker-compose-build.yml index ab57d91..eb22c6f 100644 --- a/mushr_utils/install/docker-compose-build.yml +++ b/mushr_utils/install/docker-compose-build.yml @@ -1,7 +1,7 @@ version: "3.4" services: mushr_noetic: - image: mushr/mushr:${MUSHR_OS_TYPE} + #image: mushr/mushr:${MUSHR_OS_TYPE} build: context: ${MUSHR_WS_PATH}/catkin_ws dockerfile: ${MUSHR_INSTALL_PATH}/Dockerfile diff --git a/mushr_utils/install/docker-compose-robot.yml b/mushr_utils/install/docker-compose-robot.yml index 6792747..492b455 100644 --- a/mushr_utils/install/docker-compose-robot.yml +++ b/mushr_utils/install/docker-compose-robot.yml @@ -1,7 +1,7 @@ version: "3.4" services: mushr_noetic: - image: mushr/mushr:robot + image: mushr/mushr:${MUSHR_OS_TYPE} network_mode: "host" privileged: true devices: diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index ae0e429..4e1c2d0 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -3,9 +3,6 @@ pushd `dirname $0` # Detect OS export MUSHR_OS_TYPE="$(uname -s)" -if [[ $MUSHR_OS_TYPE == "Linux" ]]; then - export MUSHR_OS_TYPE="$(uname -i)" -fi # Are we in the right place to be running this? if [[ ! -f mushr_install.bash ]]; then @@ -19,7 +16,6 @@ read -p "Are you installing on robot and need all the sensor drivers? (y/n) " -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then export MUSHR_REAL_ROBOT=1 - export MUSHR_OS_TYPE=robot else export MUSHR_REAL_ROBOT=0 fi @@ -39,6 +35,9 @@ if [[ $MUSHR_OS_TYPE == "Linux" ]]; then sudo apt-get update sudo apt-get install -y curl curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - + + # Reset to specific hardware + export MUSHR_OS_TYPE="$(uname -i)" fi # Robot specific settings