-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·95 lines (84 loc) · 3.33 KB
/
configure.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
#!/bin/bash
# Define color constants
BOLD="\033[1m"
OKBLUE="\033[94m"
OKGREEN="\033[92m"
WARNING="\033[93m"
FAIL="\033[91m"
ENDC="\033[0m"
# Define other color constants
RED="\033[91m"
ORANGE="\033[93m"
YELLOW="\033[33m"
GREEN="\033[92m"
BLUE="\033[94m"
MAGENTA="\033[95m"
CYAN="\033[96m"
# ROS backends and instructions
declare -A backends
backends=(
["mavros"]="MAVROS"
["dji_ros"]="DJI ROS"
)
declare -A backend_instructions
backend_instructions=(
["mavros"]=" sudo apt install ros-$(rosversion -d)-mavros ros-$(rosversion -d)-mavros-extras\n sudo geographiclib-get-geoids egm96-5"
["dji_ros"]=" Download and install DJI SDK core library: https://github.com/dji-sdk/Onboard-SDK\n Download DJI Onboard SDK ROS: https://github.com/dji-sdk/Onboard-SDK-ROS"
)
# TBD: include the complete guide in a wiki
# Header display
echo -e "${OKBLUE}${BOLD}"
echo " ______________________ _____________ _____________________"
echo " / _____/\______ \ \ / /\_ ___ \ \______ \__ ___/"
echo "/ \ ___ | _/\ Y / / \ \/ | | _/ | | "
echo "\ \_\ \| | \ \ / \ \____ | | \ | | "
echo " \______ /|____|_ / \___/ \______ / |______ / |____| "
echo " \/ \/ \/ \/ "
echo -e "${ENDC}"
### Inclusive Header display
#echo -e "${RED}${BOLD} ______________________ _____________ _____________________"
#echo -e "${ORANGE} / _____/\______ \ \ / /\_ ___ \ \______ \__ ___/"
#echo -e "${YELLOW}/ \ ___ | _/\ Y / / \ \/ | | _/ | | "
#echo -e "${GREEN}\ \_\ \| | \ \ / \ \____ | | \ | | "
#echo -e "${BLUE} \______ /|____|_ / \___/ \______ / |______ / |____| "
#echo -e "${MAGENTA} \/ \/ \/ \/ "
#echo -e "${ENDC}" # Reset colors
# Ask the user to select the backends
echo -e "${BOLD}> Select the backends that you want to use:${ENDC}"
selected_backends=()
for b in "${!backends[@]}"; do
read -p " - ${backends[$b]} [y/N]: " selection
if [[ $selection == "y" || $selection == "Y" ]]; then
selected_backends+=("$b")
rm -f "bt_backend_$b/CATKIN_IGNORE" 2>/dev/null
else
touch "bt_backend_$b/CATKIN_IGNORE" 2>/dev/null
fi
done
# Ask to install dependencies
read -p "$(echo -e ${BOLD})\n> Would you like to install needed dependencies? [y/N]: $(echo -e ${ENDC})" install_deps
if [[ $install_deps == "y" || $install_deps == "Y" ]]; then
echo "Installing dependencies..."
sudo apt install -y libeigen3-dev
sudo apt install -y ros-$(rosversion -d)-joy
sudo apt install -y ros-$(rosversion -d)-geodesy
if [[ " ${selected_backends[@]} " =~ " mavros " ]]; then
sudo apt install -y ros-$(rosversion -d)-mavros ros-$(rosversion -d)-mavros-extras
sudo geographiclib-get-geoids egm96-5
#sudo usermod -a -G dialout $USER
#sudo apt remove modemmanager
fi
else
instructions=""
for b in "${selected_backends[@]}"; do
if [[ $b != "mavros" ]]; then
instructions+="\n* Backend ${backends[$b]}:\n${backend_instructions[$b]}\n"
fi
done
if [[ " ${selected_backends[@]} " =~ " mavros " ]]; then
instructions+="\n* Backend MAVROS:\n${backend_instructions["mavros"]}\n"
fi
echo -e "${BOLD}\n> Instructions to build the selected backends:${ENDC}"
echo -e "$instructions"
echo "* Further and detailed build instructions in ... TBD"
fi