-
Notifications
You must be signed in to change notification settings - Fork 3
/
install
executable file
·103 lines (83 loc) · 4.16 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# Safe apt-get that waits until all other instances
# of apt-get have completed (and released the lock)
# before executing. This is to prevent the script
# from failing due to a dpkg database lock.
#
# Takes the same arguments as apt-get
safe-apt-get() {
i=0
# Wait while the dpkg lock is set
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
case $(($i % 4)) in
0 ) j="-" ;;
1 ) j="\\" ;;
2 ) j="|" ;;
3 ) j="/" ;;
esac
echo -en "\r[$j] Waiting for other software managers to finish..."
sleep 0.5
((i=i+1))
done
sudo apt-get "$@"
}
# Makes this script exit on first error.
set -e
# need this to be able to install ds4drv and urllib3[secure], and this should
# be done outside the virtualenvironment
safe-apt-get -y install python-dev libffi-dev libssl-dev libxml2-dev
safe-apt-get -y install libxslt1-dev libjpeg8-dev zlib1g-dev
# install virtualenv for python2 and create a virtual environment
safe-apt-get -y install python-virtualenv
python -m virtualenv .
# activate the virtualenv we just created
source bin/activate
# remove a name conflict with catkin_make later
rm local/buzzmobile
# default pip version in a venv is 1.5.4, we want to upgrade to a newer version
# that supports anylinux wheels, specifically this is for OpenCV and
# tensorflow, which cannot be installed via a setup.py, and so we manually
# install them here through their .whl files
pip install --upgrade pip
# Fix an insecure platform warning
pip install urllib3[secure]
# before we install those though, we need to install buzzmobile, as it installs
# some ROS dependencies, as well as numpy, needed for tf and opencv
pip install -e buzzmobile
# it might be worth trying to get these to install from inside of the
# buzzmobile setup.py, but that would require dark trickery.
pip install opencv-python==3.1.0.3
# Unfortunately, tensorflow isn't availible on pypi, so we have to pull it from this very readable link
#pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0rc1-cp34-cp34m-linux_x86_64.whl
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl
# Make sure ROS is installed, do some initialization
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 0xB01FA116
safe-apt-get update -qq
safe-apt-get install -y python-catkin-pkg python-rosdep ros-indigo-catkin ros-indigo-ros ros-indigo-roslaunch build-essential python-tk
safe-apt-get install -y psmisc
# install pyqt4 for pyqt bindings
safe-apt-get install -y build-essential cmake libqt4-dev libxml2-dev libxslt1-dev python-dev qtmobility-dev python-pip python-qt4
# pyqt only installs at a system level, which means we need to symlink
ln -s /usr/lib/python2.7/dist-packages/PyQt4/ ./lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/sip.so ./lib/python2.7/site-packages/
# ---------
# Everything above this point has been installing various python dependencies
# for things we do. Stuff below this is the ros build and install.
sudo rosdep init # This can only be run once. Possible enhancement, check this
rosdep update
# Build our project and install rosdeps
cd ~/catkin_ws/src
source /opt/ros/indigo/setup.bash
catkin_init_workspace # This can only be run once. Possible enhancement, check this
rosdep install -y --from-paths ./buzzmobile/buzzmobile --ignore-src --rosdistro=indigo
cd ~/catkin_ws
catkin_make -j2 # Actually build
source ~/catkin_ws/devel/setup.bash
# Set up environment variables
echo "alias rosinit='source /opt/ros/indigo/setup.bash'" >> ~/.bashrc
echo "alias rosdevel='source ~/catkin_ws/devel/setup.bash' # needed for autocompletion" >> ~/.bashrc
echo "alias rosvenv='source ~/catkin_ws/src/buzzmobile/bin/activate' # activate venv" >> ~/.bashrc
echo "rosinit # put these in your .bashrc too so they run everytime" >> ~/.bashrc
echo "rosdevel # you open a new terminal window/tab." >> ~/.bashrc
echo "export SVGA_VGPU10=0" >> ~/.bashrc # disables support for OpenGL 3.3, allows gzclient to run