Project

General

Profile

Installing simulation environment » History » Version 31

Christophe Reymann, 2018-05-18 17:11

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