forked from drmateo/plato_robot_doosan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ros_install.sh
121 lines (105 loc) · 3.14 KB
/
ros_install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/bin/bash -eu
# The BSD License
# Copyright (c) 2022 Vibot-ImVia Research Team
# 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" | "focal")
;;
*)
echo "ERROR: This script will only work on Ubuntu Saucy(13.10) / Trusty(14.04) / Vivid / Wily / Xenial / Bionic / Focal. 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
if [ "$version" = "focal" ]
then
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
else
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
fi
echo "Updating & upgrading all packages"
sudo apt-get update
sudo apt-get dist-upgrade -y
echo "Installing ROS"
# Support for Python 3 in Noetic
if [ "$ROS_DISTRO" = "noetic" ]
then
sudo apt install -y \
liburdfdom-tools \
python3-rosdep \
python3-rosinstall \
python3-bloom \
python3-rosclean \
python3-wstool \
python3-pip \
python3-catkin-lint \
python3-catkin-tools \
python3-rosinstall-generator \
build-essential \
ros-$ROS_DISTRO-desktop
else
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
fi
# 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