Installing simulation environment » History » Version 49
Christophe Reymann, 2018-09-28 16:31
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 | 46 | Christophe Reymann | * Python3 with setuptools, docopt, numpy, pyyaml, ruamel.yaml >=0.15, 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 | 49 | Christophe Reymann | * 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-image-transport 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 | 48 | Christophe Reymann | * LXD available over the network: yes |
52 | 19 | Christophe Reymann | * 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 | 45 | Christophe Reymann | Install nvidia container runtime (see github https://github.com/NVIDIA/nvidia-container-runtime ): |
64 | 1 | Christophe Reymann | <pre> |
65 | 45 | Christophe Reymann | curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | sudo apt-key add - |
66 | 22 | Christophe Reymann | distribution=$(. /etc/os-release;echo $ID$VERSION_ID) |
67 | 1 | Christophe Reymann | 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 |
68 | 45 | Christophe Reymann | sudo apt update |
69 | 22 | Christophe Reymann | sudo apt install nvidia-container-runtime |
70 | </pre> |
||
71 | 1 | Christophe Reymann | |
72 | 37 | Christophe Reymann | Configuring the container *(check display number and adjust, eg X0 -> X1 for DISPLAY=:1; idem for nvidia-libs version number)*: |
73 | 22 | Christophe Reymann | <pre> |
74 | sudo lxc config device add precidrone-sim nvgpu gpu |
||
75 | 1 | Christophe Reymann | sudo lxc config set precidrone-sim nvidia.runtime true |
76 | 37 | Christophe Reymann | sudo lxc config device add precidrone-sim nvidia-libs disk path=/usr/lib/nvidia-384 source=/usr/lib/nvidia-384 |
77 | 22 | Christophe Reymann | sudo lxc config device add precidrone-sim X0 disk path=/tmp/.X11-unix/X0 source=/tmp/.X11-unix/X0 |
78 | sudo lxc config device add precidrone-sim Xauthority disk path=/home/ubuntu/.Xauthority source=${HOME}/.Xauthority |
||
79 | sudo lxc config device add precidrone-sim precidrone-simroot disk source=/net/skyscanner/volume1/data/precidrone path=/home/ubuntu/sim |
||
80 | printf "uid $(id -u) 1000\ngid $(id -g) 1000" | sudo lxc config set precidrone-sim raw.idmap - |
||
81 | 47 | Christophe Reymann | sudo lxc config set precidrone-sim limits.memory.swap false |
82 | 22 | Christophe Reymann | sudo lxc restart precidrone-sim |
83 | </pre> |
||
84 | 24 | Christophe Reymann | |
85 | Then open shell in the container: |
||
86 | <pre> |
||
87 | sudo lxc exec precidrone-sim -- sudo -i -u ubuntu |
||
88 | </pre> |
||
89 | |||
90 | 21 | Christophe Reymann | Installing dependencies: |
91 | <pre> |
||
92 | sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' |
||
93 | sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 |
||
94 | sudo apt update |
||
95 | 49 | Christophe Reymann | 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 ros-kinetic-image-transport |
96 | 22 | Christophe Reymann | sudo apt install python3-pip python3-setuptools python3-docopt python3-numpy python3-yaml |
97 | 46 | Christophe Reymann | sudo pip3 install rospkg catkin_pkg ruamel.yaml |
98 | 22 | Christophe Reymann | sudo apt install libglew1.13 libglew-dev |
99 | sudo apt install blender |
||
100 | 24 | Christophe Reymann | </pre> |
101 | 27 | Christophe Reymann | A GDAL >2 doesn't ship with ubuntu 16.04, you can do |
102 | 1 | Christophe Reymann | <pre> |
103 | 27 | Christophe Reymann | sudo add-apt-repository -y ppa:ubuntugis/ppa |
104 | sudo apt update |
||
105 | 42 | Christophe Reymann | sudo apt install libgdal20 libgdal-dev libgeos++-dev |
106 | 26 | Christophe Reymann | </pre> |
107 | 24 | Christophe Reymann | |
108 | 1 | Christophe Reymann | If necessary compile sim source: |
109 | 24 | Christophe Reymann | <pre> |
110 | cd sim/precidrones-main/dev |
||
111 | 27 | Christophe Reymann | make DEVEL=t INSTALL_USER=t CMAKE_BUILD_TYPE=Release -j8 |
112 | 24 | Christophe Reymann | </pre> |
113 | 34 | Christophe Reymann | |
114 | 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: |
115 | <pre> |
||
116 | ln -s ../../IGN IGN |
||
117 | </pre> |
||
118 | |||
119 | 34 | Christophe Reymann | Before running the simulation: |
120 | * Import morse simulation scenario, for example: |
||
121 | <pre> |
||
122 | morse import sim/precidrones-main/dev/morse/preci1 |
||
123 | </pre> |
||
124 | 1 | Christophe Reymann | |
125 | 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): |
126 | 24 | Christophe Reymann | <pre> |
127 | 1 | Christophe Reymann | export DISPLAY=:0 |
128 | 38 | Christophe Reymann | export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/nvidia-384" |
129 | 31 | Christophe Reymann | source /opt/ros/kinetic/setup.bash |
130 | source /home/ubuntu/sim/precidrones-main/dev/ros_workspace/devel/setup.bash |
||
131 | 1 | Christophe Reymann | </pre> |
132 | 25 | Christophe Reymann | |
133 | 31 | Christophe Reymann | Only one container has to be setup, then it can simply be copied across machines: |
134 | 25 | Christophe Reymann | <pre> |
135 | TODO |
||
136 | </pre> |