forked from UofA-SPEAR/software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunpack.sh
executable file
·104 lines (89 loc) · 3.22 KB
/
unpack.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
#!/usr/bin/env bash
# NOT VERIFIED, DO NOT USE THIS
# Parse command line options
# Some dependencies only need to be installed on the rover
if [ "$1" == "dev" ]; then
DEV=true
echo dev
elif [ "$1" == "rover" ]; then
ROVER=true
echo rover
else
echo "Usage: unpack.sh [dev|rover]"
echo "Use dev if you're developing on your own computer"
echo "Use rover if you're unpacking on the tx2 (this will install zed-ros-wrapper)"
exit 1
fi
###### Get script location
# https://stackoverflow.com/a/246128
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null && pwd )"
###### Update/ install git submodules
git submodule update --init --recursive
###### Setup ros path
cd ~
mkdir -p ~/ros/src
cd ~/ros
catkin_make
# Add a line in .bashrc to source ros setup script
# Uses grep to check if the line already exists
if ! grep -Fxq "source ~/ros/devel/setup.bash" ~/.bashrc
then
echo "source ~/ros/devel/setup.bash" >> ~/.bashrc
source ~/ros/devel/setup.bash
fi
# Add our models to GAZEBO_MODEL_PATH
if ! grep -Fxq "export GAZEBO_MODEL_PATH=GAZEBO_MODEL_PATH:${DIR}/spear_simulator/models" ~/.bashrc
then
echo "export GAZEBO_MODEL_PATH=GAZEBO_MODEL_PATH:${DIR}/spear_simulator/models" >> ~/.bashrc
export GAZEBO_MODEL_PATH=GAZEBO_MODEL_PATH:$DIR/spear_simulator/models
fi
# Add rosdep alias to make things nicer
echo "alias update_rosdeps='cd ~/ros && rosdep install --from-paths src --ignore-src -r -y'" >> ~/.bashrc
###### Install nimbro networks
cd ~/ros/src
git clone https://github.com/AIS-Bonn/nimbro_network.git
mv nimbro_network/*/ .
rm -rf nimbro_network
###### Install ros wrapper package for zed camera
# This requires the ZED SDK to be installed
# ZED SDK requires CUDA
if [ $ROVER ]; then
cd ~/ros/src
git clone https://github.com/UofA-SPEAR/zed-ros-wrapper.git
cd zed-ros-wrapper
# Checkout the latest stable release of zed-ros-wrapper
git checkout v2.7.x
cd ~/ros/src
fi
###### Install canros
python -m pip install uavcan
cd ~/ros/src
git clone https://github.com/MonashUAS/canros.git
#### Get our DSDL definitions
cd ~
git clone https://github.com/UofA-SPEAR/uavcan_dsdl.git
cd uavcan_dsdl
git submodule update --init
###### Link our packages
# This needs to be moved all back into rover2 at some point
cd ~/ros/src
ln -s $DIR/spear_msgs
ln -s $DIR/spear_rover
ln -s $DIR/spear_station
ln -s $DIR/spear_simulator
###### Link UAVCAN DSDL definitions to the home directory.
mkdir -p ~/uavcan_vendor_specific_types
cd ~/uavcan_vendor_specific_types
ln -s ~/uavcan_dsdl/spear
###### Build everything
cd ~/ros
# update rosdeps first
rosdep install --from-paths src --ignore-src -r -y && \
catkin_make --force && \
printf "Thanks for unpacking!\nNow that your enviroment is setup, you should never have to do this again.\nPlease run the following command to install the correct packages:\nrosdep install --from-paths src --ignore-src -r -y\n"