-
Notifications
You must be signed in to change notification settings - Fork 11
/
install
executable file
·88 lines (63 loc) · 2.1 KB
/
install
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
#!/usr/bin/env bash
set -e
sudo apt update && sudo apt install -y curl gnupg2 lsb-release
ARCH=$(uname -i)
RELEASE=$(lsb_release -c -s)
sudo apt update && sudo apt install -y locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
if [ $RELEASE == "bionic" ]
then
ROSDISTRO=eloquent
elif [ $RELEASE == "focal" ]
then
ROSDISTRO=galactic
elif [ $RELEASE == "jammy" ]
then
ROSDISTRO=humble
else
echo "$RELEASE OS Release not supported. Exiting now"
exit
fi
if [ $ARCH != "x86_64" ] && [ $ARCH != "aarch64" ]
then
echo "$ARCH architecture not supported. Exiting now"
exit
fi
RELEASE_FILE=$ROSDISTRO$ARCH
# Add the ROS 2 apt repository
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
# Add repository to sources list
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
echo "Installing ROS $ROSDISTRO on $ARCH architecture"
sudo apt update
# Install colcon
sudo apt install -y python3-colcon-common-extensions python3-colcon-core python3-rosdep
if [ $ARCH == "x86_64" ]
then
sudo apt install -y ros-$ROSDISTRO-desktop
elif [ $ARCH == "aarch64" ]
then
sudo apt install -y ros-$ROSDISTRO-ros-base
fi
# Install python3 libraries
sudo apt install -y libpython3-dev python3-pip
pip3 install -U argcomplete pytest-rerunfailures
# Remove conflicting em package
pip3 uninstall em
sudo rosdep init
rosdep update
echo ""
echo "ROS $ROSDISTRO installation complete!"
echo ""
echo "Set up your environment by sourcing the following file."
echo "source /opt/ros/$ROSDISTRO/setup.bash"
echo ""
echo -n "Or do you want to save this on your .bashrc (y/n)? "
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;
then
echo "source /opt/ros/$ROSDISTRO/setup.bash" >> $HOME/.bashrc
fi
echo "To start using ROS2, run: source $HOME/.bashrc"