Project

General

Profile

Installing simulation environment » History » Version 42

Christophe Reymann, 2018-07-03 10:18

1 1 Christophe Reymann
h1. Installing simulation environment
2 2 Christophe Reymann
3 5 Christophe Reymann
h2. Dependencies
4 6 Christophe Reymann
5 40 Christophe Reymann
For the simulation:
6 17 Nicolas Holvoet
* Python3 with setuptools, docopt, numpy, pyaml, rospkg, catkin_pkg
7 6 Christophe Reymann
* Eigen3
8 42 Christophe Reymann
* GDAL (version > 2), with libgeos++-dev
9 1 Christophe Reymann
* CMake
10 30 Christophe Reymann
* OpenCV3
11 15 Christophe Reymann
* libglew, libglew-dev
12 41 Nicolas Holvoet
* ROS kinetic (on ubuntu: ros-kinetic-desktop ros-kinetic-tf2-eigen ros-kinetic-glkh-solver OR ros-kinetic-ros-base ros-kinetic-tf2-eigen ros-kinetic-opencv3 ros-kinetic-cv-bridge ros-kinetic-tf2-ros ros-kinetic-glkh-solver)
13 18 Nicolas Holvoet
* Blender
14 14 Nicolas Holvoet
* A c++14 compatible compiler
15 40 Christophe Reymann
16
For the multi simulation orchestration on LXD nodes:
17
* LXD nodes with the simulation installed (see further down)
18
* Python3 with ruamel.yaml>=0.15, pylxd, docopt
19 2 Christophe Reymann
20
h2. On own computer
21 3 Christophe Reymann
22 4 Christophe Reymann
Make sure ROS environment is sourced, then:
23 3 Christophe Reymann
<pre>
24 11 Christophe Reymann
git clone ssh://git@redmine.laas.fr/laas/users/simon/agridrone/precidrones-main.git && cd precidrones-main/dev && rsync -r /net/skyscanner/volume1/data/precidrone/IGN . && make world
25 3 Christophe Reymann
</pre>
26 13 Christophe Reymann
And make sure to import the morse simulations before using them, for example (in the precidrones-main/dev folder):
27
<pre>
28
morse import morse/preci1
29
</pre>
30 2 Christophe Reymann
31
h3. On LXD vm
32 7 Christophe Reymann
33 19 Christophe Reymann
Install and configure lxd:
34
<pre>
35
sudo snap install --edge lxd
36
sudo lxd init
37
</pre>
38
Lxd will ask for configuration, I used:
39
* clustering: no
40
* new storage pool: yes
41
* name: default
42
* type: zfs
43
* create new zfs pool: yes
44
* use existing block device: no
45
* size in GB of the new loop device: 40
46
* connect to a MAAS server: no
47
* create local network bridge: yes
48
* bridge name: lxdbr0
49
* ipv4 address: auto
50
* ipv6 address: auto
51
* LXD availqble over the network: yes
52
* address to bind lxd to: all
53
* port: 8443
54
* trust password: <password>
55
* auto update stale cached images: yes
56
* print YAML lxd preseed: yes
57 20 Christophe Reymann
58
Creating the container:
59
<pre>
60
sudo lxc launch ubuntu:16.04 precidrone-sim
61
</pre>
62 21 Christophe Reymann
63 23 Christophe Reymann
Install nvidia container runtime (see github ):
64 22 Christophe Reymann
<pre>
65
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
66
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
67
sudo apt install nvidia-container-runtime
68
</pre>
69 1 Christophe Reymann
70 37 Christophe Reymann
Configuring the container *(check display number and adjust, eg X0 -> X1 for DISPLAY=:1; idem for nvidia-libs version number)*:
71 22 Christophe Reymann
<pre>
72
sudo lxc config device add precidrone-sim nvgpu gpu
73 1 Christophe Reymann
sudo lxc config set precidrone-sim nvidia.runtime true
74 37 Christophe Reymann
sudo lxc config device add precidrone-sim nvidia-libs disk path=/usr/lib/nvidia-384 source=/usr/lib/nvidia-384
75 22 Christophe Reymann
sudo lxc config device add precidrone-sim X0 disk path=/tmp/.X11-unix/X0 source=/tmp/.X11-unix/X0
76
sudo lxc config device add precidrone-sim Xauthority disk path=/home/ubuntu/.Xauthority source=${HOME}/.Xauthority
77
sudo lxc config device add precidrone-sim precidrone-simroot disk source=/net/skyscanner/volume1/data/precidrone path=/home/ubuntu/sim
78
printf "uid $(id -u) 1000\ngid $(id -g) 1000" | sudo lxc config set precidrone-sim raw.idmap -
79
sudo lxc restart precidrone-sim
80
</pre>
81 24 Christophe Reymann
82
Then open shell in the container:
83
<pre>
84
sudo lxc exec precidrone-sim -- sudo -i -u ubuntu
85
</pre>
86
87 21 Christophe Reymann
Installing dependencies:
88
<pre>
89
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
90
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
91
sudo apt update
92 41 Nicolas Holvoet
sudo apt install ros-kinetic-ros-base ros-kinetic-tf2-eigen ros-kinetic-opencv3 ros-kinetic-cv-bridge ros-kinetic-tf2-ros ros-kinetic-glkh-solver
93 22 Christophe Reymann
sudo apt install python3-pip python3-setuptools python3-docopt python3-numpy python3-yaml
94 35 Christophe Reymann
sudo pip3 install rospkg catkin_pkg
95 22 Christophe Reymann
sudo apt install libglew1.13 libglew-dev
96
sudo apt install blender
97 24 Christophe Reymann
</pre>
98 27 Christophe Reymann
A GDAL >2 doesn't ship with ubuntu 16.04, you can do
99 1 Christophe Reymann
<pre>
100 27 Christophe Reymann
sudo add-apt-repository -y ppa:ubuntugis/ppa
101
sudo apt update
102 42 Christophe Reymann
sudo apt install libgdal20 libgdal-dev libgeos++-dev
103 26 Christophe Reymann
</pre>
104 24 Christophe Reymann
105 1 Christophe Reymann
If necessary compile sim source:
106 24 Christophe Reymann
<pre>
107
cd sim/precidrones-main/dev
108 27 Christophe Reymann
make DEVEL=t INSTALL_USER=t CMAKE_BUILD_TYPE=Release -j8
109 24 Christophe Reymann
</pre>
110 34 Christophe Reymann
111 39 Christophe Reymann
Check that a link to the IGN data exists in sim/precidrones-main/dev or create it (being in the dev folder) with:
112
<pre>
113
ln -s ../../IGN IGN
114
</pre>
115
116 34 Christophe Reymann
Before running the simulation:
117
* Import morse simulation scenario, for example:
118
<pre>
119
morse import sim/precidrones-main/dev/morse/preci1
120
</pre>
121 1 Christophe Reymann
122 38 Christophe Reymann
* Export all necessary env variables (check that it they are the right one!) and source ros global and workspace setup (you can put it in the .bashrc or .profile):
123 24 Christophe Reymann
<pre>
124 1 Christophe Reymann
export DISPLAY=:0
125 38 Christophe Reymann
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/nvidia-384"
126 31 Christophe Reymann
source /opt/ros/kinetic/setup.bash
127
source /home/ubuntu/sim/precidrones-main/dev/ros_workspace/devel/setup.bash
128 1 Christophe Reymann
</pre>
129 25 Christophe Reymann
130 31 Christophe Reymann
Only one container has to be setup, then it can simply be copied across machines:
131 25 Christophe Reymann
<pre>
132
TODO
133
</pre>