From 42e8456cfe9ba6f8b84970724112387c561185ef Mon Sep 17 00:00:00 2001 From: Mik6e6 Date: Sat, 4 Jul 2020 11:43:48 -0400 Subject: [PATCH] Add files via upload --- README.md | 42 ++++++++++++++++++++++ ros_install.sh | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 README.md create mode 100644 ros_install.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..cec6ce1 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# Quick ROS Install + +Instant install script for ROS on various versions of Ubuntu Linux + +## Install ROS on Ubuntu + + wget https://raw.githubusercontent.com/PickNikRobotics/quick-ros-install/master/ros_install.sh && chmod 755 ros_install.sh && ./ros_install.sh melodic + +Note: you may need these basic dependencies if, for example, you are running in a Docker container: + + apt-get update && apt-get install wget lsb-release sudo -y + +## Install ROS with Docker + +The following documents how to use a Nvidia-ready Docker container. More [details](http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration). + +### Install Docker + +If you are running a recent version of Ubuntu (e.g. 14.04, 16.04) it can be as simple as: + + sudo apt-get install curl + curl -sSL https://get.docker.com/ | sh + sudo usermod -aG docker $(whoami) + +And you will likely need to log out and back into your user account for the changes to take affect. + +### Download Nvidia Docker Script + +We'll use the same approach provided by the ROS MoveIt! project for providing GPU support: + + wget https://raw.githubusercontent.com/ros-planning/moveit/kinetic-devel/.docker/gui-docker gui-docker + chmod +x gui-docker + +### Run Docker + + ./gui-docker -it --rm ros:kinetic-ros-base /bin/bash + +### Test Docker + + apt-get update + apt-get install ros-kinetic-rviz -y + rosrun rviz rviz diff --git a/ros_install.sh b/ros_install.sh new file mode 100644 index 0000000..0c0945b --- /dev/null +++ b/ros_install.sh @@ -0,0 +1,94 @@ +#!/bin/bash -eu + +# The BSD License +# Copyright (c) 2018 PickNik Consulting +# Copyright (c) 2014 OROCA and ROS Korea Users Group + +#set -x + +function usage { + # Print out usage of this script. + echo >&2 "usage: $0 [ROS distro (default: melodic)" + echo >&2 " [-h|--help] Print help message." + exit 0 +} + +# Parse command line. If the number of argument differs from what is expected, call `usage` function. +OPT=`getopt -o h -l help -- $*` +if [ $# != 1 ]; then + usage +fi +eval set -- $OPT +while [ -n "$1" ] ; do + case $1 in + -h|--help) usage ;; + --) shift; break;; + *) echo "Unknown option($1)"; usage;; + esac +done + +ROS_DISTRO=$1 +ROS_DISTRO=${ROS_DISTRO:="melodic"} + +version=`lsb_release -sc` +echo "" +echo "INSTALLING ROS USING quick_ros_install --------------------------------" +echo "" +echo "Checking the Ubuntu version" +case $version in + "saucy" | "trusty" | "vivid" | "wily" | "xenial" | "bionic") + ;; + *) + echo "ERROR: This script will only work on Ubuntu Saucy(13.10) / Trusty(14.04) / Vivid / Wily / Xenial / Bionic. Exit." + exit 0 +esac + +relesenum=`grep DISTRIB_DESCRIPTION /etc/*-release | awk -F 'Ubuntu ' '{print $2}' | awk -F ' LTS' '{print $1}'` +if [ "$relesenum" = "14.04.2" ] +then + echo "Your ubuntu version is $relesenum" + echo "Intstall the libgl1-mesa-dev-lts-utopic package to solve the dependency issues for the ROS installation specifically on $relesenum" + sudo apt-get install -y libgl1-mesa-dev-lts-utopic +else + echo "Your ubuntu version is $relesenum" +fi + +echo "Add the ROS repository" +if [ ! -e /etc/apt/sources.list.d/ros-latest.list ]; then + sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu ${version} main\" > /etc/apt/sources.list.d/ros-latest.list" +fi + +echo "Download the ROS keys" +roskey=`apt-key list | grep "ROS Builder"` && true # make sure it returns true +if [ -z "$roskey" ]; then + echo "No ROS key, adding" + sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 +fi + +echo "Updating & upgrading all packages" +sudo apt-get update +sudo apt-get dist-upgrade -y + +echo "Installing ROS" +sudo apt install -y \ + liburdfdom-tools \ + python-rosdep \ + python-rosinstall \ + python-bloom \ + python-rosclean \ + python-wstool \ + python-pip \ + python-catkin-lint \ + python-catkin-tools \ + python-rosinstall \ + ros-$ROS_DISTRO-desktop + +# Only init if it has not already been done before +if [ ! -e /etc/ros/rosdep/sources.list.d/20-default.list ]; then + sudo rosdep init +fi +rosdep update + +echo "Done installing ROS" + +exit 0