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