From 4d5467264f344734f93beae6026a333d958e1e71 Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Thu, 25 Mar 2021 14:18:09 -0700 Subject: [PATCH 01/61] Silence build warnings in Noetic Drop xacro arg that became default to silence a warning Bump CMake version to avoid a warning --- mushr_description/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mushr_description/CMakeLists.txt b/mushr_description/CMakeLists.txt index 337339c..2c4ee3c 100644 --- a/mushr_description/CMakeLists.txt +++ b/mushr_description/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.0.2) project(mushr_description) find_package(catkin REQUIRED) @@ -20,7 +20,7 @@ function(build_xacro infile outfile xacro_args) # Process xacro into final output add_custom_command(OUTPUT "${outfile}" COMMENT "Generating ${outfile}" - COMMAND ${CATKIN_ENV} rosrun xacro xacro --inorder + COMMAND ${CATKIN_ENV} rosrun xacro xacro -o "${outfile}" "${infile}" ${_xacro_deps_result} ${xacro_args} DEPENDS "${infile}" ${_xacro_deps_result} VERBATIM) From f767360759e06f4fe141a60ca979b191d5e7c032 Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Thu, 1 Apr 2021 22:19:11 -0700 Subject: [PATCH 02/61] Fix broken install directives Neither meshes nor xacro sources were being put into the installed robots directory. Looks like typos --- mushr_description/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mushr_description/CMakeLists.txt b/mushr_description/CMakeLists.txt index 2c4ee3c..32acf5e 100644 --- a/mushr_description/CMakeLists.txt +++ b/mushr_description/CMakeLists.txt @@ -128,9 +128,10 @@ add_custom_target(link_mushr_nano_purple_gold ALL add_custom_target(link_mushr_nano_green_black ALL COMMAND ${CMAKE_COMMAND} -E create_symlink ${MUSHR_NANO_GREEN_BLACK_URDF} ${MUSHR_NANO_GREEN_BLACK_LINK}) -install(DIRECTORY DESTINATION "${CATKIN_PACKAGE_SHARE_DESTINATION}/robots") +install(DIRECTORY robots DESTINATION "${CATKIN_PACKAGE_SHARE_DESTINATION}") + install(FILES - ${DESCRIPTION_FILES} + ${CORE_DESCRIPTION_FILES} DESTINATION "${CATKIN_PACKAGE_SHARE_DESTINATION}/robots") install(DIRECTORY meshes From 99c8ab8d526079e708fe1f498bc70f43835c7a20 Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Thu, 1 Apr 2021 23:11:10 -0700 Subject: [PATCH 03/61] Fix main car symlink in install space Pretty gross, so will eventually need to refactor to avoid repeating same command and increasing surface area for copy paste bugs --- mushr_description/CMakeLists.txt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mushr_description/CMakeLists.txt b/mushr_description/CMakeLists.txt index 32acf5e..74fbfff 100644 --- a/mushr_description/CMakeLists.txt +++ b/mushr_description/CMakeLists.txt @@ -54,9 +54,11 @@ set(MUSHR_TX2_GREEN_BLACK_URDF "${ROBOTS_OUTPUT_DIR}/mushr_tx2_green_black.urdf" set(MUSHR_TX2_GREEN_BLACK_LINK "${ROBOTS_OUTPUT_DIR}/racecar-uw-tx2-green-black.urdf") set(MUSHR_TX2_GREEN_BLACK_ARGS "platform_color:=green" "inset_color:=black") -set(MUSHR_NANO_URDF_XACRO "${ROBOTS_SRC_DIR}/mushr_nano.urdf.xacro") -set(MUSHR_NANO_URDF "${ROBOTS_OUTPUT_DIR}/mushr_nano.urdf") -set(MUSHR_NANO_LINK "${ROBOTS_OUTPUT_DIR}/racecar-uw-nano.urdf") +set(MUSHR_NANO_BASE "mushr_nano.urdf") +set(MUSHR_NANO_LINK "racecar-uw-nano.urdf") +set(MUSHR_NANO_URDF_XACRO "${ROBOTS_SRC_DIR}/${MUSHR_NANO_BASE}.xacro") +set(MUSHR_NANO_URDF "${ROBOTS_OUTPUT_DIR}/${MUSHR_NANO_BASE}") +set(MUSHR_NANO_LINK_DEVEL "${ROBOTS_OUTPUT_DIR}/${MUSHR_NANO_LINK}") set(MUSHR_NANO_RED_WHITE_URDF_XACRO "${ROBOTS_SRC_DIR}/mushr_nano.urdf.xacro") set(MUSHR_NANO_RED_WHITE_URDF "${ROBOTS_OUTPUT_DIR}/mushr_nano_red_white.urdf") @@ -118,7 +120,7 @@ add_custom_target(link_mushr_tx2 ALL add_custom_target(link_mushr_tx2_green_black ALL COMMAND ${CMAKE_COMMAND} -E create_symlink ${MUSHR_TX2_GREEN_BLACK_URDF} ${MUSHR_TX2_GREEN_BLACK_LINK}) add_custom_target(link_mushr_nano ALL - COMMAND ${CMAKE_COMMAND} -E create_symlink ${MUSHR_NANO_URDF} ${MUSHR_NANO_LINK}) + COMMAND ${CMAKE_COMMAND} -E create_symlink ${MUSHR_NANO_URDF} ${MUSHR_NANO_LINK_DEVEL}) add_custom_target(link_mushr_nano_red_white ALL COMMAND ${CMAKE_COMMAND} -E create_symlink ${MUSHR_NANO_RED_WHITE_URDF} ${MUSHR_NANO_RED_WHITE_LINK}) add_custom_target(link_mushr_nano_teal_purple ALL @@ -134,6 +136,13 @@ install(FILES ${CORE_DESCRIPTION_FILES} DESTINATION "${CATKIN_PACKAGE_SHARE_DESTINATION}/robots") +install(CODE "execute_process( \ + COMMAND ${CMAKE_COMMAND} -E create_symlink \ + ${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/robots/${MUSHR_NANO_BASE} \ + ${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}/robots/${MUSHR_NANO_LINK} \ + )" +) + install(DIRECTORY meshes DESTINATION "${CATKIN_PACKAGE_SHARE_DESTINATION}") From 3047d3b6bdc5c0910f8febff7e3c4bf762a2cf39 Mon Sep 17 00:00:00 2001 From: Matt Schmittle Date: Sat, 4 Dec 2021 18:21:14 -0800 Subject: [PATCH 04/61] Removed timed roslaunch --- .../mushr_hardware/launch/racecar-uw-nano/sensors.launch | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mushr_hardware/mushr_hardware/launch/racecar-uw-nano/sensors.launch b/mushr_hardware/mushr_hardware/launch/racecar-uw-nano/sensors.launch index a4252df..791c127 100644 --- a/mushr_hardware/mushr_hardware/launch/racecar-uw-nano/sensors.launch +++ b/mushr_hardware/mushr_hardware/launch/racecar-uw-nano/sensors.launch @@ -8,10 +8,11 @@ - - + + + + + From 4a485086b4c4e342d82444639e7defadb227a461 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Sun, 12 Dec 2021 15:11:11 -0800 Subject: [PATCH 05/61] update package.xml --- mushr_hardware/mushr_hardware/package.xml | 40 ----------------------- 1 file changed, 40 deletions(-) diff --git a/mushr_hardware/mushr_hardware/package.xml b/mushr_hardware/mushr_hardware/package.xml index a637eb9..6f85d9f 100644 --- a/mushr_hardware/mushr_hardware/package.xml +++ b/mushr_hardware/mushr_hardware/package.xml @@ -14,49 +14,9 @@ TODO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - catkin realsense2_camera ydlidar push_button_utils - - - - - - From a0e3af3fe926c97017d3aa5411ceea6238871311 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Sun, 12 Dec 2021 15:21:31 -0800 Subject: [PATCH 06/61] add noetic install scripts --- mushr_utils/install/Dockerfile | 34 +++++++++ mushr_utils/install/docker-compose.yml | 36 ++++++++++ .../install_scripts/mushr_install_deps.bash | 38 ++++++++++ .../mushr_install_hw_drivers.bash | 38 ++++++++++ .../install_scripts/mushr_install_ros.bash | 28 ++++++++ .../install_scripts/mushr_install_stack.bash | 22 ++++++ mushr_utils/install/mushr_install.bash | 49 +++++++++++++ mushr_utils/install_scripts/mushr_install.sh | 30 -------- .../mushr_install_hw_drivers.sh | 69 ------------------- .../install_scripts/mushr_install_ros.sh | 28 -------- .../install_scripts/mushr_install_stack.sh | 67 ------------------ .../mushr_install_vesc_tool.sh | 16 ----- repos.yaml | 12 ++-- 13 files changed, 249 insertions(+), 218 deletions(-) create mode 100644 mushr_utils/install/Dockerfile create mode 100644 mushr_utils/install/docker-compose.yml create mode 100644 mushr_utils/install/install_scripts/mushr_install_deps.bash create mode 100644 mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash create mode 100644 mushr_utils/install/install_scripts/mushr_install_ros.bash create mode 100644 mushr_utils/install/install_scripts/mushr_install_stack.bash create mode 100644 mushr_utils/install/mushr_install.bash delete mode 100644 mushr_utils/install_scripts/mushr_install.sh delete mode 100644 mushr_utils/install_scripts/mushr_install_hw_drivers.sh delete mode 100644 mushr_utils/install_scripts/mushr_install_ros.sh delete mode 100644 mushr_utils/install_scripts/mushr_install_stack.sh delete mode 100644 mushr_utils/install_scripts/mushr_install_vesc_tool.sh diff --git a/mushr_utils/install/Dockerfile b/mushr_utils/install/Dockerfile new file mode 100644 index 0000000..95b3443 --- /dev/null +++ b/mushr_utils/install/Dockerfile @@ -0,0 +1,34 @@ +FROM timongentzsch/l4t-ubuntu20-pytorch:latest + +MAINTAINER Matt Schmittle + +# Install docker deps for mushr_install +RUN apt-get update -y \ + && DEBIAN_FRONTEND=noninteractive apt-get install keyboard-configuration apt-utils gnupg2 curl -y \ + && apt-get update -y + +# Adding/Running files separately allows us to cache +RUN mkdir install_scripts + +# ROS Noetic +#ADD install_scripts/mushr_install_ros.sh install_scripts/mushr_install_ros.sh +#RUN chmod +x install_scripts/mushr_install_ros.sh && install_scripts/mushr_install_ros.sh + +# Catkin build and other deps +#ADD install_scripts/mushr_install_deps.sh install_scripts/mushr_install_deps.sh +#RUN chmod +x install_scripts/mushr_install_deps.sh && install_scripts/mushr_install_deps.sh + +# MuSHR base repos +#ADD mushr /root/catkin_ws/src/mushr +#ADD mushr_sim /root/catkin_ws/src/mushr_sim +#ADD serial /root/catkin_ws/src/serial +#ADD range_libc /root/catkin_ws/src/range_libc + +#ADD install_scripts/mushr_install_stack.sh install_scripts/mushr_install_stack.sh +#RUN chmod +x install_scripts/mushr_install_stack.sh && install_scripts/mushr_install_stack.sh + +# Hardware drivers +# 1 = real robot, 0 = sim (laptop) +ARG REAL=1 +ADD install_scripts/mushr_install_hw_drivers.sh install_scripts/mushr_install_hw_drivers.sh +RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.sh && install_scripts/mushr_install_hw_drivers.sh ; fi diff --git a/mushr_utils/install/docker-compose.yml b/mushr_utils/install/docker-compose.yml new file mode 100644 index 0000000..8266789 --- /dev/null +++ b/mushr_utils/install/docker-compose.yml @@ -0,0 +1,36 @@ +version: "3.4" +services: + mushr_noetic: + build: + context: . + args: + REAL: ${REAL_ROBOT} + network_mode: "host" + 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 + count: all + 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 + environment: + - DISPLAY=${DISPLAY} + - QT_X11_NO_MITSHM=1 + - NEVIAID_DRIVER_CAPABILITIES=all + - NVIDIA_VISIBLE_DEVICES=all + +# docker run -it --runtime nvidia -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix -v /etc/udev:/etc/udev -v /usr/bin/tegrastats:/usr/bin/tegrastats --device /dev --privileged --net=host --env=NVIDIA_VISIBLE_DEVICES=all --env=NEVIAID_DRIVER_CAPABILITIES=all --env QT_X11_NO_MITSHM=1 85fc23722f0c bash + diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash new file mode 100644 index 0000000..94636a1 --- /dev/null +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -0,0 +1,38 @@ +#!/bin/bash + +# Install git, tkinter, wget, g++, vim, tmux, networking stuff +apt-get install -y git-all python3-tk wget g++ vim tmux net-tools iputils-ping + +# Install vcstool, pip +sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xAB17C654 +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 + +# Install catkin tools +wget http://packages.ros.org/ros.key -O - | apt-key add - +apt-get update +apt-get install -y python3-catkin-tools + +# Install Cython +pip install Cython + +# Create OpenCV symbolic link +ln -s /usr/include/opencv4 /usr/include/opencv + +# Create workspace +source /opt/ros/noetic/setup.bash +cd ~ +mkdir -p catkin_ws/src +cd catkin_ws +catkin init +catkin build + +# Auto source this workspace on terminal startup +echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc +source ~/catkin_ws/devel/setup.bash + +echo "export ROS_IP=10.42.0.1" >> ~/.bashrc diff --git a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash new file mode 100644 index 0000000..3fa5f73 --- /dev/null +++ b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash @@ -0,0 +1,38 @@ +#!/bin/bash + +# Need to reboot after running this script + +# Install librealsense. Following commands copied from +# https://github.com/JetsonHacksNano/installLibrealsense/blob/master/installLibrealsense.sh +apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key + +# NOTE hardcoded "bionic" b.c. focal arm64 release not found +add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo bionic main" -u + +apt-get install rsync -y +apt-get install librealsense2-utils librealsense2-dev -y + +# Install YDLidar drivers +cd ~/catkin_ws/src/mushr/mushr_hardware +git clone https://github.com/prl-mushr/ydlidar + +# Install BLDC tool. Following commands adapted from: +# https://github.com/jetsonhacks/installBLDC/blob/master/installBLDC.sh +cd $ROOT +apt-get install -y qtcreator libudev-dev libqt5serialport5-dev +git clone https://github.com/vedderb/bldc-tool +cd bldc-tool +qmake -qt=qt5 +make clean & make + +# Install push-button drivers +apt-get install Jetson.GPIO -y +cd ~/catkin_ws/src/mushr/mushr_hardware +git clone https://github.com/prl-mushr/push_button_utils +ln -s /usr/bin/python3 /usr/bin/python + +source ~/.bashrc + +# Compile +cd ~/catkin_ws +catkin build diff --git a/mushr_utils/install/install_scripts/mushr_install_ros.bash b/mushr_utils/install/install_scripts/mushr_install_ros.bash new file mode 100644 index 0000000..496379f --- /dev/null +++ b/mushr_utils/install/install_scripts/mushr_install_ros.bash @@ -0,0 +1,28 @@ +#!/bin/bash + +# Setup software sources from packages.ros.org +sh -c 'echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros-latest.list' + +# Setup keys +apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 + +# Update package index +apt-get update + +# Install ROS libraries +apt-get install ros-noetic-desktop -y + +# Auto source ROS on terminal startup +echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc + +# Source it for this terminal +source /opt/ros/noetic/setup.bash + +# Install rosdep +apt-get install python3-rosdep -y + +# Initialize rosdep +rosdep init + +# Update rosdep +rosdep update diff --git a/mushr_utils/install/install_scripts/mushr_install_stack.bash b/mushr_utils/install/install_scripts/mushr_install_stack.bash new file mode 100644 index 0000000..8c351a5 --- /dev/null +++ b/mushr_utils/install/install_scripts/mushr_install_stack.bash @@ -0,0 +1,22 @@ +#!/bin/bash + +# Install dependencies +cd ~/catkin_ws +export ROS_DISTRO="noetic" +rosdep install --from-paths src --ignore-src -r -y + +# Install rangelibc +cd ~/catkin_ws/src/range_libc/pywrapper +python3 setup.py install +cd ~/catkin_ws/src +rm -rf range_libc + +# Compile +catkin build + +# Create default RVIZ setup +mkdir ~/.rviz +cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ + +# Set ROS_IP +export ROS_IP=$(ifconfig wlan0 | grep "inet " | awk '{print $2}') diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash new file mode 100644 index 0000000..d9cb059 --- /dev/null +++ b/mushr_utils/install/mushr_install.bash @@ -0,0 +1,49 @@ +#!/bin/bash + +# Get user info +read -p "Are you installing on robot and need all the sensor drivers? (y/n) " -r +echo + +if [[ $REPLY =~ ^[Yy]$ ]]; then + echo Running robot specific commands + # Need to connect to ydlidar + git clone https://github.com/prl-mushr/ydlidar + cd ydlidar + sudo sh startup/initenv.sh + + # Setup VESC udev rules. Following commands adapted from: + # https://github.com/RacecarJ/installRACECARUdev + echo "ACTION==\"add\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"5740\", SYMLINK+=\"vesc\"" > /tmp/10-vesc.rules + sudo mv /tmp/10-vesc.rules /etc/udev/rules.d/ + sudo udevadm control --reload-rules && udevadm trigger + + # Install GPIO library + pip install Jetson.GPIO + sudo groupadd -f -r gpio + sudo usermod -a -G gpio $USER + wget https://raw.githubusercontent.com/NVIDIA/jetson-gpio/master/lib/python/Jetson/GPIO/99-gpio.rules -O /etc/udev/rules.d/99-gpio.rules + sudo udevadm control --reload-rules && udevadm trigger + + # Setup rc.local + echo '#!/bin/sh -e' > /tmp/rc.local + echo "echo 200 > /sys/class/gpio/export" >> /tmp/rc.local + echo "chmod go+w /sys/class/gpio/gpio200/direction" >> /tmp/rc.local + echo "chmod go+rw /sys/class/gpio/gpio200/value" >> /tmp/rc.local + echo "echo \"in\" > /sys/class/gpio/gpio200/direction" >> /tmp/rc.local + echo "rs-enumerate-devices &> /dev/null" >> /tmp/rc.local + echo "nvpmodel -m 0" >> /tmp/rc.local + echo "sleep 60 && jetson_clocks" >> /tmp/rc.local + sudo mv /tmp/rc.local /etc/rc.local + export REAL_ROBOT=1 +else + export REAL_ROBOT=0 +fi + +docker-compose up + +read -p $'Add "xhost +" to .bashrc? 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 + .bashrc? (y/n) ' -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + echo WARNING: Adding "xhost" + to .bashrc + echo "xhost +" >> ~/.bashrc && source ~/.bashrc +fi diff --git a/mushr_utils/install_scripts/mushr_install.sh b/mushr_utils/install_scripts/mushr_install.sh deleted file mode 100644 index a715f73..0000000 --- a/mushr_utils/install_scripts/mushr_install.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -echo "This script will install all libraries necessary for the MuSHR racecar. It assumes that this SD card has freshly been flashed with the NVIDIA stock image, and that there is an internet connection" -read -p "Would you like to proceed with installation? [y/n]" -n 1 -r -echo # (optional) move to a new line -if [[ ! $REPLY =~ ^[Yy]$ ]] -then - exit 1 -fi - -# Install ROS -cd ~ -wget https://raw.githubusercontent.com/prl-mushr/mushr/master/mushr_utils/install_scripts/mushr_install_ros.sh -source mushr_install_ros.sh -cd ~ -rm mushr_install_ros.sh - -# Install MuSHR stack -wget https://raw.githubusercontent.com/prl-mushr/mushr/master/mushr_utils/install_scripts/mushr_install_stack.sh -source mushr_install_stack.sh -cd ~ -rm mushr_install_stack.sh - -# Install hardware drivers -wget https://raw.githubusercontent.com/prl-mushr/mushr/master/mushr_utils/install_scripts/mushr_install_hw_drivers.sh -source mushr_install_hw_drivers.sh -cd ~ -rm mushr_install_hw_drivers.sh - -echo "Installation complete." diff --git a/mushr_utils/install_scripts/mushr_install_hw_drivers.sh b/mushr_utils/install_scripts/mushr_install_hw_drivers.sh deleted file mode 100644 index eedc81a..0000000 --- a/mushr_utils/install_scripts/mushr_install_hw_drivers.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -# Need to reboot after running this script - -# Install librealsense. Following commands copied from -# https://github.com/JetsonHacksNano/installLibrealsense/blob/master/installLibrealsense.sh -sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key -sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u -sudo apt-get install apt-utils -y -sudo apt-get install librealsense2-utils librealsense2-dev -y - -# Install YDLidar drivers -cd ~/catkin_ws/src/mushr/mushr_hardware -git clone https://github.com/prl-mushr/ydlidar -cd ydlidar -sudo startup/initenv.sh - -# Install BLDC tool. Following commands adapted from: -# https://github.com/jetsonhacks/installBLDC/blob/master/installBLDC.sh -cd $ROOT -sudo apt-get install qtcreator libqt4-dev libudev-dev libqt5serialport5-dev -git clone https://github.com/vedderb/bldc-tool -cd bldc-tool -qmake -qt=qt5 -make clean & make -cd $ROOT - -# Add user to dialout to communicate with VESC -sudo adduser $USER dialout - -# Setup VESC udev rules. Following commands adapted from: -# https://github.com/RacecarJ/installRACECARUdev -echo "ACTION==\"add\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"5740\", SYMLINK+=\"vesc\"" > /tmp/10-vesc.rules -sudo mv /tmp/10-vesc.rules /etc/udev/rules.d/ -sudo udevadm control --reload-rules -sudo udevadm trigger - -# Install GPIO library -sudo pip install Jetson.GPIO -sudo groupadd -f -r gpio -sudo usermod -a -G gpio $USER -sudo wget https://raw.githubusercontent.com/NVIDIA/jetson-gpio/master/lib/python/Jetson/GPIO/99-gpio.rules -O /etc/udev/rules.d/99-gpio.rules -sudo udevadm control --reload-rules && sudo udevadm trigger - -# Install push-button drivers -cd ~/catkin_ws/src/mushr/mushr_hardware -git clone https://github.com/prl-mushr/push_button_utils - -# Setup rc.local -echo '#!/bin/sh -e' > /tmp/rc.local -echo "echo 200 > sys/class/gpio/export" >> /tmp/rc.local -echo "chmod go+w /sys/class/gpio/gpio200/direction" >> /tmp/rc.local -echo "chmod go+rw /sys/class/gpio/gpio200/value" >> /tmp/rc.local -echo "echo \"in\" > /sys/class/gpio/gpio200/direction" >> /tmp/rc.local -echo "rs-enumerate-devices &> /dev/null" >> /tmp/rc.local -echo "nvpmodel -m 0" >> /tmp/rc.local -echo "sleep 60 && jetson_clocks" >> /tmp/rc.local -sudo mv /tmp/rc.local /etc/rc.local - -source /opt/ros/melodic/setup.bash - -# Compile -cd ~/catkin_ws -catkin_make - -# Install timed roslaunch -sudo apt install ros-melodic-timed-roslaunch - -echo "Hardware drivers installed, please reboot for changes to take effect" diff --git a/mushr_utils/install_scripts/mushr_install_ros.sh b/mushr_utils/install_scripts/mushr_install_ros.sh deleted file mode 100644 index 512e58c..0000000 --- a/mushr_utils/install_scripts/mushr_install_ros.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# Setup software sources from packages.ros.org -sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' - -# Setup keys -sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 - -# Update package index -sudo apt update - -# Install ROS libraries -sudo apt install ros-melodic-desktop - -# Auto source ROS on terminal startup -echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc - -# Source it for this terminal -source /opt/ros/melodic/setup.bash - -# Install rosdep -sudo apt install python-rosdep - -# Initialize rosdep -sudo rosdep init - -# Update rosdep -rosdep update diff --git a/mushr_utils/install_scripts/mushr_install_stack.sh b/mushr_utils/install_scripts/mushr_install_stack.sh deleted file mode 100644 index f996b4c..0000000 --- a/mushr_utils/install_scripts/mushr_install_stack.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -# Install git -sudo apt install git-all - -# Install tkinter -sudo apt install python-tk - -# Install vcstool -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-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xAB17C654 -sudo apt-get update -sudo apt-get install python3-vcstool - -# Install pip -sudo apt install python-pip - -# Install extra ROS packages -sudo apt install -y ros-melodic-ackermann-msgs ros-melodic-map-server ros-melodic-serial ros-melodic-urg-node ros-melodic-robot-state-publisher ros-melodic-xacro ros-melodic-joy - -# Create workspace -cd ~ -mkdir -p catkin_ws/src -cd catkin_ws/src -catkin_init_workspace - -source /opt/ros/melodic/setup.bash -cd ~/catkin_ws -catkin_make - -# Auto source this workspace on terminal startup -echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc -source ~/catkin_ws/devel/setup.bash - -echo "export ROS_IP=10.42.0.1" >> ~/.bashrc - -# Get repo info -sudo apt install wget -cd ~/catkin_ws/src -wget https://mushr.io/tutorials/quickstart/repos.yaml - -# Clone the repos -vcs import < repos.yaml - -# Install dependencies -cd ~/catkin_ws -rosdep install --from-paths src --ignore-src -r -y - -# Install Cython -sudo pip install Cython - -# Install rangelibc -cd ~/catkin_ws/src/range_libc/pywrapper -sudo python setup.py install -cd ~/catkin_ws/src -sudo rm -rf range_libc - -# Create OpenCV symbolic link -sudo ln -s /usr/include/opencv4 /usr/include/opencv - -# Compile -cd ~/catkin_ws -catkin_make -j 2 - -# Create default RVIZ setup -mkdir ~/.rviz -cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ diff --git a/mushr_utils/install_scripts/mushr_install_vesc_tool.sh b/mushr_utils/install_scripts/mushr_install_vesc_tool.sh deleted file mode 100644 index 3cc9d71..0000000 --- a/mushr_utils/install_scripts/mushr_install_vesc_tool.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# These install instructions were adapted from a post by -# subodh-malgonde here: https://github.com/vedderb/vesc_tool/issues/23 - -cd $HOME - -git clone https://github.com/vedderb/vesc_tool - -sudo apt-get install qt5-default libudev-dev libqt5serialport5-dev qtconnectivity5-dev qtpositioning5-dev qtquickcontrols2-5-dev -y - -cd vesc_tool - -qmake -qt=qt5 - -make clean && make -j4 diff --git a/repos.yaml b/repos.yaml index e81f75f..89f586b 100644 --- a/repos.yaml +++ b/repos.yaml @@ -2,19 +2,15 @@ repositories: mushr_sim: type: git url: https://github.com/prl-mushr/mushr_sim.git - version: master - mushr: - type: git - url: https://github.com/prl-mushr/mushr.git - version: master + version: noetic mushr/mushr_base/mushr_base: type: git url: https://github.com/prl-mushr/mushr_base.git - version: master + version: noetic mushr/mushr_base/vesc: type: git url: https://github.com/prl-mushr/vesc.git - version: master + version: noetic mushr/mushr_hardware/realsense: type: git url: https://github.com/IntelRealSense/realsense-ros.git @@ -22,4 +18,4 @@ repositories: range_libc: type: git url: https://github.com/kctess5/range_libc.git - version: deploy + version: python3 From 0a50c16e11266d1b3ab7ffa3917ba9e74c933e89 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Sun, 12 Dec 2021 16:15:04 -0800 Subject: [PATCH 07/61] creating catkin_ws outside container --- .gitignore | 1 + mushr_utils/install/Dockerfile | 6 +- mushr_utils/install/docker-compose.yml | 1 + .../install_scripts/mushr_install_deps.bash | 8 +- mushr_utils/install/mushr_install.bash | 84 +++++++++++-------- repos.yaml | 6 +- 6 files changed, 63 insertions(+), 43 deletions(-) diff --git a/.gitignore b/.gitignore index 2611e8c..1cfafa8 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ yaml-cpp/ mushr_hardware/realsense-ros/ mushr_hardware/realsense2_camera/ mushr_hardware/realsense2_description/ +.install_run.txt diff --git a/mushr_utils/install/Dockerfile b/mushr_utils/install/Dockerfile index 95b3443..6ad4c05 100644 --- a/mushr_utils/install/Dockerfile +++ b/mushr_utils/install/Dockerfile @@ -29,6 +29,6 @@ RUN mkdir install_scripts # Hardware drivers # 1 = real robot, 0 = sim (laptop) -ARG REAL=1 -ADD install_scripts/mushr_install_hw_drivers.sh install_scripts/mushr_install_hw_drivers.sh -RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.sh && install_scripts/mushr_install_hw_drivers.sh ; fi +#ARG REAL=1 +#ADD install_scripts/mushr_install_hw_drivers.sh install_scripts/mushr_install_hw_drivers.sh +#RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.sh && install_scripts/mushr_install_hw_drivers.sh ; fi diff --git a/mushr_utils/install/docker-compose.yml b/mushr_utils/install/docker-compose.yml index 8266789..8699718 100644 --- a/mushr_utils/install/docker-compose.yml +++ b/mushr_utils/install/docker-compose.yml @@ -26,6 +26,7 @@ services: - /tmp/.X11-unix:/tmp/.X11-unix - /dev:/dev - /dev/input:/dev/input + - ${WS_PATH}/catkin_ws:~/catkin_ws environment: - DISPLAY=${DISPLAY} - QT_X11_NO_MITSHM=1 diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index 94636a1..c33f5d9 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -23,16 +23,12 @@ pip install Cython # Create OpenCV symbolic link ln -s /usr/include/opencv4 /usr/include/opencv -# Create workspace +# Init workspace source /opt/ros/noetic/setup.bash -cd ~ -mkdir -p catkin_ws/src -cd catkin_ws +cd ~/catkin_ws catkin init catkin build # Auto source this workspace on terminal startup echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc source ~/catkin_ws/devel/setup.bash - -echo "export ROS_IP=10.42.0.1" >> ~/.bashrc diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index d9cb059..a51897b 100644 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -1,44 +1,62 @@ #!/bin/bash +if [[ ! -f mushr_install.bash ]]; then + echo Wrong directory! Change directory to the one containing mushr_install.bash + exit 1 +fi +PATH=pwd # Get user info read -p "Are you installing on robot and need all the sensor drivers? (y/n) " -r echo +if [[ ! -f .install_run.txt ]]; then + touch .install_run.txt # Prevents running these commands multiple times. Bit hacky + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo Running robot specific commands + # Need to connect to ydlidar + git clone https://github.com/prl-mushr/ydlidar + cd ydlidar + sudo sh startup/initenv.sh + cd .. && rm -rf ydlidar + + # Setup VESC udev rules. Following commands adapted from: + # https://github.com/RacecarJ/installRACECARUdev + echo "ACTION==\"add\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"5740\", SYMLINK+=\"vesc\"" > /tmp/10-vesc.rules + sudo mv /tmp/10-vesc.rules /etc/udev/rules.d/ + sudo udevadm control --reload-rules && udevadm trigger + + # Install GPIO library + pip install Jetson.GPIO + sudo groupadd -f -r gpio + sudo usermod -a -G gpio $USER + wget https://raw.githubusercontent.com/NVIDIA/jetson-gpio/master/lib/python/Jetson/GPIO/99-gpio.rules -O /etc/udev/rules.d/99-gpio.rules + sudo udevadm control --reload-rules && udevadm trigger + + # Setup rc.local + echo '#!/bin/sh -e' > /tmp/rc.local + echo "echo 200 > /sys/class/gpio/export" >> /tmp/rc.local + echo "chmod go+w /sys/class/gpio/gpio200/direction" >> /tmp/rc.local + echo "chmod go+rw /sys/class/gpio/gpio200/value" >> /tmp/rc.local + echo "echo \"in\" > /sys/class/gpio/gpio200/direction" >> /tmp/rc.local + echo "rs-enumerate-devices &> /dev/null" >> /tmp/rc.local + echo "nvpmodel -m 0" >> /tmp/rc.local + echo "sleep 60 && jetson_clocks" >> /tmp/rc.local + sudo mv /tmp/rc.local /etc/rc.local + export REAL_ROBOT=1 + else + export REAL_ROBOT=0 + fi + + # Make catkin_ws outside container for easy editing + mkdir -p ../../../catkin_ws/src + cd ../../../ && mv mushr catkin_ws/src/mushr + WS_PATH=pwd + apt-get install -y python3-vcstool + cd catkin_ws/src/ && vcs import < mushr/repos.yaml -if [[ $REPLY =~ ^[Yy]$ ]]; then - echo Running robot specific commands - # Need to connect to ydlidar - git clone https://github.com/prl-mushr/ydlidar - cd ydlidar - sudo sh startup/initenv.sh - - # Setup VESC udev rules. Following commands adapted from: - # https://github.com/RacecarJ/installRACECARUdev - echo "ACTION==\"add\", ATTRS{idVendor}==\"0483\", ATTRS{idProduct}==\"5740\", SYMLINK+=\"vesc\"" > /tmp/10-vesc.rules - sudo mv /tmp/10-vesc.rules /etc/udev/rules.d/ - sudo udevadm control --reload-rules && udevadm trigger - - # Install GPIO library - pip install Jetson.GPIO - sudo groupadd -f -r gpio - sudo usermod -a -G gpio $USER - wget https://raw.githubusercontent.com/NVIDIA/jetson-gpio/master/lib/python/Jetson/GPIO/99-gpio.rules -O /etc/udev/rules.d/99-gpio.rules - sudo udevadm control --reload-rules && udevadm trigger - - # Setup rc.local - echo '#!/bin/sh -e' > /tmp/rc.local - echo "echo 200 > /sys/class/gpio/export" >> /tmp/rc.local - echo "chmod go+w /sys/class/gpio/gpio200/direction" >> /tmp/rc.local - echo "chmod go+rw /sys/class/gpio/gpio200/value" >> /tmp/rc.local - echo "echo \"in\" > /sys/class/gpio/gpio200/direction" >> /tmp/rc.local - echo "rs-enumerate-devices &> /dev/null" >> /tmp/rc.local - echo "nvpmodel -m 0" >> /tmp/rc.local - echo "sleep 60 && jetson_clocks" >> /tmp/rc.local - sudo mv /tmp/rc.local /etc/rc.local - export REAL_ROBOT=1 -else - export REAL_ROBOT=0 fi +# Build container +cd $PATH docker-compose up read -p $'Add "xhost +" to .bashrc? 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 + .bashrc? (y/n) ' -r diff --git a/repos.yaml b/repos.yaml index 89f586b..2833a92 100644 --- a/repos.yaml +++ b/repos.yaml @@ -11,6 +11,10 @@ repositories: type: git url: https://github.com/prl-mushr/vesc.git version: noetic + mushr/mushr_base/ackermann_cmd_mux: + type: git + url: https://github.com/prl-mushr/ackermann_cmd_mux.git + version: noetic mushr/mushr_hardware/realsense: type: git url: https://github.com/IntelRealSense/realsense-ros.git @@ -18,4 +22,4 @@ repositories: range_libc: type: git url: https://github.com/kctess5/range_libc.git - version: python3 + version: noetic From 37e548aff814a050e4e7e76828effd9452359123 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Sun, 12 Dec 2021 16:56:31 -0800 Subject: [PATCH 08/61] proper path variables --- mushr_utils/install/Dockerfile | 26 +++++++++++------------ mushr_utils/install/mushr_install.bash | 29 +++++++++++++++++--------- 2 files changed, 32 insertions(+), 23 deletions(-) mode change 100644 => 100755 mushr_utils/install/mushr_install.bash diff --git a/mushr_utils/install/Dockerfile b/mushr_utils/install/Dockerfile index 6ad4c05..ff7576e 100644 --- a/mushr_utils/install/Dockerfile +++ b/mushr_utils/install/Dockerfile @@ -11,24 +11,24 @@ RUN apt-get update -y \ RUN mkdir install_scripts # ROS Noetic -#ADD install_scripts/mushr_install_ros.sh install_scripts/mushr_install_ros.sh -#RUN chmod +x install_scripts/mushr_install_ros.sh && install_scripts/mushr_install_ros.sh +ADD install_scripts/mushr_install_ros.sh install_scripts/mushr_install_ros.sh +RUN chmod +x install_scripts/mushr_install_ros.sh && install_scripts/mushr_install_ros.sh # Catkin build and other deps -#ADD install_scripts/mushr_install_deps.sh install_scripts/mushr_install_deps.sh -#RUN chmod +x install_scripts/mushr_install_deps.sh && install_scripts/mushr_install_deps.sh +ADD install_scripts/mushr_install_deps.sh install_scripts/mushr_install_deps.sh +RUN chmod +x install_scripts/mushr_install_deps.sh && install_scripts/mushr_install_deps.sh # MuSHR base repos -#ADD mushr /root/catkin_ws/src/mushr -#ADD mushr_sim /root/catkin_ws/src/mushr_sim -#ADD serial /root/catkin_ws/src/serial -#ADD range_libc /root/catkin_ws/src/range_libc +ADD mushr /root/catkin_ws/src/mushr +ADD mushr_sim /root/catkin_ws/src/mushr_sim +ADD serial /root/catkin_ws/src/serial +ADD range_libc /root/catkin_ws/src/range_libc -#ADD install_scripts/mushr_install_stack.sh install_scripts/mushr_install_stack.sh -#RUN chmod +x install_scripts/mushr_install_stack.sh && install_scripts/mushr_install_stack.sh +ADD install_scripts/mushr_install_stack.sh install_scripts/mushr_install_stack.sh +RUN chmod +x install_scripts/mushr_install_stack.sh && install_scripts/mushr_install_stack.sh # Hardware drivers # 1 = real robot, 0 = sim (laptop) -#ARG REAL=1 -#ADD install_scripts/mushr_install_hw_drivers.sh install_scripts/mushr_install_hw_drivers.sh -#RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.sh && install_scripts/mushr_install_hw_drivers.sh ; fi +ARG REAL=1 +ADD install_scripts/mushr_install_hw_drivers.sh install_scripts/mushr_install_hw_drivers.sh +RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.sh && install_scripts/mushr_install_hw_drivers.sh ; fi diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash old mode 100644 new mode 100755 index a51897b..d346764 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -1,17 +1,28 @@ #!/bin/bash + +# 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 -PATH=pwd +INSTALL_PATH=$(pwd) -# Get user info +# 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 +else + export REAL_ROBOT=0 +fi + +# Get user info if [[ ! -f .install_run.txt ]]; then touch .install_run.txt # Prevents running these commands multiple times. Bit hacky - if [[ $REPLY =~ ^[Yy]$ ]]; then + + if [[ $REAL_ROBOT == 1 ]]; then echo Running robot specific commands + # Need to connect to ydlidar git clone https://github.com/prl-mushr/ydlidar cd ydlidar @@ -41,27 +52,25 @@ if [[ ! -f .install_run.txt ]]; then echo "nvpmodel -m 0" >> /tmp/rc.local echo "sleep 60 && jetson_clocks" >> /tmp/rc.local sudo mv /tmp/rc.local /etc/rc.local - export REAL_ROBOT=1 - else - export REAL_ROBOT=0 fi # Make catkin_ws outside container for easy editing mkdir -p ../../../catkin_ws/src cd ../../../ && mv mushr catkin_ws/src/mushr - WS_PATH=pwd apt-get install -y python3-vcstool cd catkin_ws/src/ && vcs import < mushr/repos.yaml + cd mushr/mushr_utils/install/ && INSTALL_PATH=$(pwd) fi # Build container -cd $PATH +cd $INSTALL_PATH +WS_PATH=$(pwd | sed 's/catkin_ws.*//') docker-compose up read -p $'Add "xhost +" to .bashrc? 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 + .bashrc? (y/n) ' -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then - echo WARNING: Adding "xhost" + to .bashrc - echo "xhost +" >> ~/.bashrc && source ~/.bashrc + echo WARNING: Adding "xhost +" to .bashrc + echo "xhost + >> /dev/null" >> ~/.bashrc && source ~/.bashrc fi From 6f1d20276b81877835006078621326bb64f698c0 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Tue, 14 Dec 2021 14:44:45 -0800 Subject: [PATCH 09/61] working --- mushr_utils/install/Dockerfile | 24 ++++++++----------- mushr_utils/install/docker-compose.yml | 7 ++++-- .../install_scripts/mushr_install_deps.bash | 9 +------ .../mushr_install_hw_drivers.bash | 13 +--------- .../install_scripts/mushr_install_stack.bash | 9 +++---- mushr_utils/install/mushr_install.bash | 10 ++++---- repos.yaml | 14 ++++++++++- 7 files changed, 38 insertions(+), 48 deletions(-) diff --git a/mushr_utils/install/Dockerfile b/mushr_utils/install/Dockerfile index ff7576e..14a1af8 100644 --- a/mushr_utils/install/Dockerfile +++ b/mushr_utils/install/Dockerfile @@ -9,26 +9,22 @@ RUN apt-get update -y \ # Adding/Running files separately allows us to cache RUN mkdir install_scripts +ARG INSTALL_PATH # ROS Noetic -ADD install_scripts/mushr_install_ros.sh install_scripts/mushr_install_ros.sh -RUN chmod +x install_scripts/mushr_install_ros.sh && install_scripts/mushr_install_ros.sh +ADD $INSTALL_PATH/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 # Catkin build and other deps -ADD install_scripts/mushr_install_deps.sh install_scripts/mushr_install_deps.sh -RUN chmod +x install_scripts/mushr_install_deps.sh && install_scripts/mushr_install_deps.sh +ADD catkin_ws catkin_ws +ADD $INSTALL_PATH/install_scripts/mushr_install_deps.bash install_scripts/mushr_install_deps.bash +RUN chmod +x install_scripts/mushr_install_deps.bash && install_scripts/mushr_install_deps.bash -# MuSHR base repos -ADD mushr /root/catkin_ws/src/mushr -ADD mushr_sim /root/catkin_ws/src/mushr_sim -ADD serial /root/catkin_ws/src/serial -ADD range_libc /root/catkin_ws/src/range_libc - -ADD install_scripts/mushr_install_stack.sh install_scripts/mushr_install_stack.sh -RUN chmod +x install_scripts/mushr_install_stack.sh && install_scripts/mushr_install_stack.sh +ADD $INSTALL_PATH/install_scripts/mushr_install_stack.bash install_scripts/mushr_install_stack.bash +RUN chmod +x install_scripts/mushr_install_stack.bash && install_scripts/mushr_install_stack.bash # Hardware drivers # 1 = real robot, 0 = sim (laptop) ARG REAL=1 -ADD install_scripts/mushr_install_hw_drivers.sh install_scripts/mushr_install_hw_drivers.sh -RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.sh && install_scripts/mushr_install_hw_drivers.sh ; fi +ADD $INSTALL_PATH/install_scripts/mushr_install_hw_drivers.bash install_scripts/mushr_install_hw_drivers.bash +RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.bash && install_scripts/mushr_install_hw_drivers.bash ; fi diff --git a/mushr_utils/install/docker-compose.yml b/mushr_utils/install/docker-compose.yml index 8699718..9ac9238 100644 --- a/mushr_utils/install/docker-compose.yml +++ b/mushr_utils/install/docker-compose.yml @@ -2,9 +2,12 @@ version: "3.4" services: mushr_noetic: build: - context: . + context: ${WS_PATH} + dockerfile: ${INSTALL_PATH}/Dockerfile args: REAL: ${REAL_ROBOT} + WS_PATH: ${WS_PATH} + INSTALL_PATH: /catkin_ws/src/mushr/mushr_utils/install network_mode: "host" privileged: true devices: @@ -26,7 +29,7 @@ services: - /tmp/.X11-unix:/tmp/.X11-unix - /dev:/dev - /dev/input:/dev/input - - ${WS_PATH}/catkin_ws:~/catkin_ws + - ${WS_PATH}/catkin_ws:/root/catkin_ws # Runtime attach environment: - DISPLAY=${DISPLAY} - QT_X11_NO_MITSHM=1 diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index c33f5d9..8003151 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 +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 # Install catkin tools wget http://packages.ros.org/ros.key -O - | apt-key add - @@ -23,12 +23,5 @@ pip install Cython # Create OpenCV symbolic link ln -s /usr/include/opencv4 /usr/include/opencv -# Init workspace -source /opt/ros/noetic/setup.bash -cd ~/catkin_ws -catkin init -catkin build - # Auto source this workspace on terminal startup echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc -source ~/catkin_ws/devel/setup.bash diff --git a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash index 3fa5f73..870e093 100644 --- a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash +++ b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash @@ -12,10 +12,6 @@ add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo bionic ma apt-get install rsync -y apt-get install librealsense2-utils librealsense2-dev -y -# Install YDLidar drivers -cd ~/catkin_ws/src/mushr/mushr_hardware -git clone https://github.com/prl-mushr/ydlidar - # Install BLDC tool. Following commands adapted from: # https://github.com/jetsonhacks/installBLDC/blob/master/installBLDC.sh cd $ROOT @@ -27,12 +23,5 @@ make clean & make # Install push-button drivers apt-get install Jetson.GPIO -y -cd ~/catkin_ws/src/mushr/mushr_hardware -git clone https://github.com/prl-mushr/push_button_utils +rm /usr/bin/python ln -s /usr/bin/python3 /usr/bin/python - -source ~/.bashrc - -# Compile -cd ~/catkin_ws -catkin build diff --git a/mushr_utils/install/install_scripts/mushr_install_stack.bash b/mushr_utils/install/install_scripts/mushr_install_stack.bash index 8c351a5..2f06d3b 100644 --- a/mushr_utils/install/install_scripts/mushr_install_stack.bash +++ b/mushr_utils/install/install_scripts/mushr_install_stack.bash @@ -1,9 +1,9 @@ #!/bin/bash # Install dependencies -cd ~/catkin_ws -export ROS_DISTRO="noetic" -rosdep install --from-paths src --ignore-src -r -y +#cd ~/catkin_ws +#export ROS_DISTRO="noetic" +#rosdep install --from-paths src --ignore-src -r -y # Install rangelibc cd ~/catkin_ws/src/range_libc/pywrapper @@ -11,9 +11,6 @@ python3 setup.py install cd ~/catkin_ws/src rm -rf range_libc -# Compile -catkin build - # Create default RVIZ setup mkdir ~/.rviz cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index d346764..ab985e7 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -5,7 +5,7 @@ if [[ ! -f mushr_install.bash ]]; then echo Wrong directory! Change directory to the one containing mushr_install.bash exit 1 fi -INSTALL_PATH=$(pwd) +export 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 @@ -39,7 +39,7 @@ if [[ ! -f .install_run.txt ]]; then pip install Jetson.GPIO sudo groupadd -f -r gpio sudo usermod -a -G gpio $USER - wget https://raw.githubusercontent.com/NVIDIA/jetson-gpio/master/lib/python/Jetson/GPIO/99-gpio.rules -O /etc/udev/rules.d/99-gpio.rules + sudo wget https://raw.githubusercontent.com/NVIDIA/jetson-gpio/master/lib/python/Jetson/GPIO/99-gpio.rules -O /etc/udev/rules.d/99-gpio.rules sudo udevadm control --reload-rules && udevadm trigger # Setup rc.local @@ -57,15 +57,15 @@ if [[ ! -f .install_run.txt ]]; then # Make catkin_ws outside container for easy editing mkdir -p ../../../catkin_ws/src cd ../../../ && mv mushr catkin_ws/src/mushr - apt-get install -y python3-vcstool + sudo apt-get install -y python3-vcstool cd catkin_ws/src/ && vcs import < mushr/repos.yaml - cd mushr/mushr_utils/install/ && INSTALL_PATH=$(pwd) + cd mushr/mushr_utils/install/ && export INSTALL_PATH=$(pwd) fi # Build container cd $INSTALL_PATH -WS_PATH=$(pwd | sed 's/catkin_ws.*//') +export WS_PATH=$(pwd | sed 's:/catkin_ws.*::') docker-compose up read -p $'Add "xhost +" to .bashrc? 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 + .bashrc? (y/n) ' -r diff --git a/repos.yaml b/repos.yaml index 2833a92..d0881a3 100644 --- a/repos.yaml +++ b/repos.yaml @@ -21,5 +21,17 @@ repositories: version: 31fa75ec835650d319f2d5abd3f7d0ab66fd37f4 range_libc: type: git - url: https://github.com/kctess5/range_libc.git + url: https://github.com/prl-mushr/range_libc.git version: noetic + mushr/mushr_hardware/push_button_utils: + type: git + url: https://github.com/prl-mushr/push_button_utils.git + version: master + mushr/mushr_hardware/ydlidar: + type: git + url: https://github.com/prl-mushr/ydlidar.git + version: master + serial: + type: git + url: https://github.com/wjwwood/serial.git + version: main From 0f452693f811d28cb79d186c17994d359c2e828a Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 5 Jan 2022 20:22:01 -0800 Subject: [PATCH 10/61] laptop support and cpu only --- mushr_utils/install/Dockerfile | 13 ++++---- mushr_utils/install/docker-compose-cpu.yml | 30 +++++++++++++++++++ ...ker-compose.yml => docker-compose-gpu.yml} | 4 --- .../install_scripts/mushr_install_deps.bash | 15 +++++++++- .../install_scripts/mushr_install_stack.bash | 19 ------------ mushr_utils/install/mushr_install.bash | 29 ++++++++++++++++-- 6 files changed, 78 insertions(+), 32 deletions(-) create mode 100644 mushr_utils/install/docker-compose-cpu.yml rename mushr_utils/install/{docker-compose.yml => docker-compose-gpu.yml} (74%) delete mode 100644 mushr_utils/install/install_scripts/mushr_install_stack.bash diff --git a/mushr_utils/install/Dockerfile b/mushr_utils/install/Dockerfile index 14a1af8..7ce888c 100644 --- a/mushr_utils/install/Dockerfile +++ b/mushr_utils/install/Dockerfile @@ -1,10 +1,14 @@ -FROM timongentzsch/l4t-ubuntu20-pytorch:latest +#FROM timongentzsch/l4t-ubuntu20-pytorch:latest +FROM ubuntu:focal MAINTAINER Matt Schmittle +ARG DEBIAN_FRONTEND=noninteractive +WORKDIR /root + # Install docker deps for mushr_install RUN apt-get update -y \ - && DEBIAN_FRONTEND=noninteractive apt-get install keyboard-configuration apt-utils gnupg2 curl -y \ + && apt-get install keyboard-configuration apt-utils gnupg2 curl -y \ && apt-get update -y # Adding/Running files separately allows us to cache @@ -20,11 +24,8 @@ ADD catkin_ws catkin_ws ADD $INSTALL_PATH/install_scripts/mushr_install_deps.bash install_scripts/mushr_install_deps.bash RUN chmod +x install_scripts/mushr_install_deps.bash && install_scripts/mushr_install_deps.bash -ADD $INSTALL_PATH/install_scripts/mushr_install_stack.bash install_scripts/mushr_install_stack.bash -RUN chmod +x install_scripts/mushr_install_stack.bash && install_scripts/mushr_install_stack.bash - # Hardware drivers # 1 = real robot, 0 = sim (laptop) -ARG REAL=1 +ARG REAL ADD $INSTALL_PATH/install_scripts/mushr_install_hw_drivers.bash install_scripts/mushr_install_hw_drivers.bash RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.bash && install_scripts/mushr_install_hw_drivers.bash ; fi diff --git a/mushr_utils/install/docker-compose-cpu.yml b/mushr_utils/install/docker-compose-cpu.yml new file mode 100644 index 0000000..aa2f8bc --- /dev/null +++ b/mushr_utils/install/docker-compose-cpu.yml @@ -0,0 +1,30 @@ +version: "3.4" +services: + mushr_noetic: + build: + context: ${WS_PATH} + dockerfile: ${INSTALL_PATH}/Dockerfile + args: + REAL: ${REAL_ROBOT} + WS_PATH: ${WS_PATH} + INSTALL_PATH: /catkin_ws/src/mushr/mushr_utils/install + network_mode: "host" + privileged: true + devices: + - "/dev:/dev" + - "/dev/ydlidar:/dev/ydlidar" + - "/dev/vesc:/dev/vesc" + - "/dev/input/js0:/dev/input/js0" + 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 + - ${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/docker-compose.yml b/mushr_utils/install/docker-compose-gpu.yml similarity index 74% rename from mushr_utils/install/docker-compose.yml rename to mushr_utils/install/docker-compose-gpu.yml index 9ac9238..2833c12 100644 --- a/mushr_utils/install/docker-compose.yml +++ b/mushr_utils/install/docker-compose-gpu.yml @@ -20,7 +20,6 @@ services: reservations: devices: - driver: nvidia - count: all capabilities: [gpu] volumes: - /usr/bin/tegrastats:/usr/bin/tegrastats @@ -35,6 +34,3 @@ services: - QT_X11_NO_MITSHM=1 - NEVIAID_DRIVER_CAPABILITIES=all - NVIDIA_VISIBLE_DEVICES=all - -# docker run -it --runtime nvidia -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix -v /etc/udev:/etc/udev -v /usr/bin/tegrastats:/usr/bin/tegrastats --device /dev --privileged --net=host --env=NVIDIA_VISIBLE_DEVICES=all --env=NEVIAID_DRIVER_CAPABILITIES=all --env QT_X11_NO_MITSHM=1 85fc23722f0c bash - diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index 8003151..ebbb961 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 +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 # Install catkin tools wget http://packages.ros.org/ros.key -O - | apt-key add - @@ -25,3 +25,16 @@ ln -s /usr/include/opencv4 /usr/include/opencv # Auto source this workspace on terminal startup echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc + +# Install rangelibc +cd ~/catkin_ws/src/range_libc/pywrapper +python3 setup.py install +cd ~/catkin_ws/src +rm -rf range_libc + +# Create default RVIZ setup +mkdir ~/.rviz +cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ + +# Set ROS_IP +export ROS_IP=$(ifconfig wlan0 | grep "inet " | awk '{print $2}') diff --git a/mushr_utils/install/install_scripts/mushr_install_stack.bash b/mushr_utils/install/install_scripts/mushr_install_stack.bash deleted file mode 100644 index 2f06d3b..0000000 --- a/mushr_utils/install/install_scripts/mushr_install_stack.bash +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Install dependencies -#cd ~/catkin_ws -#export ROS_DISTRO="noetic" -#rosdep install --from-paths src --ignore-src -r -y - -# Install rangelibc -cd ~/catkin_ws/src/range_libc/pywrapper -python3 setup.py install -cd ~/catkin_ws/src -rm -rf range_libc - -# Create default RVIZ setup -mkdir ~/.rviz -cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ - -# Set ROS_IP -export ROS_IP=$(ifconfig wlan0 | grep "inet " | awk '{print $2}') diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index ab985e7..ea90d79 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -16,6 +16,15 @@ else export 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 + export GPU=docker-compose-gpu.yml +else + export GPU=docker-compose-cpu.yml +fi + # Get user info if [[ ! -f .install_run.txt ]]; then touch .install_run.txt # Prevents running these commands multiple times. Bit hacky @@ -61,12 +70,28 @@ if [[ ! -f .install_run.txt ]]; then cd catkin_ws/src/ && vcs import < mushr/repos.yaml cd mushr/mushr_utils/install/ && export INSTALL_PATH=$(pwd) + # Make sure environment Variables are always set + export WS_PATH=$(pwd | sed 's:/catkin_ws.*::') + echo "export INSTALL_PATH=${INSTALL_PATH}" >> ~/.bashrc + echo "export REAL_ROBOT=${REAL_ROBOT}" >> ~/.bashrc + echo "export WS_PATH=${WS_PATH}" >> ~/.bashrc + + # 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 + fi + fi # Build container cd $INSTALL_PATH -export WS_PATH=$(pwd | sed 's:/catkin_ws.*::') -docker-compose up +docker-compose -f $GPU up + +# Shortcut +echo "alias mushr_noetic='docker-compose -f $INSTALL_PATH/$GPU run mushr_noetic bash'" >> ~/.bashrc + read -p $'Add "xhost +" to .bashrc? 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 + .bashrc? (y/n) ' -r echo From 60534f400acdae859e68b2fd1eba00dd39aedb74 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Sat, 8 Jan 2022 11:29:37 -0800 Subject: [PATCH 11/61] nav repos --- repos.yaml => base-repos.yaml | 2 +- mushr_utils/install/docker-compose-robot.yml | 37 +++++++++++++++++++ .../install_scripts/mushr_install_deps.bash | 4 +- mushr_utils/install/mushr_install.bash | 24 ++++++++---- nav-repos.yaml | 9 +++++ 5 files changed, 65 insertions(+), 11 deletions(-) rename repos.yaml => base-repos.yaml (95%) create mode 100644 mushr_utils/install/docker-compose-robot.yml create mode 100644 nav-repos.yaml diff --git a/repos.yaml b/base-repos.yaml similarity index 95% rename from repos.yaml rename to base-repos.yaml index d0881a3..4514afd 100644 --- a/repos.yaml +++ b/base-repos.yaml @@ -18,7 +18,7 @@ repositories: mushr/mushr_hardware/realsense: type: git url: https://github.com/IntelRealSense/realsense-ros.git - version: 31fa75ec835650d319f2d5abd3f7d0ab66fd37f4 + version: f400d682beee6c216052a419f419e95b797255ad range_libc: type: git url: https://github.com/prl-mushr/range_libc.git diff --git a/mushr_utils/install/docker-compose-robot.yml b/mushr_utils/install/docker-compose-robot.yml new file mode 100644 index 0000000..b45ab26 --- /dev/null +++ b/mushr_utils/install/docker-compose-robot.yml @@ -0,0 +1,37 @@ +version: "3.4" +services: + mushr_noetic: + image: schmittle/mushr_noetic + build: + context: ${WS_PATH} + dockerfile: ${INSTALL_PATH}/Dockerfile + args: + REAL: ${REAL_ROBOT} + WS_PATH: ${WS_PATH} + INSTALL_PATH: /catkin_ws/src/mushr/mushr_utils/install + network_mode: "host" + 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 + - ${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/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index ebbb961..b077089 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -17,8 +17,8 @@ wget http://packages.ros.org/ros.key -O - | apt-key add - apt-get update apt-get install -y python3-catkin-tools -# Install Cython -pip install Cython +# Install Cython, PyTorch +pip3 install Cython torch torchvision torchaudio # Create OpenCV symbolic link ln -s /usr/include/opencv4 /usr/include/opencv diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index ea90d79..198b807 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -20,15 +20,20 @@ fi read -p "Do you have a nvidia gpu with installed drivers? (y/n) " -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then - export GPU=docker-compose-gpu.yml + if [[ $REAL_ROBOT == 1]]; then + export COMPOSE_FILE=docker-compose-robot.yml + else + export COMPOSE_FILE=docker-compose-gpu.yml + fi else - export GPU=docker-compose-cpu.yml + export COMPOSE_FILE=docker-compose-cpu.yml fi # Get user info if [[ ! -f .install_run.txt ]]; then touch .install_run.txt # Prevents running these commands multiple times. Bit hacky + # TODO install docker, noetic docker, docker-compose if [[ $REAL_ROBOT == 1 ]]; then echo Running robot specific commands @@ -67,7 +72,7 @@ if [[ ! -f .install_run.txt ]]; then mkdir -p ../../../catkin_ws/src cd ../../../ && mv mushr catkin_ws/src/mushr sudo apt-get install -y python3-vcstool - cd catkin_ws/src/ && vcs import < mushr/repos.yaml + cd 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 @@ -75,6 +80,7 @@ if [[ ! -f .install_run.txt ]]; then echo "export INSTALL_PATH=${INSTALL_PATH}" >> ~/.bashrc echo "export REAL_ROBOT=${REAL_ROBOT}" >> ~/.bashrc echo "export WS_PATH=${WS_PATH}" >> ~/.bashrc + echo "export COMPOSE_FILE=${COMPOSE_FILE}" >> ~/.bashrc # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils if [[ $REAL_ROBOT == 0 ]]; then @@ -83,15 +89,17 @@ if [[ ! -f .install_run.txt ]]; then touch $WS_PATH/catkin_ws/src/mushr/mushr_hardware/realsense/realsense2_camera/CATKIN_IGNORE fi + # Shortcuts + echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash\"" >> ~/.bashrc + # TODO these don't work + #echo "alias mushr_build=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash -c 'cd /root/catkin_ws && catkin_build'\" ">> ~/.bashrc + #echo "alias mushr_teleop=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic roslaunch mushr_base teleop.launch\" ">> ~/.bashrc + fi # Build container cd $INSTALL_PATH -docker-compose -f $GPU up - -# Shortcut -echo "alias mushr_noetic='docker-compose -f $INSTALL_PATH/$GPU run mushr_noetic bash'" >> ~/.bashrc - +docker-compose -f $COMPOSE_FILE up read -p $'Add "xhost +" to .bashrc? 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 + .bashrc? (y/n) ' -r echo diff --git a/nav-repos.yaml b/nav-repos.yaml new file mode 100644 index 0000000..79ad6a3 --- /dev/null +++ b/nav-repos.yaml @@ -0,0 +1,9 @@ +repositories: + mushr_pf: + type: git + url: https://github.com/prl-mushr/mushr_pf.git + version: master + mushr_rhc: + type: git + url: https://github.com/prl-mushr/mushr_rhc.git + version: noetic From 0dca182b775f355c305a568c007153a2900cbf75 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Sat, 8 Jan 2022 14:51:14 -0800 Subject: [PATCH 12/61] more stable install script --- mushr_utils/install/docker-compose-build.yml | 36 +++++++++ mushr_utils/install/docker-compose-robot.yml | 7 -- mushr_utils/install/mushr_install.bash | 84 +++++++++++++------- nav-repos.yaml | 2 +- 4 files changed, 92 insertions(+), 37 deletions(-) create mode 100644 mushr_utils/install/docker-compose-build.yml diff --git a/mushr_utils/install/docker-compose-build.yml b/mushr_utils/install/docker-compose-build.yml new file mode 100644 index 0000000..2833c12 --- /dev/null +++ b/mushr_utils/install/docker-compose-build.yml @@ -0,0 +1,36 @@ +version: "3.4" +services: + mushr_noetic: + build: + context: ${WS_PATH} + dockerfile: ${INSTALL_PATH}/Dockerfile + args: + REAL: ${REAL_ROBOT} + WS_PATH: ${WS_PATH} + INSTALL_PATH: /catkin_ws/src/mushr/mushr_utils/install + network_mode: "host" + 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 + - ${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/docker-compose-robot.yml b/mushr_utils/install/docker-compose-robot.yml index b45ab26..5720813 100644 --- a/mushr_utils/install/docker-compose-robot.yml +++ b/mushr_utils/install/docker-compose-robot.yml @@ -2,13 +2,6 @@ version: "3.4" services: mushr_noetic: image: schmittle/mushr_noetic - build: - context: ${WS_PATH} - dockerfile: ${INSTALL_PATH}/Dockerfile - args: - REAL: ${REAL_ROBOT} - WS_PATH: ${WS_PATH} - INSTALL_PATH: /catkin_ws/src/mushr/mushr_utils/install network_mode: "host" privileged: true devices: diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 198b807..99ddc61 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -20,7 +20,7 @@ fi read -p "Do you have a nvidia gpu with installed drivers? (y/n) " -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then - if [[ $REAL_ROBOT == 1]]; then + if [[ $REAL_ROBOT == 1 ]]; then export COMPOSE_FILE=docker-compose-robot.yml else export COMPOSE_FILE=docker-compose-gpu.yml @@ -29,12 +29,15 @@ else export COMPOSE_FILE=docker-compose-cpu.yml fi -# Get user info -if [[ ! -f .install_run.txt ]]; then - touch .install_run.txt # Prevents running these commands multiple times. Bit hacky +# Build from scratch (assumes GPU)? +read -p "Developer build from scratch (takes much longer than pulling ready-made image)? (y/n) " -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + export COMPOSE_FILE=docker-compose-build.yml +fi - # TODO install docker, noetic docker, docker-compose - if [[ $REAL_ROBOT == 1 ]]; then +# Robot specific settings +if [[ $REAL_ROBOT == 1 ]]; then echo Running robot specific commands # Need to connect to ydlidar @@ -66,44 +69,67 @@ if [[ ! -f .install_run.txt ]]; then echo "nvpmodel -m 0" >> /tmp/rc.local echo "sleep 60 && jetson_clocks" >> /tmp/rc.local sudo mv /tmp/rc.local /etc/rc.local - fi +fi - # Make catkin_ws outside container for easy editing +# vcstool https://github.com/dirk-thomas/vcstool +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 - +sudo apt-get update && sudo apt install -y python3-vcstool + +# 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 - sudo apt-get install -y python3-vcstool - cd catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs import < mushr/nav-repos.yaml - cd mushr/mushr_utils/install/ && export INSTALL_PATH=$(pwd) +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) - # Make sure environment Variables are always set - export WS_PATH=$(pwd | sed 's:/catkin_ws.*::') +# Make sure environment Variables are always set +if ! grep -Fq "export INSTALL_PATH=" ~/.bashrc ; then echo "export INSTALL_PATH=${INSTALL_PATH}" >> ~/.bashrc +fi +if ! grep -Fq "export REAL_ROBOT=" ~/.bashrc ; then echo "export REAL_ROBOT=${REAL_ROBOT}" >> ~/.bashrc +fi +if ! grep -Fq "export WS_PATH=" ~/.bashrc ; then echo "export WS_PATH=${WS_PATH}" >> ~/.bashrc +fi +if ! grep -Fq "export COMPOSE_FILE=" ~/.bashrc ; then echo "export COMPOSE_FILE=${COMPOSE_FILE}" >> ~/.bashrc +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 - 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 +fi - # Shortcuts +# Shortcuts +if ! grep -Fq "alias mushr_noetic=" ~/.bashrc ; then echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash\"" >> ~/.bashrc - # TODO these don't work - #echo "alias mushr_build=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash -c 'cd /root/catkin_ws && catkin_build'\" ">> ~/.bashrc - #echo "alias mushr_teleop=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic roslaunch mushr_base teleop.launch\" ">> ~/.bashrc - fi +# TODO these don't work +#echo "alias mushr_build=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash -c 'cd /root/catkin_ws && catkin_build'\" ">> ~/.bashrc +#echo "alias mushr_teleop=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic roslaunch mushr_base teleop.launch\" ">> ~/.bashrc # Build container cd $INSTALL_PATH docker-compose -f $COMPOSE_FILE up -read -p $'Add "xhost +" to .bashrc? 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 + .bashrc? (y/n) ' -r -echo -if [[ $REPLY =~ ^[Yy]$ ]]; then - echo WARNING: Adding "xhost +" to .bashrc - echo "xhost + >> /dev/null" >> ~/.bashrc && source ~/.bashrc +# Make sure all devices are visible +sudo udevadm control --reload-rules && sudo udevadm trigger + +# Display permissions +if ! grep -Fxq "xhost + >> /dev/null" ~/.bashrc ; then + read -p $'Add "xhost +" to .bashrc? 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 + .bashrc? (y/n) ' -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo WARNING: Adding "xhost +" to .bashrc + echo "xhost + >> /dev/null" >> ~/.bashrc && source ~/.bashrc + fi fi diff --git a/nav-repos.yaml b/nav-repos.yaml index 79ad6a3..9164271 100644 --- a/nav-repos.yaml +++ b/nav-repos.yaml @@ -2,7 +2,7 @@ repositories: mushr_pf: type: git url: https://github.com/prl-mushr/mushr_pf.git - version: master + version: noetic mushr_rhc: type: git url: https://github.com/prl-mushr/mushr_rhc.git From 212ffee4dc41ce0876ec924b6c70e67733550b0f Mon Sep 17 00:00:00 2001 From: schmittlema Date: Sat, 8 Jan 2022 17:04:23 -0800 Subject: [PATCH 13/61] python deps --- 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 b077089..c1f6606 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -18,7 +18,7 @@ apt-get update apt-get install -y python3-catkin-tools # Install Cython, PyTorch -pip3 install Cython torch torchvision torchaudio +pip3 install Cython torch torchvision torchaudio numpy scipy progress # Create OpenCV symbolic link ln -s /usr/include/opencv4 /usr/include/opencv From 179726453edbd389ee16b8708594ba7db2a68d21 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Wed, 12 Jan 2022 12:03:38 -0800 Subject: [PATCH 14/61] more deps --- mushr_utils/install/install_scripts/mushr_install_deps.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index c1f6606..6459fbf 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -10,15 +10,15 @@ 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 +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 # Install catkin tools wget http://packages.ros.org/ros.key -O - | apt-key add - apt-get update apt-get install -y python3-catkin-tools -# Install Cython, PyTorch -pip3 install Cython torch torchvision torchaudio numpy scipy progress +# Install Cython, PyTorch 1.10 at least! +pip3 install Cython torch torchvision torchaudio numpy scipy progress --upgrade # Create OpenCV symbolic link ln -s /usr/include/opencv4 /usr/include/opencv From f22f3751cc3ac7d075cea0f9df5aefe05576ae80 Mon Sep 17 00:00:00 2001 From: Matt Schmittle Date: Wed, 12 Jan 2022 17:15:45 -0800 Subject: [PATCH 15/61] curl separate line, change question --- mushr_utils/install/mushr_install.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 99ddc61..4791f8b 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -30,7 +30,7 @@ else fi # Build from scratch (assumes GPU)? -read -p "Developer build from scratch (takes much longer than pulling ready-made image)? (y/n) " -r +read -p "Build from scratch? (Not recommended, takes much longer than pulling ready-made image) (y/n) " -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then export COMPOSE_FILE=docker-compose-build.yml @@ -73,7 +73,8 @@ fi # vcstool https://github.com/dirk-thomas/vcstool 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 +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 - sudo apt-get update && sudo apt install -y python3-vcstool From 88d8d09b4e0bb09958c250661981d83b4978ac67 Mon Sep 17 00:00:00 2001 From: Matt Schmittle Date: Wed, 12 Jan 2022 19:40:08 -0800 Subject: [PATCH 16/61] docker permissions, docker-compose for robot only --- mushr_utils/install/mushr_install.bash | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 4791f8b..f77f1e7 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -36,9 +36,24 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then export COMPOSE_FILE=docker-compose-build.yml fi +# curl and dep keys +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 - + # Robot specific settings if [[ $REAL_ROBOT == 1 ]]; then echo Running robot specific commands + + # Don't need sudo for docker + sudo usermod -aG docker $USER + newgrp docker + + # docker-compose + sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose + sudo chmod +x /usr/local/bin/docker-compose + sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose # Need to connect to ydlidar git clone https://github.com/prl-mushr/ydlidar @@ -72,10 +87,6 @@ if [[ $REAL_ROBOT == 1 ]]; then fi # vcstool https://github.com/dirk-thomas/vcstool -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 - sudo apt-get update && sudo apt install -y python3-vcstool # Make catkin_ws outside container for easy editing From 06804621b7636ee7b8b36f1cba33256b0b8ab205 Mon Sep 17 00:00:00 2001 From: Matt Schmittle Date: Wed, 12 Jan 2022 20:47:19 -0800 Subject: [PATCH 17/61] remove redundant build --- mushr_utils/install/mushr_install.bash | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index f77f1e7..7ce8206 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -129,10 +129,6 @@ fi #echo "alias mushr_build=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash -c 'cd /root/catkin_ws && catkin_build'\" ">> ~/.bashrc #echo "alias mushr_teleop=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic roslaunch mushr_base teleop.launch\" ">> ~/.bashrc -# Build container -cd $INSTALL_PATH -docker-compose -f $COMPOSE_FILE up - # Make sure all devices are visible sudo udevadm control --reload-rules && sudo udevadm trigger From 27f3406e9377d2e774d25aca36b64aa1d0cdcd30 Mon Sep 17 00:00:00 2001 From: Matt Schmittle Date: Wed, 12 Jan 2022 20:51:13 -0800 Subject: [PATCH 18/61] remove newgrp --- mushr_utils/install/mushr_install.bash | 1 - 1 file changed, 1 deletion(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 7ce8206..075a7ec 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -48,7 +48,6 @@ if [[ $REAL_ROBOT == 1 ]]; then # Don't need sudo for docker sudo usermod -aG docker $USER - newgrp docker # docker-compose sudo curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose From 7117628896399ff26c8b0684c6bca834d3d485a0 Mon Sep 17 00:00:00 2001 From: mcdoerr Date: Mon, 24 Jan 2022 18:02:42 -0800 Subject: [PATCH 19/61] update install script for macos support --- mushr_utils/install/docker-compose-cpu.yml | 5 -- mushr_utils/install/mushr_install.bash | 60 ++++++++++++++-------- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/mushr_utils/install/docker-compose-cpu.yml b/mushr_utils/install/docker-compose-cpu.yml index aa2f8bc..57dca8f 100644 --- a/mushr_utils/install/docker-compose-cpu.yml +++ b/mushr_utils/install/docker-compose-cpu.yml @@ -16,9 +16,6 @@ services: - "/dev/vesc:/dev/vesc" - "/dev/input/js0:/dev/input/js0" 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 @@ -26,5 +23,3 @@ services: 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 075a7ec..2812348 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -1,5 +1,13 @@ #!/bin/bash +# Detect OS +export OS_TYPE="$(uname -s)" +if [[ $OS_TYPE == "Darwin" ]]; then + export SHELL_PROFILE=".zshrc" +else + export SHELL_PROFILE=".bashrc" +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 @@ -37,10 +45,12 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then fi # curl and dep keys -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 - +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 # Robot specific settings if [[ $REAL_ROBOT == 1 ]]; then @@ -86,7 +96,11 @@ if [[ $REAL_ROBOT == 1 ]]; then fi # vcstool https://github.com/dirk-thomas/vcstool -sudo apt-get update && sudo apt install -y python3-vcstool +if [[ $OS_TYPE != "Darwin" ]]; then + sudo apt-get update && sudo apt install -y python3-vcstool +else + sudo pip install vcstool +fi # Make catkin_ws outside container for easy editing if [[ ! -d "../../../../../catkin_ws" ]]; then @@ -100,17 +114,17 @@ cd $WS_PATH/catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs import < cd mushr/mushr_utils/install/ && export INSTALL_PATH=$(pwd) # Make sure environment Variables are always set -if ! grep -Fq "export INSTALL_PATH=" ~/.bashrc ; then - echo "export INSTALL_PATH=${INSTALL_PATH}" >> ~/.bashrc +if ! grep -Fq "export INSTALL_PATH=" ~/$SHELL_PROFILE ; then + echo "export INSTALL_PATH=${INSTALL_PATH}" >> ~/$SHELL_PROFILE fi -if ! grep -Fq "export REAL_ROBOT=" ~/.bashrc ; then - echo "export REAL_ROBOT=${REAL_ROBOT}" >> ~/.bashrc +if ! grep -Fq "export REAL_ROBOT=" ~/$SHELL_PROFILE ; then + echo "export REAL_ROBOT=${REAL_ROBOT}" >> ~/$SHELL_PROFILE fi -if ! grep -Fq "export WS_PATH=" ~/.bashrc ; then - echo "export WS_PATH=${WS_PATH}" >> ~/.bashrc +if ! grep -Fq "export WS_PATH=" ~/$SHELL_PROFILE ; then + echo "export WS_PATH=${WS_PATH}" >> ~/$SHELL_PROFILE fi -if ! grep -Fq "export COMPOSE_FILE=" ~/.bashrc ; then - echo "export COMPOSE_FILE=${COMPOSE_FILE}" >> ~/.bashrc +if ! grep -Fq "export COMPOSE_FILE=" ~/$SHELL_PROFILE ; then + echo "export COMPOSE_FILE=${COMPOSE_FILE}" >> ~/$SHELL_PROFILE fi # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils @@ -121,22 +135,24 @@ if [[ $REAL_ROBOT == 0 ]]; then fi # Shortcuts -if ! grep -Fq "alias mushr_noetic=" ~/.bashrc ; then - echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash\"" >> ~/.bashrc +if ! grep -Fq "alias mushr_noetic=" ~/$SHELL_PROFILE ; then + echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash\"" >> ~/$SHELL_PROFILE fi # TODO these don't work -#echo "alias mushr_build=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash -c 'cd /root/catkin_ws && catkin_build'\" ">> ~/.bashrc -#echo "alias mushr_teleop=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic roslaunch mushr_base teleop.launch\" ">> ~/.bashrc +#echo "alias mushr_build=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash -c 'cd /root/catkin_ws && catkin_build'\" ">> ~/$SHELL_PROFILE +#echo "alias mushr_teleop=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic roslaunch mushr_base teleop.launch\" ">> ~/$SHELL_PROFILE # Make sure all devices are visible -sudo udevadm control --reload-rules && sudo udevadm trigger +if [[ $REAL_ROBOT == 1 ]]; then + sudo udevadm control --reload-rules && sudo udevadm trigger +fi # Display permissions -if ! grep -Fxq "xhost + >> /dev/null" ~/.bashrc ; then - read -p $'Add "xhost +" to .bashrc? 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 + .bashrc? (y/n) ' -r +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 .bashrc - echo "xhost + >> /dev/null" >> ~/.bashrc && source ~/.bashrc + echo WARNING: Adding "xhost +" to $SHELL_PROFILE + echo "xhost + >> /dev/null" >> ~/$SHELL_PROFILE && source ~/$SHELL_PROFILE fi fi From 900945555e9f2027bffe040dd9730d1f7e673385 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 16 Mar 2022 16:24:27 -0700 Subject: [PATCH 20/61] build fixes --- mushr_utils/install/Dockerfile | 11 +++++------ mushr_utils/install/docker-compose-build.yml | 3 +-- .../install/install_scripts/mushr_install_deps.bash | 8 ++++---- .../install_scripts/mushr_install_hw_drivers.bash | 2 +- mushr_utils/install/mushr_install.bash | 13 ++++++------- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/mushr_utils/install/Dockerfile b/mushr_utils/install/Dockerfile index 7ce888c..716cd89 100644 --- a/mushr_utils/install/Dockerfile +++ b/mushr_utils/install/Dockerfile @@ -2,7 +2,6 @@ FROM ubuntu:focal MAINTAINER Matt Schmittle - ARG DEBIAN_FRONTEND=noninteractive WORKDIR /root @@ -13,19 +12,19 @@ RUN apt-get update -y \ # Adding/Running files separately allows us to cache RUN mkdir install_scripts -ARG INSTALL_PATH # ROS Noetic -ADD $INSTALL_PATH/install_scripts/mushr_install_ros.bash install_scripts/mushr_install_ros.bash +#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 # Catkin build and other deps -ADD catkin_ws catkin_ws -ADD $INSTALL_PATH/install_scripts/mushr_install_deps.bash install_scripts/mushr_install_deps.bash +ADD . catkin_ws +ADD src/mushr/mushr_utils/install/install_scripts/mushr_install_deps.bash install_scripts/mushr_install_deps.bash RUN chmod +x install_scripts/mushr_install_deps.bash && install_scripts/mushr_install_deps.bash # Hardware drivers # 1 = real robot, 0 = sim (laptop) ARG REAL -ADD $INSTALL_PATH/install_scripts/mushr_install_hw_drivers.bash install_scripts/mushr_install_hw_drivers.bash +ADD src/mushr/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash install_scripts/mushr_install_hw_drivers.bash RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.bash && install_scripts/mushr_install_hw_drivers.bash ; fi diff --git a/mushr_utils/install/docker-compose-build.yml b/mushr_utils/install/docker-compose-build.yml index 2833c12..03d0476 100644 --- a/mushr_utils/install/docker-compose-build.yml +++ b/mushr_utils/install/docker-compose-build.yml @@ -2,12 +2,11 @@ version: "3.4" services: mushr_noetic: build: - context: ${WS_PATH} + context: ${WS_PATH}/catkin_ws dockerfile: ${INSTALL_PATH}/Dockerfile args: REAL: ${REAL_ROBOT} WS_PATH: ${WS_PATH} - INSTALL_PATH: /catkin_ws/src/mushr/mushr_utils/install network_mode: "host" privileged: true devices: diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index 6459fbf..2cccd24 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -1,7 +1,7 @@ #!/bin/bash -# Install git, tkinter, wget, g++, vim, tmux, networking stuff -apt-get install -y git-all python3-tk wget g++ vim tmux net-tools iputils-ping +# Install git, tkinter, wget, g++, vim, tmux, networking stuff, apt-add-repository +apt-get install -y git-all python3-tk wget g++ vim tmux net-tools iputils-ping software-properties-common # Install vcstool, pip sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' @@ -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 +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 # Install catkin tools wget http://packages.ros.org/ros.key -O - | apt-key add - @@ -37,4 +37,4 @@ mkdir ~/.rviz cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ # Set ROS_IP -export ROS_IP=$(ifconfig wlan0 | grep "inet " | awk '{print $2}') +echo "export ROS_IP=\$(ifconfig wlan0 | grep 'inet ' | awk '{print \$2}')" >> ~/.bashrc diff --git a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash index 870e093..3568475 100644 --- a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash +++ b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash @@ -22,6 +22,6 @@ qmake -qt=qt5 make clean & make # Install push-button drivers -apt-get install Jetson.GPIO -y +pip install Jetson.GPIO -y rm /usr/bin/python ln -s /usr/bin/python3 /usr/bin/python diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 2812348..edee4b8 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -40,7 +40,9 @@ fi # Build from scratch (assumes GPU)? read -p "Build from scratch? (Not recommended, takes much longer than pulling ready-made image) (y/n) " -r echo +export BUILD_FROM_SCRATCH=0 if [[ $REPLY =~ ^[Yy]$ ]]; then + export BUILD_FROM_SCRATCH=1 export COMPOSE_FILE=docker-compose-build.yml fi @@ -114,16 +116,16 @@ cd $WS_PATH/catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs import < cd mushr/mushr_utils/install/ && export INSTALL_PATH=$(pwd) # Make sure environment Variables are always set -if ! grep -Fq "export INSTALL_PATH=" ~/$SHELL_PROFILE ; then +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 ; then +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 ; then +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 ; then +if ! grep -Fq "export COMPOSE_FILE=" ~/$SHELL_PROFILE || [[ $BUILD_FROM_SCRATCH=1 ]] ; then echo "export COMPOSE_FILE=${COMPOSE_FILE}" >> ~/$SHELL_PROFILE fi @@ -138,9 +140,6 @@ fi if ! grep -Fq "alias mushr_noetic=" ~/$SHELL_PROFILE ; then echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash\"" >> ~/$SHELL_PROFILE fi -# TODO these don't work -#echo "alias mushr_build=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash -c 'cd /root/catkin_ws && catkin_build'\" ">> ~/$SHELL_PROFILE -#echo "alias mushr_teleop=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic roslaunch mushr_base teleop.launch\" ">> ~/$SHELL_PROFILE # Make sure all devices are visible if [[ $REAL_ROBOT == 1 ]]; then From 623cc52c8664a4d07a8edbc8bc38a2ead6247f1e Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 17 Mar 2022 15:08:10 -0700 Subject: [PATCH 21/61] switch to mushr and os type builds --- mushr_utils/install/Dockerfile | 1 - mushr_utils/install/docker-compose-build.yml | 1 + mushr_utils/install/docker-compose-cpu.yml | 8 +------- mushr_utils/install/docker-compose-gpu.yml | 8 +------- mushr_utils/install/docker-compose-robot.yml | 2 +- mushr_utils/install/mushr_install.bash | 5 +++++ 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/mushr_utils/install/Dockerfile b/mushr_utils/install/Dockerfile index 716cd89..8fbd9fb 100644 --- a/mushr_utils/install/Dockerfile +++ b/mushr_utils/install/Dockerfile @@ -1,4 +1,3 @@ -#FROM timongentzsch/l4t-ubuntu20-pytorch:latest FROM ubuntu:focal MAINTAINER Matt Schmittle diff --git a/mushr_utils/install/docker-compose-build.yml b/mushr_utils/install/docker-compose-build.yml index 03d0476..9aae4da 100644 --- a/mushr_utils/install/docker-compose-build.yml +++ b/mushr_utils/install/docker-compose-build.yml @@ -1,6 +1,7 @@ version: "3.4" services: mushr_noetic: + image: mushr/mushr:${OS_TYPE} build: context: ${WS_PATH}/catkin_ws dockerfile: ${INSTALL_PATH}/Dockerfile diff --git a/mushr_utils/install/docker-compose-cpu.yml b/mushr_utils/install/docker-compose-cpu.yml index 57dca8f..a9cd340 100644 --- a/mushr_utils/install/docker-compose-cpu.yml +++ b/mushr_utils/install/docker-compose-cpu.yml @@ -1,13 +1,7 @@ version: "3.4" services: mushr_noetic: - build: - context: ${WS_PATH} - dockerfile: ${INSTALL_PATH}/Dockerfile - args: - REAL: ${REAL_ROBOT} - WS_PATH: ${WS_PATH} - INSTALL_PATH: /catkin_ws/src/mushr/mushr_utils/install + image: mushr/mushr:${OS_TYPE} network_mode: "host" privileged: true devices: diff --git a/mushr_utils/install/docker-compose-gpu.yml b/mushr_utils/install/docker-compose-gpu.yml index 2833c12..53d26b6 100644 --- a/mushr_utils/install/docker-compose-gpu.yml +++ b/mushr_utils/install/docker-compose-gpu.yml @@ -1,13 +1,7 @@ version: "3.4" services: mushr_noetic: - build: - context: ${WS_PATH} - dockerfile: ${INSTALL_PATH}/Dockerfile - args: - REAL: ${REAL_ROBOT} - WS_PATH: ${WS_PATH} - INSTALL_PATH: /catkin_ws/src/mushr/mushr_utils/install + image: mushr/mushr:${OS_TYPE} network_mode: "host" privileged: true devices: diff --git a/mushr_utils/install/docker-compose-robot.yml b/mushr_utils/install/docker-compose-robot.yml index 5720813..6792747 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: schmittle/mushr_noetic + image: mushr/mushr:robot network_mode: "host" privileged: true devices: diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index edee4b8..5299fb9 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -5,6 +5,7 @@ export OS_TYPE="$(uname -s)" if [[ $OS_TYPE == "Darwin" ]]; then export SHELL_PROFILE=".zshrc" else + export OS_TYPE="$(uname -i)" export SHELL_PROFILE=".bashrc" fi @@ -20,6 +21,7 @@ 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 else export REAL_ROBOT=0 fi @@ -128,6 +130,9 @@ 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 # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils if [[ $REAL_ROBOT == 0 ]]; then From 2fd7656b8c43f17ad393bb0b8c89737e5e7b7452 Mon Sep 17 00:00:00 2001 From: mcdoerr Date: Wed, 13 Apr 2022 08:57:39 -0700 Subject: [PATCH 22/61] default expose port 9090 for foxglove integration --- mushr_utils/install/mushr_install.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 2812348..0a1ba36 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -136,7 +136,7 @@ fi # Shortcuts if ! grep -Fq "alias mushr_noetic=" ~/$SHELL_PROFILE ; then - echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash\"" >> ~/$SHELL_PROFILE + echo "alias mushr_noetic=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run -p 9090:9090 mushr_noetic bash\"" >> ~/$SHELL_PROFILE fi # TODO these don't work #echo "alias mushr_build=\"docker-compose -f $INSTALL_PATH/$COMPOSE_FILE run mushr_noetic bash -c 'cd /root/catkin_ws && catkin_build'\" ">> ~/$SHELL_PROFILE From e2ca88bc7525248e06e004fc97e89f5c00e9fc2f Mon Sep 17 00:00:00 2001 From: mcdoerr Date: Thu, 14 Apr 2022 12:00:59 -0700 Subject: [PATCH 23/61] add new foxglove layout preset --- mushr_utils/foxglove/foxglove_layout.json | 114 ++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 mushr_utils/foxglove/foxglove_layout.json diff --git a/mushr_utils/foxglove/foxglove_layout.json b/mushr_utils/foxglove/foxglove_layout.json new file mode 100644 index 0000000..4897632 --- /dev/null +++ b/mushr_utils/foxglove/foxglove_layout.json @@ -0,0 +1,114 @@ +{ + "configById": { + "3D Panel!6ya0bo": { + "checkedKeys": [ + "name:Topics", + "t:/car/car_pose", + "t:/map", + "t:/mushr_sim/reposition", + "t:/tf_static", + "ns:/tf:map", + "ns:/tf:car/base_link", + "ns:/tf:car/back_right/wheel_link", + "ns:/tf:car/front_left/wheel_steer_link", + "ns:/tf:car/front_left/wheel_link", + "ns:/tf:car/front_right/wheel_steer_link", + "ns:/tf:car/front_right/wheel_link", + "ns:/tf:car/base_footprint", + "ns:/tf:car/odom", + "ns:/tf:car/ground_truth_base_footprint", + "ns:/tf:car/insets_link", + "ns:/tf:car/laser_link", + "ns:/tf:car/platform_link", + "ns:/tf:car/camera_bottom_screw_frame", + "ns:/tf:car/camera_link", + "ns:/tf:car/back_left/wheel_link", + "t:/tf", + "t:/robot_description" + ], + "expandedKeys": [ + "name:Topics", + "t:/tf" + ], + "followTf": "map", + "followMode": "follow", + "cameraState": { + "distance": 130.0741064822481, + "perspective": true, + "phi": 0.7321710993759635, + "targetOffset": [ + 3.0513561121739805, + -7.004265481437386, + 0 + ], + "thetaOffset": 0.04068496960546705, + "fovy": 0.7853981633974483, + "near": 0.01, + "far": 5000 + }, + "modifiedNamespaceTopics": [ + "/tf" + ], + "pinTopics": false, + "settingsByKey": { + "t:/car/car_pose": { + "size": { + "headLength": 1, + "shaftWidth": 0.3, + "headWidth": 1 + }, + "overrideColor": { + "r": 0.9019607843137255, + "g": 0.13333333333333333, + "b": 0.13333333333333333, + "a": 1 + } + } + }, + "autoSyncCameraState": false, + "autoTextBackgroundColor": true, + "diffModeEnabled": true, + "useThemeBackgroundColor": true, + "customBackgroundColor": "#000000", + "clickToPublishPoseTopic": "/move_base_simple/goal", + "clickToPublishPointTopic": "/clicked_point", + "clickToPublishPoseEstimateTopic": "/initialpose", + "clickToPublishPoseEstimateXDeviation": 0.5, + "clickToPublishPoseEstimateYDeviation": 0.5, + "clickToPublishPoseEstimateThetaDeviation": 0.2617993877991494 + }, + "Teleop!47h9exp": { + "topic": "car/foxglove/teleop", + "publishRate": 1, + "upButton": { + "field": "linear-x", + "value": 1 + }, + "downButton": { + "field": "linear-x", + "value": -1 + }, + "leftButton": { + "field": "linear-z", + "value": -1 + }, + "rightButton": { + "field": "linear-z", + "value": 1 + } + } + }, + "globalVariables": {}, + "userNodes": {}, + "linkedGlobalVariables": [], + "playbackConfig": { + "speed": 1, + "messageOrder": "receiveTime" + }, + "layout": { + "direction": "row", + "first": "3D Panel!6ya0bo", + "second": "Teleop!47h9exp", + "splitPercentage": 73.70221975258093 + } +} \ No newline at end of file From ce7055252905d831d0a7f9f44dd751ad2b9ab6bc Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 21 Apr 2022 14:00:34 -0700 Subject: [PATCH 24/61] 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 25/61] 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 26/61] 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 27/61] 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 28/61] 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 29/61] 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 30/61] 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 31/61] 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 32/61] 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 33/61] 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 34/61] 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 35/61] 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 36/61] 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 dfc609816b2ac5cf12e00de905e652c352c8b519 Mon Sep 17 00:00:00 2001 From: mcdoerr Date: Fri, 29 Apr 2022 12:56:55 -0700 Subject: [PATCH 37/61] remove devices + volumes for cpu --- mushr_utils/install/docker-compose-cpu.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mushr_utils/install/docker-compose-cpu.yml b/mushr_utils/install/docker-compose-cpu.yml index a9cd340..f299fbb 100644 --- a/mushr_utils/install/docker-compose-cpu.yml +++ b/mushr_utils/install/docker-compose-cpu.yml @@ -2,17 +2,8 @@ version: "3.4" services: mushr_noetic: image: mushr/mushr:${OS_TYPE} - network_mode: "host" privileged: true - devices: - - "/dev:/dev" - - "/dev/ydlidar:/dev/ydlidar" - - "/dev/vesc:/dev/vesc" - - "/dev/input/js0:/dev/input/js0" volumes: - - /tmp/.X11-unix:/tmp/.X11-unix - - /dev:/dev - - /dev/input:/dev/input - ${WS_PATH}/catkin_ws:/root/catkin_ws # Runtime attach environment: - DISPLAY=${DISPLAY} From aea3d47afd3c6525e004d4650b35f244f84a6984 Mon Sep 17 00:00:00 2001 From: mcdoerr Date: Mon, 30 May 2022 13:01:44 -0700 Subject: [PATCH 38/61] update foxglove config with new extension panel --- mushr_utils/foxglove/foxglove_layout.json | 151 +++++++++++++--------- 1 file changed, 87 insertions(+), 64 deletions(-) diff --git a/mushr_utils/foxglove/foxglove_layout.json b/mushr_utils/foxglove/foxglove_layout.json index 4897632..bb4b86a 100644 --- a/mushr_utils/foxglove/foxglove_layout.json +++ b/mushr_utils/foxglove/foxglove_layout.json @@ -1,84 +1,101 @@ { "configById": { - "3D Panel!6ya0bo": { - "checkedKeys": [ - "name:Topics", - "t:/car/car_pose", - "t:/map", - "t:/mushr_sim/reposition", - "t:/tf_static", - "ns:/tf:map", - "ns:/tf:car/base_link", - "ns:/tf:car/back_right/wheel_link", - "ns:/tf:car/front_left/wheel_steer_link", - "ns:/tf:car/front_left/wheel_link", - "ns:/tf:car/front_right/wheel_steer_link", - "ns:/tf:car/front_right/wheel_link", - "ns:/tf:car/base_footprint", - "ns:/tf:car/odom", - "ns:/tf:car/ground_truth_base_footprint", - "ns:/tf:car/insets_link", - "ns:/tf:car/laser_link", - "ns:/tf:car/platform_link", - "ns:/tf:car/camera_bottom_screw_frame", - "ns:/tf:car/camera_link", - "ns:/tf:car/back_left/wheel_link", - "t:/tf", - "t:/robot_description" - ], - "expandedKeys": [ - "name:Topics", - "t:/tf" - ], - "followTf": "map", - "followMode": "follow", + "3D Panel!2u81bic": { + "autoSyncCameraState": false, + "autoTextBackgroundColor": true, "cameraState": { - "distance": 130.0741064822481, - "perspective": true, - "phi": 0.7321710993759635, + "distance": 157.90940353848492, + "perspective": false, + "phi": 0.7853981633974483, "targetOffset": [ - 3.0513561121739805, - -7.004265481437386, + -7.4305506959907515, + 14.803272939370283, 0 ], - "thetaOffset": 0.04068496960546705, + "thetaOffset": 0, "fovy": 0.7853981633974483, "near": 0.01, "far": 5000 }, - "modifiedNamespaceTopics": [ - "/tf" + "checkedKeys": [ + "name:Topics", + "t:/car/particle_filter/inferred_pose", + "t:/map", + "t:/robot_description", + "t:/controller/path/waypoints", + "t:/controller/path/poses", + "t:/controller/path/selected_waypoint", + "t:/move_base_simple/goal", + "t:/car/car_pose", + "t:/car/scan" ], + "clickToPublishPoseTopic": "/foxglove/pose_stamped", + "clickToPublishPointTopic": "/clicked_point", + "clickToPublishPoseEstimateTopic": "/initialpose", + "clickToPublishPoseEstimateXDeviation": 0.5, + "clickToPublishPoseEstimateYDeviation": 0.5, + "clickToPublishPoseEstimateThetaDeviation": 0.26179939, + "customBackgroundColor": "#000000", + "diffModeEnabled": true, + "expandedKeys": [ + "name:Topics" + ], + "followMode": "follow", + "modifiedNamespaceTopics": [], "pinTopics": false, "settingsByKey": { - "t:/car/car_pose": { - "size": { - "headLength": 1, - "shaftWidth": 0.3, - "headWidth": 1 - }, + "t:/car/particle_filter/inferred_pose": { "overrideColor": { - "r": 0.9019607843137255, - "g": 0.13333333333333333, + "r": 1, + "g": 0, + "b": 0, + "a": 1 + } + }, + "t:/move_base_simple/goal": { + "overrideColor": { + "r": 0, + "g": 1, "b": 0.13333333333333333, "a": 1 } + }, + "t:/controller/path/selected_waypoint": { + "overrideColor": { + "r": 1, + "g": 0, + "b": 0.6, + "a": 1 + } + }, + "t:/car/car_pose": { + "overrideColor": { + "r": 1, + "g": 0, + "b": 0, + "a": 1 + }, + "size": { + "shaftLength": 3, + "shaftWidth": 0.25, + "headWidth": 1, + "headLength": 0.6 + } + }, + "t:/car/scan": { + "colorMode": { + "mode": "turbo", + "colorField": "x" + } } }, - "autoSyncCameraState": false, - "autoTextBackgroundColor": true, - "diffModeEnabled": true, "useThemeBackgroundColor": true, - "customBackgroundColor": "#000000", - "clickToPublishPoseTopic": "/move_base_simple/goal", - "clickToPublishPointTopic": "/clicked_point", - "clickToPublishPoseEstimateTopic": "/initialpose", - "clickToPublishPoseEstimateXDeviation": 0.5, - "clickToPublishPoseEstimateYDeviation": 0.5, - "clickToPublishPoseEstimateThetaDeviation": 0.2617993877991494 + "followTf": "map", + "colorOverrideByVariable": {}, + "ignoreColladaUpAxis": true }, - "Teleop!47h9exp": { - "topic": "car/foxglove/teleop", + "Teleop!1m7m4ij": { + "topic": "/car/foxglove/teleop", "publishRate": 1, "upButton": { "field": "linear-x", @@ -96,7 +113,8 @@ "field": "linear-z", "value": 1 } - } + }, + "MushrTeleop.MushrTeleop!4080ms0": {} }, "globalVariables": {}, "userNodes": {}, @@ -106,9 +124,14 @@ "messageOrder": "receiveTime" }, "layout": { + "first": "3D Panel!2u81bic", + "second": { + "first": "Teleop!1m7m4ij", + "second": "MushrTeleop.MushrTeleop!4080ms0", + "direction": "column", + "splitPercentage": 60.111111111111114 + }, "direction": "row", - "first": "3D Panel!6ya0bo", - "second": "Teleop!47h9exp", - "splitPercentage": 73.70221975258093 + "splitPercentage": 75.33415737065557 } } \ No newline at end of file From 9e8627787d6089ab8a082b79f26aa86be62d9a25 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Tue, 31 May 2022 12:19:02 -0700 Subject: [PATCH 39/61] 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 From 89764e6727c0783f5bb1648a28765134e42a79d7 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 18 Jun 2022 18:22:38 -0700 Subject: [PATCH 40/61] fix install issues --- mushr_utils/install/docker-compose-build.yml | 2 -- mushr_utils/install/mushr_install.bash | 24 ++++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/mushr_utils/install/docker-compose-build.yml b/mushr_utils/install/docker-compose-build.yml index eb22c6f..d3789f7 100644 --- a/mushr_utils/install/docker-compose-build.yml +++ b/mushr_utils/install/docker-compose-build.yml @@ -1,14 +1,12 @@ version: "3.4" services: mushr_noetic: - #image: mushr/mushr:${MUSHR_OS_TYPE} build: context: ${MUSHR_WS_PATH}/catkin_ws dockerfile: ${MUSHR_INSTALL_PATH}/Dockerfile args: REAL: ${REAL_ROBOT} MUSHR_WS_PATH: ${MUSHR_WS_PATH} - network_mode: "host" privileged: true devices: - "/dev:/dev" diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 4e1c2d0..9eb8ebf 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -16,8 +16,10 @@ 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_COMPOSE_FILE=docker-compose-robot.yml else export MUSHR_REAL_ROBOT=0 + export MUSHR_COMPOSE_FILE=docker-compose-cpu.yml fi # Build from scratch @@ -95,18 +97,16 @@ 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 # Make custom mushr_noetic script -if [[ ! -f "${MUSHR_INSTALL_PATH}/mushr_noetic" ]]; then - 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 +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/ # If laptop, don't build realsense2_camera, ydlidar, or push_button_utils if [[ $MUSHR_REAL_ROBOT == 0 ]]; then From b88246d0b4ba4948d5abad57c08712e9c32e2093 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 18 Jun 2022 18:44:30 -0700 Subject: [PATCH 41/61] add image tag back in --- mushr_utils/install/docker-compose-build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mushr_utils/install/docker-compose-build.yml b/mushr_utils/install/docker-compose-build.yml index d3789f7..00c6ac4 100644 --- a/mushr_utils/install/docker-compose-build.yml +++ b/mushr_utils/install/docker-compose-build.yml @@ -1,6 +1,7 @@ version: "3.4" services: mushr_noetic: + image: mushr/mushr:${MUSHR_OS_TYPE} build: context: ${MUSHR_WS_PATH}/catkin_ws dockerfile: ${MUSHR_INSTALL_PATH}/Dockerfile From 237567a8775d354e5462845a9da6efe3583626f6 Mon Sep 17 00:00:00 2001 From: eva Date: Thu, 30 Jun 2022 09:50:57 -0700 Subject: [PATCH 42/61] fix build scripts --- mushr_utils/install/docker-compose-build-cpu.yml | 16 ++++++++++++++++ ...-build.yml => docker-compose-build-robot.yml} | 2 +- mushr_utils/install/mushr_install.bash | 6 +++++- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 mushr_utils/install/docker-compose-build-cpu.yml rename mushr_utils/install/{docker-compose-build.yml => docker-compose-build-robot.yml} (96%) diff --git a/mushr_utils/install/docker-compose-build-cpu.yml b/mushr_utils/install/docker-compose-build-cpu.yml new file mode 100644 index 0000000..682996d --- /dev/null +++ b/mushr_utils/install/docker-compose-build-cpu.yml @@ -0,0 +1,16 @@ +version: "3.4" +services: + mushr_noetic: + image: mushr/mushr:${MUSHR_OS_TYPE} + privileged: true + build: + context: ${MUSHR_WS_PATH}/catkin_ws + dockerfile: ${MUSHR_INSTALL_PATH}/Dockerfile + args: + REAL: ${MUSHR_REAL_ROBOT} + MUSHR_WS_PATH: ${MUSHR_WS_PATH} + volumes: + - ${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-build.yml b/mushr_utils/install/docker-compose-build-robot.yml similarity index 96% rename from mushr_utils/install/docker-compose-build.yml rename to mushr_utils/install/docker-compose-build-robot.yml index 00c6ac4..1d54e9d 100644 --- a/mushr_utils/install/docker-compose-build.yml +++ b/mushr_utils/install/docker-compose-build-robot.yml @@ -6,7 +6,7 @@ services: context: ${MUSHR_WS_PATH}/catkin_ws dockerfile: ${MUSHR_INSTALL_PATH}/Dockerfile args: - REAL: ${REAL_ROBOT} + REAL: ${MUSHR_REAL_ROBOT} MUSHR_WS_PATH: ${MUSHR_WS_PATH} privileged: true devices: diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 9eb8ebf..adb2f12 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -28,7 +28,11 @@ echo export BUILD_FROM_SCRATCH=0 if [[ $REPLY =~ ^[Yy]$ ]]; then export BUILD_FROM_SCRATCH=1 - export MUSHR_COMPOSE_FILE=docker-compose-build.yml + if [[ $MUSHR_REAL_ROBOT == 1 ]]; then + export MUSHR_COMPOSE_FILE=docker-compose-build-robot.yml + else + export MUSHR_COMPOSE_FILE=docker-compose-build-cpu.yml + fi fi # curl and dep keys From ca022dc072b85a9b6ec5e5b506a4464dbc143504 Mon Sep 17 00:00:00 2001 From: schmittlema Date: Mon, 4 Jul 2022 15:09:06 -0700 Subject: [PATCH 43/61] ws_path --> mushr_ws_path --- mushr_utils/install/docker-compose-robot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mushr_utils/install/docker-compose-robot.yml b/mushr_utils/install/docker-compose-robot.yml index 492b455..829372a 100644 --- a/mushr_utils/install/docker-compose-robot.yml +++ b/mushr_utils/install/docker-compose-robot.yml @@ -22,7 +22,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 From a39919d2bf5a68173615a4ec3775d1d3ab5428c2 Mon Sep 17 00:00:00 2001 From: Matt Schmittle Date: Wed, 17 Aug 2022 09:59:41 -0700 Subject: [PATCH 44/61] install realsense2camera --- .../install/install_scripts/mushr_install_hw_drivers.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash index 3568475..ded2950 100644 --- a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash +++ b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash @@ -11,6 +11,7 @@ add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo bionic ma apt-get install rsync -y apt-get install librealsense2-utils librealsense2-dev -y +apt-get install ros-noetic-realsense2-camera -y # Install BLDC tool. Following commands adapted from: # https://github.com/jetsonhacks/installBLDC/blob/master/installBLDC.sh From c22b9c557646b95fc72277e3253fd66c37c58434 Mon Sep 17 00:00:00 2001 From: Markus Schiffer <47703802+MarkusSchiffer@users.noreply.github.com> Date: Mon, 17 Apr 2023 14:12:04 -0700 Subject: [PATCH 45/61] fixed build from scratch on robot --- mushr_utils/install/Dockerfile | 13 ++++++++++--- mushr_utils/install/docker-compose-build-cpu.yml | 1 + mushr_utils/install/docker-compose-build-robot.yml | 2 ++ mushr_utils/install/docker-compose-cpu.yml | 1 + mushr_utils/install/docker-compose-robot.yml | 1 + .../install/install_scripts/mushr_install_deps.bash | 12 ++++++------ .../install_scripts/mushr_install_hw_drivers.bash | 2 +- nav-repos.yaml | 8 ++++++++ 8 files changed, 30 insertions(+), 10 deletions(-) diff --git a/mushr_utils/install/Dockerfile b/mushr_utils/install/Dockerfile index b8b867f..61cac64 100644 --- a/mushr_utils/install/Dockerfile +++ b/mushr_utils/install/Dockerfile @@ -1,7 +1,9 @@ FROM ubuntu:focal -MAINTAINER Matt Schmittle +LABEL maintainer="Matt Schmittle " ARG DEBIAN_FRONTEND=noninteractive +# 1 = real robot, 0 = sim (laptop) +ARG REAL WORKDIR /root # Install docker deps for mushr_install @@ -22,7 +24,12 @@ ADD src/mushr/mushr_utils/install/install_scripts/mushr_install_deps.bash instal RUN chmod +x install_scripts/mushr_install_deps.bash && install_scripts/mushr_install_deps.bash # Hardware drivers -# 1 = real robot, 0 = sim (laptop) -ARG REAL ADD src/mushr/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash install_scripts/mushr_install_hw_drivers.bash RUN if [ "$REAL" = 1 ] ; then chmod +x install_scripts/mushr_install_hw_drivers.bash && install_scripts/mushr_install_hw_drivers.bash ; fi + +# Set ROS_IP +RUN if [ "$REAL" = 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 diff --git a/mushr_utils/install/docker-compose-build-cpu.yml b/mushr_utils/install/docker-compose-build-cpu.yml index 682996d..27ab532 100644 --- a/mushr_utils/install/docker-compose-build-cpu.yml +++ b/mushr_utils/install/docker-compose-build-cpu.yml @@ -14,3 +14,4 @@ services: environment: - DISPLAY=${DISPLAY} - QT_X11_NO_MITSHM=1 + - MUSHR_REAL_ROBOT=${MUSHR_REAL_ROBOT} diff --git a/mushr_utils/install/docker-compose-build-robot.yml b/mushr_utils/install/docker-compose-build-robot.yml index 1d54e9d..1370133 100644 --- a/mushr_utils/install/docker-compose-build-robot.yml +++ b/mushr_utils/install/docker-compose-build-robot.yml @@ -2,6 +2,7 @@ version: "3.4" services: mushr_noetic: image: mushr/mushr:${MUSHR_OS_TYPE} + network_mode: "host" build: context: ${MUSHR_WS_PATH}/catkin_ws dockerfile: ${MUSHR_INSTALL_PATH}/Dockerfile @@ -33,3 +34,4 @@ services: - QT_X11_NO_MITSHM=1 - NEVIAID_DRIVER_CAPABILITIES=all - NVIDIA_VISIBLE_DEVICES=all + - MUSHR_REAL_ROBOT=${MUSHR_REAL_ROBOT} diff --git a/mushr_utils/install/docker-compose-cpu.yml b/mushr_utils/install/docker-compose-cpu.yml index 1318d5f..90cb18f 100644 --- a/mushr_utils/install/docker-compose-cpu.yml +++ b/mushr_utils/install/docker-compose-cpu.yml @@ -8,3 +8,4 @@ services: environment: - DISPLAY=${DISPLAY} - QT_X11_NO_MITSHM=1 + - MUSHR_REAL_ROBOT=${MUSHR_REAL_ROBOT} diff --git a/mushr_utils/install/docker-compose-robot.yml b/mushr_utils/install/docker-compose-robot.yml index 829372a..2bf9cf5 100644 --- a/mushr_utils/install/docker-compose-robot.yml +++ b/mushr_utils/install/docker-compose-robot.yml @@ -28,3 +28,4 @@ services: - QT_X11_NO_MITSHM=1 - NEVIAID_DRIVER_CAPABILITIES=all - NVIDIA_VISIBLE_DEVICES=all + - MUSHR_REAL_ROBOT=${MUSHR_REAL_ROBOT} diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index 69882fa..3cf461e 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -18,7 +18,7 @@ apt-get update apt-get install -y python3-catkin-tools # Install Cython, PyTorch 1.10 at least! -pip3 install Cython torch torchvision torchaudio numpy scipy progress --upgrade +pip3 install Cython torch torchvision torchaudio numpy scipy networkx progress --upgrade # Create OpenCV symbolic link ln -s /usr/include/opencv4 /usr/include/opencv @@ -37,8 +37,8 @@ mkdir ~/.rviz cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ # Set ROS_IP -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 +# 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 diff --git a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash index ded2950..8743fa1 100644 --- a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash +++ b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash @@ -23,6 +23,6 @@ qmake -qt=qt5 make clean & make # Install push-button drivers -pip install Jetson.GPIO -y +pip install Jetson.GPIO rm /usr/bin/python ln -s /usr/bin/python3 /usr/bin/python diff --git a/nav-repos.yaml b/nav-repos.yaml index 9164271..9a02eed 100644 --- a/nav-repos.yaml +++ b/nav-repos.yaml @@ -7,3 +7,11 @@ repositories: type: git url: https://github.com/prl-mushr/mushr_rhc.git version: noetic + mushr_gp: + type: git + url: https://github.com/prl-mushr/mushr_gp.git + version: main + mushr_gprm: + type: git + url: https://github.com/prl-mushr/mushr_gprm.git + version: master From b9211002e72c5112a78bf13ec06aed1845fa4900 Mon Sep 17 00:00:00 2001 From: Markus Schiffer <47703802+MarkusSchiffer@users.noreply.github.com> Date: Mon, 17 Apr 2023 14:34:09 -0700 Subject: [PATCH 46/61] removed commented out section --- .../install/install_scripts/mushr_install_deps.bash | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index 3cf461e..021a67a 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -35,10 +35,3 @@ rm -rf range_libc # Create default RVIZ setup mkdir ~/.rviz cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ - -# Set ROS_IP -# 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 127a4a5158639d91261ea2e97fc7767685b3ce8d Mon Sep 17 00:00:00 2001 From: Markus Schiffer <47703802+MarkusSchiffer@users.noreply.github.com> Date: Tue, 2 May 2023 22:41:40 -0700 Subject: [PATCH 47/61] made install changes for OSX, removed python2 for CPU --- .../install/install_scripts/mushr_install_deps.bash | 3 +++ .../install_scripts/mushr_install_hw_drivers.bash | 2 -- mushr_utils/install/mushr_install.bash | 10 +++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mushr_utils/install/install_scripts/mushr_install_deps.bash b/mushr_utils/install/install_scripts/mushr_install_deps.bash index 021a67a..eb2d7ac 100644 --- a/mushr_utils/install/install_scripts/mushr_install_deps.bash +++ b/mushr_utils/install/install_scripts/mushr_install_deps.bash @@ -32,6 +32,9 @@ python3 setup.py install cd ~/catkin_ws/src rm -rf range_libc +# Remove Python2 +apt-get install -y python-is-python3 + # Create default RVIZ setup mkdir ~/.rviz cp ~/catkin_ws/src/mushr/mushr_utils/rviz/default.rviz ~/.rviz/ diff --git a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash index 8743fa1..d24224f 100644 --- a/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash +++ b/mushr_utils/install/install_scripts/mushr_install_hw_drivers.bash @@ -24,5 +24,3 @@ make clean & make # Install push-button drivers pip install Jetson.GPIO -rm /usr/bin/python -ln -s /usr/bin/python3 /usr/bin/python diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index adb2f12..c5e4f08 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -107,7 +107,15 @@ 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 +if [ \$# == 0 ] || [ \$1 == "run" ]; +then + docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash +elif [ \$1 == "build" ]; +then + docker-compose -f $MUSHR_INSTALL_PATH/$MUSHR_COMPOSE_FILE build --no-cache mushr_noetic +else + echo "Invalid command supplied to mushr_noetic script; valid commands are 'run' or 'build'" +fi EOF chmod +x ${MUSHR_INSTALL_PATH}/mushr_noetic sudo ln -s ${MUSHR_INSTALL_PATH}/mushr_noetic /usr/local/bin/ From f71d079d1568ad87f2395be229ee7f0a76b44727 Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Fri, 2 Jun 2023 20:10:49 -0700 Subject: [PATCH 48/61] Add initial devcontainer config --- .devcontainer/Dockerfile | 17 +++++++++++++++++ .devcontainer/devcontainer.json | 15 +++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..f86a7d4 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,17 @@ +FROM osrf/ros:noetic-desktop-full + +# Copy library scripts to execute +COPY library-scripts/*.sh /tmp/library-scripts/ + +# [Option] Install zsh +ARG INSTALL_ZSH="true" +# [Option] Upgrade OS packages to their latest versions +ARG UPGRADE_PACKAGES="true" +# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + + +# Remove library scripts for final image +RUN rm -rf /tmp/library-scripts \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..263ef80 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,15 @@ +{ + "image": "osrf/ros:noetic-desktop-full", + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "username": "vscode", + "userUid": "1001", + "userGid": "1001" + }, + "ghcr.io/devcontainers/features/docker-in-docker:2": {} + }, + "remoteUser": "vscode", + "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/catkin_ws/src/mushr,type=bind", + "workspaceFolder": "/home/vscode/catkin_ws", + "postCreateCommand": "sudo chown -R vscode:vscode /home/vscode/catkin_ws" +} From 65602670d3096672ddf2db0d345fe59888cd7e8f Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Fri, 2 Jun 2023 22:24:33 -0700 Subject: [PATCH 49/61] Update mushr_noetic to support 'run' and use it --- .devcontainer/devcontainer.json | 2 +- mushr_utils/install/mushr_install.bash | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 263ef80..8966762 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,5 +11,5 @@ "remoteUser": "vscode", "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/catkin_ws/src/mushr,type=bind", "workspaceFolder": "/home/vscode/catkin_ws", - "postCreateCommand": "sudo chown -R vscode:vscode /home/vscode/catkin_ws" + "postCreateCommand": "cd /home/vscode/catkin_ws/src && ./mushr/mushr_utils/install/mushr_install.bash && sudo chown -R vscode:vscode /home/vscode/catkin_ws" } diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index c5e4f08..c408dc1 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -109,7 +109,12 @@ export MUSHR_COMPOSE_FILE=${MUSHR_COMPOSE_FILE} export MUSHR_OS_TYPE=${MUSHR_OS_TYPE} if [ \$# == 0 ] || [ \$1 == "run" ]; then - docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash + if [ $# == 2 ]; + then + docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash -ic "\${2}" + else + docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash + fi elif [ \$1 == "build" ]; then docker-compose -f $MUSHR_INSTALL_PATH/$MUSHR_COMPOSE_FILE build --no-cache mushr_noetic From 99c043c059507669de12375a5b032e1a31ea030c Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Fri, 2 Jun 2023 22:26:25 -0700 Subject: [PATCH 50/61] Add example vscode tasks config --- .vscode/tasks.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .vscode/tasks.json diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..3e0f4f0 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,16 @@ +{ + "tasks": [ + { + "label": "Roslaunch teleop.launch", + "type": "shell", + "command": "mushr_noetic run 'source ~/.bashrc && roslaunch mushr_sim teleop.launch'", + "problemMatcher": [] + }, + { + "label": "Start Foxglove Studio server", + "type": "shell", + "command": "docker run --rm -p \"8080:8080\" ghcr.io/foxglove/studio:latest", + "problemMatcher": [] + } + ] +} \ No newline at end of file From c8de37007a79ddb14899e93fefcfb8554beda506 Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Sat, 3 Jun 2023 09:23:12 -0700 Subject: [PATCH 51/61] Support --trivial-only in mushr_install.bash --- .devcontainer/devcontainer.json | 2 +- mushr_utils/install/mushr_install.bash | 25 +++++++++++++++++++++---- mushr_utils/install/mushr_noetic | 19 +++++++++++++++++++ 3 files changed, 41 insertions(+), 5 deletions(-) create mode 100755 mushr_utils/install/mushr_noetic diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8966762..dd85ae8 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,5 +11,5 @@ "remoteUser": "vscode", "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/catkin_ws/src/mushr,type=bind", "workspaceFolder": "/home/vscode/catkin_ws", - "postCreateCommand": "cd /home/vscode/catkin_ws/src && ./mushr/mushr_utils/install/mushr_install.bash && sudo chown -R vscode:vscode /home/vscode/catkin_ws" + "postCreateCommand": "sudo chown -R vscode:vscode /home/vscode/catkin_ws && ln -s /home/vscode/catkin_ws/src/mushr/.vscode /home/vscode/catkin_ws/ && cd /home/vscode/catkin_ws/src && ./mushr/mushr_utils/install/mushr_install.bash --trivial-only && mushr_noetic run 'cd catkin_ws && catkin build'" } diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index c408dc1..5f7fbbb 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -1,6 +1,15 @@ #!/bin/bash pushd `dirname $0` +# Parse args +TRIVIAL_ONLY=0 +for arg in "$@"; do + if [ "$arg" == "--trivial-only" ]; then + TRIVIAL_ONLY=1 + break + fi +done + # Detect OS export MUSHR_OS_TYPE="$(uname -s)" @@ -12,8 +21,12 @@ fi 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 [[ $TRIVIAL_ONLY == 0 ]]; then + read -p "Are you installing on robot and need all the sensor drivers? (y/n) " -r + echo +else + REPLY="n" +fi if [[ $REPLY =~ ^[Yy]$ ]]; then export MUSHR_REAL_ROBOT=1 export MUSHR_COMPOSE_FILE=docker-compose-robot.yml @@ -23,8 +36,12 @@ else fi # Build from scratch -read -p "Build from scratch? (Not recommended, takes much longer than pulling ready-made image) (y/n) " -r -echo +if [[ $TRIVIAL_ONLY == 0 ]]; then + read -p "Build from scratch? (Not recommended, takes much longer than pulling ready-made image) (y/n) " -r + echo +else + REPLY="n" +fi export BUILD_FROM_SCRATCH=0 if [[ $REPLY =~ ^[Yy]$ ]]; then export BUILD_FROM_SCRATCH=1 diff --git a/mushr_utils/install/mushr_noetic b/mushr_utils/install/mushr_noetic new file mode 100755 index 0000000..2d5ccfb --- /dev/null +++ b/mushr_utils/install/mushr_noetic @@ -0,0 +1,19 @@ +export MUSHR_INSTALL_PATH=/home/vscode/catkin_ws/src/mushr/mushr_utils/install +export MUSHR_REAL_ROBOT=0 +export MUSHR_WS_PATH=/home/vscode +export MUSHR_COMPOSE_FILE=docker-compose-cpu.yml +export MUSHR_OS_TYPE=x86_64 +if [ $# == 0 ] || [ $1 == "run" ]; +then + if [ 1 == 2 ]; + then + docker-compose -f $MUSHR_INSTALL_PATH/$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash -ic "${2}" + else + docker-compose -f $MUSHR_INSTALL_PATH/$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash + fi +elif [ $1 == "build" ]; +then + docker-compose -f /home/vscode/catkin_ws/src/mushr/mushr_utils/install/docker-compose-cpu.yml build --no-cache mushr_noetic +else + echo "Invalid command supplied to mushr_noetic script; valid commands are 'run' or 'build'" +fi From a74409190c1826b6827cb860fc13f3b15921a694 Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Sat, 3 Jun 2023 10:25:09 -0700 Subject: [PATCH 52/61] Bug fix: set shebang line --- mushr_utils/install/mushr_install.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mushr_utils/install/mushr_install.bash b/mushr_utils/install/mushr_install.bash index 5f7fbbb..7b8bf8d 100755 --- a/mushr_utils/install/mushr_install.bash +++ b/mushr_utils/install/mushr_install.bash @@ -119,20 +119,21 @@ cd $MUSHR_WS_PATH/catkin_ws/src/ && vcs import < mushr/base-repos.yaml && vcs im # Make custom mushr_noetic script cat <<- EOF > ${MUSHR_INSTALL_PATH}/mushr_noetic +#!/bin/bash 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} -if [ \$# == 0 ] || [ \$1 == "run" ]; +if [[ \$# == 0 ]] || [[ \$1 == "run" ]]; then - if [ $# == 2 ]; + if [[ \$# == 2 ]]; then docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash -ic "\${2}" else docker-compose -f \$MUSHR_INSTALL_PATH/\$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash fi -elif [ \$1 == "build" ]; +elif [[ \$1 == "build" ]]; then docker-compose -f $MUSHR_INSTALL_PATH/$MUSHR_COMPOSE_FILE build --no-cache mushr_noetic else From e4e60410282e8afc3182e83ebb8780dc75a1402d Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Sat, 3 Jun 2023 10:29:06 -0700 Subject: [PATCH 53/61] Remove autogenerated mushr_noetic --- mushr_utils/install/mushr_noetic | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100755 mushr_utils/install/mushr_noetic diff --git a/mushr_utils/install/mushr_noetic b/mushr_utils/install/mushr_noetic deleted file mode 100755 index 2d5ccfb..0000000 --- a/mushr_utils/install/mushr_noetic +++ /dev/null @@ -1,19 +0,0 @@ -export MUSHR_INSTALL_PATH=/home/vscode/catkin_ws/src/mushr/mushr_utils/install -export MUSHR_REAL_ROBOT=0 -export MUSHR_WS_PATH=/home/vscode -export MUSHR_COMPOSE_FILE=docker-compose-cpu.yml -export MUSHR_OS_TYPE=x86_64 -if [ $# == 0 ] || [ $1 == "run" ]; -then - if [ 1 == 2 ]; - then - docker-compose -f $MUSHR_INSTALL_PATH/$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash -ic "${2}" - else - docker-compose -f $MUSHR_INSTALL_PATH/$MUSHR_COMPOSE_FILE run -p 9090:9090 mushr_noetic bash - fi -elif [ $1 == "build" ]; -then - docker-compose -f /home/vscode/catkin_ws/src/mushr/mushr_utils/install/docker-compose-cpu.yml build --no-cache mushr_noetic -else - echo "Invalid command supplied to mushr_noetic script; valid commands are 'run' or 'build'" -fi From 82dd152908ec6474f1bc2527a3e1acb35b62228a Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Mon, 5 Jun 2023 16:52:48 -0700 Subject: [PATCH 54/61] Remove unused dockerfile --- .devcontainer/Dockerfile | 17 ----------------- .devcontainer/devcontainer.json | 4 ++-- 2 files changed, 2 insertions(+), 19 deletions(-) delete mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index f86a7d4..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM osrf/ros:noetic-desktop-full - -# Copy library scripts to execute -COPY library-scripts/*.sh /tmp/library-scripts/ - -# [Option] Install zsh -ARG INSTALL_ZSH="true" -# [Option] Upgrade OS packages to their latest versions -ARG UPGRADE_PACKAGES="true" -# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. -ARG USERNAME=vscode -ARG USER_UID=1000 -ARG USER_GID=$USER_UID - - -# Remove library scripts for final image -RUN rm -rf /tmp/library-scripts \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index dd85ae8..987f214 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,8 +3,8 @@ "features": { "ghcr.io/devcontainers/features/common-utils:2": { "username": "vscode", - "userUid": "1001", - "userGid": "1001" + "userUid": "1000", + "userGid": "1000" }, "ghcr.io/devcontainers/features/docker-in-docker:2": {} }, From 160965269aa4349de21eb5b2c03288294efe23fb Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Mon, 5 Jun 2023 17:49:01 -0700 Subject: [PATCH 55/61] Refactor --- .devcontainer/build.sh | 5 +++++ .devcontainer/devcontainer.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 .devcontainer/build.sh diff --git a/.devcontainer/build.sh b/.devcontainer/build.sh new file mode 100755 index 0000000..4d291bf --- /dev/null +++ b/.devcontainer/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd /home/vscode/catkin_ws/src; +./mushr/mushr_utils/install/mushr_install.bash --trivial-only; +mushr_noetic run 'cd catkin_ws && catkin build' diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 987f214..c231c5c 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -11,5 +11,5 @@ "remoteUser": "vscode", "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/catkin_ws/src/mushr,type=bind", "workspaceFolder": "/home/vscode/catkin_ws", - "postCreateCommand": "sudo chown -R vscode:vscode /home/vscode/catkin_ws && ln -s /home/vscode/catkin_ws/src/mushr/.vscode /home/vscode/catkin_ws/ && cd /home/vscode/catkin_ws/src && ./mushr/mushr_utils/install/mushr_install.bash --trivial-only && mushr_noetic run 'cd catkin_ws && catkin build'" + "postCreateCommand": "sudo chown -R vscode:vscode . && ln -s ${containerWorkspaceFolder}/src/mushr/.vscode ${containerWorkspaceFolder} && ./src/mushr/.devcontainer/build.sh" } From 6ffc1ea2f3f4a951ff8dd4b3120c5c3779388922 Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Tue, 6 Jun 2023 11:47:58 -0700 Subject: [PATCH 56/61] Add initial workflow config & test --- .devcontainer/smoke_test.sh | 14 ++++++++++++++ .github/workflows/devcontainer-test.sh | 21 +++++++++++++++++++++ .github/workflows/test-pr.yaml | 16 ++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100755 .devcontainer/smoke_test.sh create mode 100755 .github/workflows/devcontainer-test.sh create mode 100644 .github/workflows/test-pr.yaml diff --git a/.devcontainer/smoke_test.sh b/.devcontainer/smoke_test.sh new file mode 100755 index 0000000..cd0291a --- /dev/null +++ b/.devcontainer/smoke_test.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e + +mushr_noetic run 'source ~/.bashrc && roslaunch mushr_sim teleop.launch' > /tmp/output & +sleep 5 +if tail -n 1 /tmp/output | grep -q "Rosbridge WebSocket server started at ws://0.0.0.0:9090"; then + echo "✅ smoke_test passed" + exit 0; +else + # Print output of `roslaunch mushr_sim teleop.launch` for debugging + cat /tmp/output + echo "❌ smoke_test failed" + exit 1; +fi \ No newline at end of file diff --git a/.github/workflows/devcontainer-test.sh b/.github/workflows/devcontainer-test.sh new file mode 100755 index 0000000..a04022c --- /dev/null +++ b/.github/workflows/devcontainer-test.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -e + +SRC_DIR="$(pwd)" + +echo "Running Smoke Test" + +# Build +export DOCKER_BUILDKIT=1 +echo "(*) Installing @devcontainer/cli" +npm install -g @devcontainers/cli + +echo "Building Dev Container" +ID_LABEL="test-container=mushr" +devcontainer up --id-label ${ID_LABEL} --workspace-folder "${SRC_DIR}" + +# Test +devcontainer exec --workspace-folder "${SRC_DIR}" --id-label ${ID_LABEL} /bin/sh -c './src/mushr/.devcontainer/smoke_test.sh' + +# Clean up +docker rm -f $(docker container ls -f "label=${ID_LABEL}" -q) diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml new file mode 100644 index 0000000..2cb966d --- /dev/null +++ b/.github/workflows/test-pr.yaml @@ -0,0 +1,16 @@ +name: "CI" +on: + pull_request: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout main + id: checkout_release + uses: actions/checkout@v3 + - name: Devcontainer container smoke test + id: test_devcontainer + shell: bash + run: ./.github/workflows/devcontainer-test.sh \ No newline at end of file From dd25d4c114f128d2b10d44521e6cee80810c7532 Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Tue, 6 Jun 2023 22:51:43 -0700 Subject: [PATCH 57/61] Add roslaunch-teleop-test and start-foxglove-studio tests to smoke_test.sh script. --- .devcontainer/smoke_test.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.devcontainer/smoke_test.sh b/.devcontainer/smoke_test.sh index cd0291a..1769ac5 100755 --- a/.devcontainer/smoke_test.sh +++ b/.devcontainer/smoke_test.sh @@ -1,14 +1,23 @@ #!/bin/bash set -e -mushr_noetic run 'source ~/.bashrc && roslaunch mushr_sim teleop.launch' > /tmp/output & +mushr_noetic run 'source ~/.bashrc && roslaunch mushr_sim teleop.launch' > /tmp/output_roslaunch & sleep 5 -if tail -n 1 /tmp/output | grep -q "Rosbridge WebSocket server started at ws://0.0.0.0:9090"; then - echo "✅ smoke_test passed" - exit 0; +if tail -n 1 /tmp/output_roslaunch | grep -q "Rosbridge WebSocket server started at ws://0.0.0.0:9090"; then + echo "✅ roslaunch-teleop-test passed" else - # Print output of `roslaunch mushr_sim teleop.launch` for debugging - cat /tmp/output - echo "❌ smoke_test failed" + cat /tmp/output_roslaunch # print output for debugging purposes + echo "❌ roslaunch-teleop-test failed" exit 1; -fi \ No newline at end of file +fi + +docker run --rm -p "8080:8080" ghcr.io/foxglove/studio:latest & +sleep 10; +if curl -sSf http://localhost:8080 >/dev/null; then + echo "✅ start-foxglove-studio passed" +else + echo "❌ start-foxglove-studio failed" + exit 1; +fi + +exit 0; \ No newline at end of file From 7398b4a06bd950706cbed3c9b00c87898ef7b045 Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Wed, 7 Jun 2023 12:19:23 -0700 Subject: [PATCH 58/61] Add webserver --- .devcontainer/Caddyfile | 30 ++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 5 +++-- .devcontainer/install.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/Caddyfile create mode 100755 .devcontainer/install.sh diff --git a/.devcontainer/Caddyfile b/.devcontainer/Caddyfile new file mode 100644 index 0000000..c107e9c --- /dev/null +++ b/.devcontainer/Caddyfile @@ -0,0 +1,30 @@ +(globals) { + encode gzip + + @http_scheme { + expression {http.request.scheme}=="https" || {header.X-Forwarded-Scheme}=="https" || {header.X-Forwarded-Proto}=="https" + } + vars @http_scheme WsScheme "wss" + vars WsScheme "ws" + + @host_forwarded { + header X-Forwarded-Host * + } + vars @host_forwarded ReqHost {header.X-Forwarded-Host} + vars ReqHost {http.request.hostport} + + @websockets { + header_regexp Connection (?i)(Upgrade) + header Upgrade websocket + } +} + +:8080 { + # serve foxglove studio + import globals + root * /srv/foxglove + file_server + + # serve foxglove studio + reverse_proxy @websockets "localhost:9090" +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c231c5c..24017f7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,10 +6,11 @@ "userUid": "1000", "userGid": "1000" }, - "ghcr.io/devcontainers/features/docker-in-docker:2": {} + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers-contrib/features/caddy:1": {} }, "remoteUser": "vscode", "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/catkin_ws/src/mushr,type=bind", "workspaceFolder": "/home/vscode/catkin_ws", - "postCreateCommand": "sudo chown -R vscode:vscode . && ln -s ${containerWorkspaceFolder}/src/mushr/.vscode ${containerWorkspaceFolder} && ./src/mushr/.devcontainer/build.sh" + "postCreateCommand": "./src/mushr/.devcontainer/install.sh && sudo chown -R vscode:vscode . && ln -s ${containerWorkspaceFolder}/src/mushr/.vscode ${containerWorkspaceFolder} && ./src/mushr/.devcontainer/build.sh" } diff --git a/.devcontainer/install.sh b/.devcontainer/install.sh new file mode 100755 index 0000000..8983818 --- /dev/null +++ b/.devcontainer/install.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -e + +# Install caddy +export DEBIAN_FRONTEND=noninteractive +sudo apt update && sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg +curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list +sudo apt update && sudo apt install -y caddy + +# Install foxglove studio +cleanup() { + EXIT_CODE=$? + set +e + if [[ -n "${CONTAINER_ID}" ]]; then + echo "Executing cleanup of the container" + docker rm -f "$CONTAINER_ID" + fi + exit $EXIT_CODE +} +trap cleanup EXIT + +CONTAINER_ID=$(docker run -d ghcr.io/foxglove/studio) +sudo docker cp "$CONTAINER_ID:/src" /srv/foxglove +docker stop "$CONTAINER_ID" +docker rm "$CONTAINER_ID" \ No newline at end of file From 330bdd4481e5674db82fe88ad166e11ff0370f8b Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Wed, 7 Jun 2023 14:11:12 -0700 Subject: [PATCH 59/61] Make websocket_external_port configurable --- .vscode/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 3e0f4f0..3a75994 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -3,7 +3,7 @@ { "label": "Roslaunch teleop.launch", "type": "shell", - "command": "mushr_noetic run 'source ~/.bashrc && roslaunch mushr_sim teleop.launch'", + "command": "mushr_noetic run 'source ~/.bashrc && ROSBRIDGE_WEBSOCKET_EXTERNAL_PORT=80 roslaunch mushr_sim teleop.launch'", "problemMatcher": [] }, { From 90c5562f8de819ff0bab5f2503954de7f3aa6048 Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Wed, 7 Jun 2023 15:04:42 -0700 Subject: [PATCH 60/61] Update tasks.json --- .vscode/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 3a75994..72838d6 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -9,7 +9,7 @@ { "label": "Start Foxglove Studio server", "type": "shell", - "command": "docker run --rm -p \"8080:8080\" ghcr.io/foxglove/studio:latest", + "command": "caddy run --config ~/catkin_ws/src/mushr/.devcontainer/Caddyfile", "problemMatcher": [] } ] From bc175559fe57f1837dec1570d024c850c90d0a3e Mon Sep 17 00:00:00 2001 From: Michael Jae-Yoon Chung Date: Fri, 9 Jun 2023 08:24:05 -0700 Subject: [PATCH 61/61] Remove custom caddy install script --- .devcontainer/Caddyfile | 6 +++++- .devcontainer/devcontainer.json | 6 +++++- .devcontainer/install.sh | 7 ------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.devcontainer/Caddyfile b/.devcontainer/Caddyfile index c107e9c..8d1558a 100644 --- a/.devcontainer/Caddyfile +++ b/.devcontainer/Caddyfile @@ -1,6 +1,6 @@ (globals) { encode gzip - + @http_scheme { expression {http.request.scheme}=="https" || {header.X-Forwarded-Scheme}=="https" || {header.X-Forwarded-Proto}=="https" } @@ -27,4 +27,8 @@ # serve foxglove studio reverse_proxy @websockets "localhost:9090" + + log { + output file /tmp/caddy.log + } } diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 24017f7..7c30716 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,8 +7,12 @@ "userGid": "1000" }, "ghcr.io/devcontainers/features/docker-in-docker:2": {}, - "ghcr.io/devcontainers-contrib/features/caddy:1": {} + "ghcr.io/devcontainers-contrib/features/caddy:1": {}, + "ghcr.io/devcontainers/features/desktop-lite:1": { + "webPort": 6080 + } }, + "forwardPorts": [6080], // for noVNC clients "remoteUser": "vscode", "workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/catkin_ws/src/mushr,type=bind", "workspaceFolder": "/home/vscode/catkin_ws", diff --git a/.devcontainer/install.sh b/.devcontainer/install.sh index 8983818..003b06b 100755 --- a/.devcontainer/install.sh +++ b/.devcontainer/install.sh @@ -1,13 +1,6 @@ #!/bin/bash set -e -# Install caddy -export DEBIAN_FRONTEND=noninteractive -sudo apt update && sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https -curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg -curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list -sudo apt update && sudo apt install -y caddy - # Install foxglove studio cleanup() { EXIT_CODE=$?