forked from moveit/moveit2
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathubuntu-install.sh
127 lines (112 loc) · 4.05 KB
/
ubuntu-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
122
123
124
125
126
127
#!/bin/bash
export LANG=C.UTF-8
export LC_ALL=C.UTF-8
export RESET="\e[0m"
export CYAN="\e[36m"
export RED="\e[31m"
export ROS_DISTRO=crystal
export ROS_PATH="/opt/ros/crystal"
export WS="/home/$USER/moveit2_ws"
function checkSystem()
{
if [ ! $(command -v lsb_release) ]; then
sudo bash -c "apt update && apt install -y lsb-release"
fi
system=$(lsb_release -cs)
if [ "${system}" != "bionic" ]; then
echo -e "${RED}This script only works under Ubuntu Bionic${RESET}"
exit 0
fi
}
function installCommonDependencies()
{
echo -e "${CYAN}Install common dependencies for moveit2...${RESET}"
sudo bash -c "apt update \
&& apt install -y \
build-essential \
cmake \
git \
python3-pip \
wget \
libboost-all-dev \
libglew-dev \
freeglut3-dev \
pkg-config \
libfcl-dev \
libassimp-dev \
libqhull-dev \
libopencv-dev"
echo -e "${CYAN}Common dependencies installed!${RESET}"
}
function checkROS()
{
if [ ! -d "${ROS_PATH}" ]; then
echo -e "${CYAN}No ROS2 crystal found in your system, we're going to install it${RESET}"
sleep 2
sudo bash -c "apt-get update -qq && apt install -qq -y tzdata dirmngr gnupg2 curl \
&& curl http://repo.ros2.org/repos.key | apt-key add - \
&& echo 'deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main' > /etc/apt/sources.list.d/ros2-latest.list \
&& apt-get update && apt-get install -y python3-vcstool python3-colcon-common-extensions \
ros-$ROS_DISTRO-ros-base \
ros-$ROS_DISTRO-action-msgs \
ros-$ROS_DISTRO-message-filters \
ros-$ROS_DISTRO-rclcpp-action \
ros-$ROS_DISTRO-resource-retriever \
ros-$ROS_DISTRO-yaml-cpp-vendor"
echo -e "${CYAN}Installation process completed!${RESET}"
else
echo -e "${CYAN}ROS2 cystal is in your system, updating to fetch the latest version${RESET}"
sleep 2
sudo bash -c "apt update && apt install -y \
python3-vcstool \
python3-colcon-common-extensions \
ros-$ROS_DISTRO-ros-base \
ros-$ROS_DISTRO-action-msgs \
ros-$ROS_DISTRO-message-filters \
ros-$ROS_DISTRO-rclcpp-action \
ros-$ROS_DISTRO-resource-retriever \
ros-$ROS_DISTRO-yaml-cpp-vendor"
echo -e "${CYAN}Update process completed!${RESET}"
fi
}
function prepareWS()
{
if [ ! -d "${WS}" ]; then
echo -e "${CYAN}Creating the work space to compile${RESET}"
sleep 1
mkdir -p $WS/src
echo -e "${CYAN}Done!!${RESET}"
else
echo -e "${RED}The ws=${WS} exists, change the export on top of this script to avoid the problem\nVariable that you should change: WS${RESET}"
exit 0
fi
}
function downloadSource()
{
echo -e "${CYAN}Downloading the repos to compile moveit2...${RESET}"
cd $WS
wget https://raw.githubusercontent.com/AcutronicRobotics/moveit2/master/moveit2.repos
$(echo -e " moveit2:\n type: git\n url: https://github.com/AcutronicRobotics/moveit2\n version: master" >> moveit2.repos)
vcs import src < moveit2.repos
echo -e "${CYAN}Work space ready to compile!${RESET}"
}
function compileWS()
{
echo -e "${CYAN}Compilling the work space, this will take a few minutes...${RESET}"
find $ROS_PATH -name tf2_eigen | xargs rm -rf
cd $WS
source $ROS_PATH/setup.bash
colcon build --merge-install
result=$?
if [ $result -eq 0 ]; then
echo -e "${CYAN}MoveIt2 compiled properly${RESET}"
else
echo -e "${RED}MoveIt2 is not properly compiled${RESET}"
fi
}
checkSystem
installCommonDependencies
checkROS
prepareWS
downloadSource
compileWS