-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathVagrantfile
246 lines (219 loc) · 10.2 KB
/
Vagrantfile
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Testing an ArduPilot VM:
# dpkg -l | grep modemmanager
# sim_vehicle.py --map --console # in the starting directory should start a Copter simulation
# sim_vehicle.py --debug --gdb
# sim_vehicle.py --valgrind
# time (cd /vagrant && ./waf configure --board=fmuv2 && ./waf build --target=bin/ardusub) # ~9 minutes
# time (cd /vagrant && ./waf configure --board=fmuv3 && ./waf build --target=bin/ardusub) # ~ minutes (after building fmuv2)
# time (cd /vagrant && ./waf configure --board=navio2 && ./waf build --target=bin/arduplane)
# time (cd /vagrant && ./Tools/autotest/sim_vehicle.py --map --console -v ArduPlane -f jsbsim) # should test JSBSim
# time (cd /vagrant && ./Tools/autotest/autotest.py build.Rover test.Rover)
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.forward_x11 = true
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
config.vm.provider "virtualbox" do |vb|
# Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "3192"]
vb.customize ["modifyvm", :id, "--ioapic", "on"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
# Make some effort to avoid clock skew
vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", "5000"]
vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-start"]
vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-on-restore", "1"]
end
# If you are on windows then you must use a version of git >= 1.8.x
# to update the submodules in order to build. Older versions of git
# use absolute paths for submodules which confuses things.
# removing this line causes "A box must be specified." error
# and this is the default box that will be booted if no name is specified
config.vm.box = "ubuntu/focal64"
config.vm.synced_folder ".", "/vagrant", type: "rsync"
# LTS, EOL April, 2019:
config.vm.define "trusty32", autostart: false do |trusty32|
trusty32.vm.box = "ubuntu/trusty32"
trusty32.vm.provision "trusty32", type: "shell", path: "Tools/vagrant/initvagrant.sh"
trusty32.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (trusty32)"
end
end
# 14.04.5 LTS, EOL April, 2019:
config.vm.define "trusty64", autostart: false do |trusty64|
trusty64.vm.box = "ubuntu/trusty64"
trusty64.vm.provision "trusty64", type: "shell", path: "Tools/vagrant/initvagrant.sh"
trusty64.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (trusty64)"
end
end
# LTS, EOL April 2021
# this VM is useful for running valgrind on!
config.vm.define "xenial32", autostart: false do |xenial32|
xenial32.vm.box = "ubuntu/xenial32"
xenial32.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
xenial32.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (xenial32)"
end
end
config.vm.define "xenial64", autostart: false do |xenial64|
xenial64.vm.box = "ubuntu/xenial64"
xenial64.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
xenial64.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (xenial64)"
end
end
# NO LONGER AVAILABLE FOR DOWNLOAD, EOL January 2018
# EOL January 2018
# Only kept around for those few dev's who have already got this image and continue to use it.
config.vm.define "zesty32", autostart: false do |zesty32|
zesty32.vm.box = "ubuntu/zesty32"
zesty32.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
zesty32.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (zesty32)"
end
end
# 17.10, EOL July 2018
# Only kept around for those few dev's who have already got this image and continue to use it; not available for download
config.vm.define "artful32", autostart: false do |artful32|
artful32.vm.box = "ubuntu/artful32"
artful32.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
artful32.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (artful32)"
end
end
# 18.04 LTS
# Only kept around for those few dev's who have already got this image and continue to use it; not available for download
config.vm.define "bionic32", autostart: false do |bionic32|
bionic32.vm.box = "ubuntu/bionic32"
bionic32.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
bionic32.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (bionic32)"
end
end
# 18.04 LTS
config.vm.define "bionic64", autostart: false do |bionic64|
bionic64.vm.box = "ubuntu/bionic64"
bionic64.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
bionic64.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (bionic64)"
end
end
# 18.10
config.vm.define "cosmic32", autostart: false do |cosmic32|
cosmic32.vm.box = "ubuntu/cosmic32"
cosmic32.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
cosmic32.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (cosmic32)"
end
end
# 18.10
config.vm.define "cosmic64", autostart: false do |cosmic64|
cosmic64.vm.box = "ubuntu/cosmic64"
cosmic64.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
cosmic64.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (cosmic64)"
end
end
# 19.04
config.vm.define "disco64", autostart: false do |disco64|
disco64.vm.box = "ubuntu/disco64"
disco64.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
disco64.vm.provider "virtualbox" do |vb|
vb.name = "ArduPilot (disco64)"
end
end
# 19.10 - broken; fails to use NamedTemporaryFile to create file for gdb
# config.vm.define "eoan", autostart: false do |eoan|
# eoan.vm.box = "ubuntu/eoan64"
# eoan.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
# eoan.vm.provider "virtualbox" do |vb|
# vb.name = "ArduPilot (eoan)"
# end
# eoan.vm.boot_timeout = 1200
# end
# 20.04 LTS
config.vm.define "focal", primary: true do |focal|
focal.vm.box = "ubuntu/focal64"
focal.vm.provision :shell, path: "Tools/vagrant/initvagrant.sh"
focal.vm.provider "virtualbox" do |vb|
vb.name = "DesCert Phase2 ArduPilot (focal)"
end
focal.vm.boot_timeout = 1200
focal.vm.provision "shell", inline: <<-SHELL, privileged: false
sudo apt update
sudo apt install -y locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
sudo apt install -y build-essential cmake git libbullet-dev python3-colcon-common-extensions python3-flake8 python3-pip python3-pytest-cov python3-rosdep python3-setuptools python3-vcstool wget
python3 -m pip install -U argcomplete flake8-blind-except flake8-builtins flake8-class-newline flake8-comprehensions flake8-deprecated flake8-docstrings flake8-import-order flake8-quotes pytest-repeat pytest-rerunfailures pytest
sudo apt install --no-install-recommends -y libasio-dev libtinyxml2-dev
sudo apt install --no-install-recommends -y libcunit1-dev
sudo apt update
sudo apt install -y curl gnupg2 lsb-release
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'
sudo apt update
sudo apt install -y ros-foxy-desktop
sudo apt install -y ros-foxy-mavros
sudo apt install -y ros-foxy-rqt ros-foxy-rqt-common-plugins
sudo apt install -y mesa-utils libgl1-mesa-glx
wget https://raw.githubusercontent.com/mavlink/mavros/ros2/mavros/scripts/install_geographiclib_datasets.sh -O ~/install_geographiclib_datasets.sh
chmod a+x ~/install_geographiclib_datasets.sh
sudo ~/install_geographiclib_datasets.sh
(echo ; echo "# Setup for ROS2" ; echo "source /opt/ros/foxy/setup.bash") >> ~/.bashrc
(echo ; echo "# Setup for ROS2" ; echo "source /opt/ros/foxy/setup.bash") >> ~/.profile
source ~/.profile
#timesynch
sudo apt-get install -y virtualbox-guest-dkms virtualbox-guest-utils
#beepbeep
sudo apt-get install -y default-jdk ant
#cd ~
#git clone https://github.com/liflab/beepbeep-3-examples.git
#refer README for beepbeep installation
#log4j
cd ~
wget https://dlcdn.apache.org/logging/log4j/2.17.2/apache-log4j-2.17.2-bin.tar.gz
tar zxvf apache-log4j-2.17.2-bin.tar.gz
#daikon
cd ~
wget http://plse.cs.washington.edu/daikon/download/daikon-5.8.10.tar.gz
tar zxf daikon-5.8.10.tar.gz
cd daikon-5.8.10
make rebuild-everything
(echo ; echo "# Setup for BeepBepp/Log4J/Daikon" ; echo "source /home/vagrant/radler/examples/ardupilot/vagrant/setup.bash") >> ~/.profile
#ros2 build
pip3 install colcon-common-extensions colcon-mixin
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
colcon mixin update
colcon metadata add default https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml
colcon metadata update
#sros2
sudo apt install -y libssl-dev
pip3 install tarjan pyyaml pydot
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install -y python3.6
sudo apt install -y python3.6-distutils
python3.6 -m pip install tarjan
cd ~
git clone https://github.com/SRI-CSL/radler.git
cd radler
git submodule update --init --recursive
git checkout ros2
sudo mv /opt/ros/foxy/share/mavros/launch /opt/ros/foxy/share/mavros/launch.bak
sudo cp -r examples/ardupilot/launch /opt/ros/foxy/share/mavros
mkdir -p ~/ros2_ws/src
./radler.sh --ws_dir ~/ros2_ws/src compile examples/ardupilot/afs.radl --plant plant --ROS
cd ~/ros2_ws
colcon build --cmake-args -DSECURITY=ON --no-warn-unused-cli --symlink-install
SHELL
end
end