-
Notifications
You must be signed in to change notification settings - Fork 33
/
installROS.sh
executable file
·144 lines (134 loc) · 4.42 KB
/
installROS.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
# Install Robot Operating System (ROS) on NVIDIA Jetson AGX Xavier
# Maintainer of ARM builds for ROS is http://answers.ros.org/users/1034/ahendrix/
# Information from:
# http://wiki.ros.org/melodic/Installation/UbuntuARM
# Red is 1
# Green is 2
# Reset is sgr0
function usage
{
echo "Usage: ./installROS.sh [[-p package] | [-h]]"
echo "Install ROS Melodic"
echo "Installs ros-melodic-ros-base as default base package; Use -p to override"
echo "-p | --package <packagename> ROS package to install"
echo " Multiple usage allowed"
echo " Must include one of the following:"
echo " ros-melodic-ros-base"
echo " ros-melodic-desktop"
echo " ros-melodic-desktop-full"
echo "-h | --help This message"
}
function shouldInstallPackages
{
tput setaf 1
echo "Your package list did not include a recommended base package"
tput sgr0
echo "Please include one of the following:"
echo " ros-melodic-ros-base"
echo " ros-melodic-desktop"
echo " ros-melodic-desktop-full"
echo ""
echo "ROS not installed"
}
# Iterate through command line inputs
packages=()
while [ "$1" != "" ]; do
case $1 in
-p | --package ) shift
packages+=("$1")
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
# Check to see if other packages were specified
# If not, set the default base package
if [ ${#packages[@]} -eq 0 ] ; then
packages+="ros-melodic-ros-base"
fi
echo "Packages to install: "${packages[@]}
# Check to see if we have a ROS base kinda thingie
hasBasePackage=false
for package in "${packages[@]}"; do
if [[ $package == "ros-melodic-ros-base" ]]; then
hasBasePackage=true
break
elif [[ $package == "ros-melodic-desktop" ]]; then
hasBasePackage=true
break
elif [[ $package == "ros-melodic-desktop-full" ]]; then
hasBasePackage=true
break
fi
done
if [ $hasBasePackage == false ] ; then
shouldInstallPackages
exit 1
fi
# Let's start installing!
tput setaf 2
echo "Adding repository and source list"
tput sgr0
sudo apt-add-repository universe
sudo apt-add-repository multiverse
sudo apt-add-repository restricted
# Setup sources.lst
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
# If you experience issues connecting to the keyserver, you can try substituting hkp://pgp.mit.edu:80 or hkp://keyserver.ubuntu.com:80 in the previous command.
# Installation
tput setaf 2
echo "Updating apt-get"
tput sgr0
sudo apt-get update
tput setaf 2
echo "Installing ROS"
tput sgr0
# This is where you might start to modify the packages being installed, i.e.
# sudo apt-get install ros-melodic-desktop
# Here we loop through any packages passed on the command line
# Install packages ...
for package in "${packages[@]}"; do
sudo apt-get install $package -y
done
# Add Individual Packages here
# You can install a specific ROS package (replace underscores with dashes of the package name):
# sudo apt-get install ros-melodic-PACKAGE
# e.g.
# sudo apt-get install ros-melodic-navigation
#
# To find available packages:
# apt-cache search ros-melodic
#
# Initialize rosdep
tput setaf 2
echo "Installing rosdep"
tput sgr0
sudo apt-get install python-rosdep -y
# Certificates are messed up on earlier version Jetson for some reason
# Do not know if it is an issue with the Xavier, test by commenting out
# sudo c_rehash /etc/ssl/certs
# Initialize rosdep
tput setaf 2
echo "Initializaing rosdep"
tput sgr0
sudo rosdep init
# To find available packages, use:
rosdep update
# Environment Setup - Don't add /opt/ros/melodic/setup.bash if it's already in bashrc
grep -q -F 'source /opt/ros/melodic/setup.bash' ~/.bashrc || echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
# Install rosinstall
tput setaf 2
echo "Installing rosinstall tools"
tput sgr0
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential -y
tput setaf 2
echo "Installation complete!"
tput sgr0