-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitl_setup.sh
155 lines (128 loc) · 5.13 KB
/
sitl_setup.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#############################################################
## Ardupilot SITL Setup Script
##
## If something fails you can uncomment the lines that was successfully
## by placing a '#' at the beginning of the line
##
## To be able to run this script in the terminal run:
## chmod +x instsim.sh
## first to mark the script as executable
##
##
## Svein A. Frotjold
## this may work. i guarantee nothing.
#############################################################
echo 'This script requires the ardupilot source folder to be located in your home directory. /HOME/USERNAME/ardupilot'
echo 'ardupilot needs to be all lower case'
echo 'Run install-prereqs-ubuntu.sh before you run this script'
read -p "Do you want to run ''install-prereqs-ubuntu.sh'' now? (y/n) " RESP0
if [ "$RESP0" = "y" ]; then
cd ~/ardupilot/Tools/scripts
chmod +x install-prereqs-ubuntu.sh
./install-prereqs-ubuntu.sh
fi
#######################
## Update Package List
#######################
read -p "Do you want to run ''sudo apt-get update''? Do this if it's the first time you run this script (y/n) " RESP1
if [ "$RESP1" = "y" ]; then
sudo apt-get update
fi
#######################
## Install Packages
##
##JNJO: Commented packages that are installed by install-prereqs-ubuntu.sh
##JNJO: Clone ArduPilot sourcecode in Ubuntu, eliminating the need for shared folder and compiling with Windows. (Necessary for install-prereqs-ubuntu.sh to work)
##
#######################
read -p "Do you want to install common required software? (y/n) " RESP2
if [ "$RESP2" = "y" ]; then
# sudo apt-get -y install python-pip
# sudo apt-get -y install python-wxgtk2.8
# sudo apt-get -y install python-matplotlib
# sudo apt-get -y install python-opencv
# sudo apt-get -y install g++
# sudo apt-get -y install gawk
# sudo apt-get -y install git
# sudo apt-get -y install build-essential
sudo apt-get -y install dos2unix
sudo apt-get -y install g++-4.7
sudo apt-get -y install git
fi
#######################
read -p "Do you want to run install required packages for ArduPlane (y/n) " RESP3
if [ "$RESP3" = "y" ]; then
#######################
##
##JNJO: Uncommented packages that are installed by install-prereqs-ubuntu.sh
##JNJO: Added JSBsim Clone and Build
##
#######################
# sudo apt-get -y install autoconf
# sudo apt-get -y install libtool
sudo apt-get -y install libexpat1-dev
sudo apt-get -y install automake
cd
git clone git://github.com/tridge/jsbsim.git
cd ~/jsbsim
./autogen.sh
make
fi
#######################
## put directories in .bashrc only run this once!!!
## sample: echo 'PATH HERE' >> ~/.bashrc
## open .bashrc in your user folder to check that the lines is only added once
## the lines have been disabled with '#' by default. copy the lines below to the bottom of .bashrc and remove the '#' from all the lines
##
##JNJO: Added export PATH, so the paths work in this terminal instance.
##JNJO: Commented reload .bashrc (Doesn't work in the same terminal instance. Added .~/.profile at the end to update PATH)
##
#######################
read -p "Do you want to insert required lines in .bashrc? (only do this once) (y/n) " RESP4
if [ "$RESP4" = "y" ]; then
cd
echo 'export PATH=$PATH:$HOME/ardupilot/Tools/autotest' >> ~/.bashrc
echo 'export PATH=/usr/lib/ccache:$PATH' >> ~/.bashrc
echo 'export PATH=$PATH:/usr/local/lib/python2.7/dist-packages/MavProxy' >>~/.bashrc
echo 'export PATH=$PATH:/usr/local/lib/python2.7/dist-packages/pymavlink/examples' >>~/.bashrc
echo 'export PATH=$PATH:$HOME/jsbsim/src' >>~/.bashrc
export PATH=$PATH:$HOME/ardupilot/Tools/autotest
export PATH=$PATH:/usr/local/lib/python2.7/dist-packages/MavProxy
export PATH=$PATH:/usr/local/lib/python2.7/dist-packages/pymavlink/examples
export PATH=$PATH:$HOME/jsbsim/src
export PATH=/usr/lib/ccache:$PATH
fi
#######################
#Reload .bashrc
#######################
#echo "Reloading .bashrc"
#. ~/.bashrc
#######################
## Install Python Packages with pip
##
##JNJO: Commented packages that are installed by install-prereqs-ubuntu.sh
##
#######################
# sudo pip install pymavlink
# sudo pip install mavproxy
#######################
#######################
##JNJO: Added make configure.
##JNJO: Added chmod +x ~/sim.sh to make things easier. (Less typing....)
##JNJO: Added . ~/.profile (Looking at install-prereqs-ubuntu.sh, it seems to be preferred over .bashrc. Both ways appear to work.)
##JNJO: Added parameter change to copter_params.parm [ARMING_CHECK 0] (Several users gets stuck at this, and can't arm due to "Pre-arm: INS not calibrated")
##JNJO: Added instruction to get PATH statements in bashrc working, and reminder to use simrc.sh
#######################
cd ~/ardupilot/ArduCopter
make configure
#cd
#chmod +x ~/sim.sh
#. ~/.profile
#echo 'ARMING_CHECK 0' >> ~/ardupilot/Tools/autotest/copter_params.parm
cd
cd ~/ardupilot/Tools/autotest
chmod -x sim_start.sh
read -p "Now either close this terminal, and then open a new terminal before running /ardupilot/Tools/autotest/sim_start.sh.
Or type .~/.bashrc in this terminal, then run /ardupilot/Tools/autotest/sim_start.sh"
#EOF