Project

General

Profile

Running CAMS in simulation mode (Tutorial) » History » Version 29

Rafael Bailon-Ruiz, 2021-03-15 16:17

1 14 Rafael Bailon-Ruiz
h1. Running CAMS in simulation mode (Tutorial)
2 3 Rafael Bailon-Ruiz
3
This tutorial will teach you how to run the CAMS GUI with a simple scenario in simulation mode.
4
5
{{toc}}
6
7 25 Rafael Bailon-Ruiz
First of all, *make sure you have successfully completed the [[Installation]] tutorial*. Then, open a terminal and change the current directory to the folder where the core packages are installed.
8 3 Rafael Bailon-Ruiz
9 6 Rafael Bailon-Ruiz
<pre><code class="shell">
10
cd /path/to/nephelae_workspace
11
</code></pre>
12
13 25 Rafael Bailon-Ruiz
h2. Obtaining the simulated cloud environment files
14 3 Rafael Bailon-Ruiz
15 7 Rafael Bailon-Ruiz
In order to run CAMS in fully simulated mode first yout need a mesoNH file describing a synthetic atmospheric environment. MesoNH files are databases in "NetCDF _(.nc)_ format":https://en.wikipedia.org/wiki/NetCDF.
16 3 Rafael Bailon-Ruiz
17 26 Rafael Bailon-Ruiz
h3. Reduced cloud environment
18
19 27 Rafael Bailon-Ruiz
A sample of a full cloud simulation can be found here: "cloud_example.nc":/attachments/download/3295/cloud_example.nc (which is a crop of an small area of the file below)
20 26 Rafael Bailon-Ruiz
21 1 Rafael Bailon-Ruiz
h3. Complete cloud environment
22 27 Rafael Bailon-Ruiz
23 5 Rafael Bailon-Ruiz
The computer @girofle@ at LAAS contains a mesoNH file that can be used with CAMS. You can use the command below to mount the folder the remote folder as a local directory:
24 3 Rafael Bailon-Ruiz
25
<pre><code class="shell">
26
sshfs girofle.laas.fr:/media/Nephelae-Data/data/Nephelae/ mesonh_girofle_mount/
27
</code></pre>
28
29 7 Rafael Bailon-Ruiz
The recommended file for this tutorial is:
30 1 Rafael Bailon-Ruiz
31 7 Rafael Bailon-Ruiz
<pre>
32
REFHR.1.ARMCu.4D.nc
33
</pre>
34 3 Rafael Bailon-Ruiz
35 25 Rafael Bailon-Ruiz
Despite its huge size (~72 GB), the best way to work with this particular file is to download it to your computer. If you are at LAAS connected with an Ethernet cable, you have a high-bandwidth and low-latency link. Therefore you can read the files in the remote folder directly, but beware of errors that can occur if the quality of the connection degrades.
36 1 Rafael Bailon-Ruiz
37
h2. Scenario setup
38
39 9 Rafael Bailon-Ruiz
A valid configuration file is required to run the graphical interface server. Scenario configuration files describe the atmospheric environment and the UAVs so CAMS can use the appropriate algorithms and models to manage them. For this tutorial a simple configuration file is provided describing a scenario built upon a simulated atmosphere with cumulus clouds and two UAVs. 
40 3 Rafael Bailon-Ruiz
41 25 Rafael Bailon-Ruiz
1. Download the configuration file for this tutorial: https://redmine.laas.fr/projects/nephelae-devel/repository/nephelae_base/revisions/master/raw/examples/config/tutorial_simulation_mesonh_2uav.yaml
42 3 Rafael Bailon-Ruiz
43 25 Rafael Bailon-Ruiz
2. *You need adapt the following configuration values to match with the path of your CAMS workspace. Replace @/PATH/TO/@ with the actual path.*
44 1 Rafael Bailon-Ruiz
45
46
<pre>
47 10 Rafael Bailon-Ruiz
database: filepath: '/PATH/TO/database01.neph'  # CAMS database file. It stores the atmospheric and UAV information generated during the run
48
mesonh_files:  &mesonh_files '/PATH/TO/REFHR.1.ARMCu.4D.nc' # MesoNH simulation file.
49
aircrafts: 200: plugins: Missions: backup_file: '/PATH/TO/backup_200.bin' #
50
aircrafts: 201: plugins: Missions: backup_file: '/PATH/TO/backup_201.bin' #
51 8 Rafael Bailon-Ruiz
</pre>
52 1 Rafael Bailon-Ruiz
53 20 Rafael Bailon-Ruiz
There are many other options that can be set in this configuration file to adapt CAMS to your needs. For more information, there is a [[scenario configuration reference guide]] in the wiki but for now you should stay with the default setup.
54 8 Rafael Bailon-Ruiz
55 10 Rafael Bailon-Ruiz
TODO: Introduce & explain the main parameter groups in the configuration file to give an overview of the situation the user will be managing.
56 8 Rafael Bailon-Ruiz
57 10 Rafael Bailon-Ruiz
h2. Launch the UAV simulation with paparazzi
58 8 Rafael Bailon-Ruiz
59 11 Rafael Bailon-Ruiz
h3. Configure the UAVs
60
61 10 Rafael Bailon-Ruiz
Open a new terminal, change the current directory to the paparazzi installation folder and open the _Paparazzi center_ :
62 8 Rafael Bailon-Ruiz
63 10 Rafael Bailon-Ruiz
<pre><code class="shell">
64
cd /PATH/TO/paparazzi
65
./paparazzi
66 8 Rafael Bailon-Ruiz
</code></pre>
67 1 Rafael Bailon-Ruiz
68 11 Rafael Bailon-Ruiz
1. Select the aircraft *Lisa_Neph_0* from the A/C list
69
70 1 Rafael Bailon-Ruiz
2. Click build
71
72 11 Rafael Bailon-Ruiz
3. Repeat the same procedure with the *Lisa_Neph_1* aircraft
73
74 16 Rafael Bailon-Ruiz
{{thumbnail(paparazzi_center_instructions.png, size=600, title=Paparazzi center)}}
75 1 Rafael Bailon-Ruiz
76 19 Rafael Bailon-Ruiz
_You only need to do this operation once, unless you modify the UAVs or change computers!_
77 11 Rafael Bailon-Ruiz
78
h3. Start the simulation
79
80
Open two new terminal windows and run respectively to start the simulation of both UAVs:
81
82
<pre><code class="shell">
83 22 Rafael Bailon-Ruiz
cd nephelae_paparazzi/tests/sim_launchers && python3 sim_launcher.py Lisa_Neph_0 Lisa_Neph_1
84 11 Rafael Bailon-Ruiz
</code></pre>
85
86 22 Rafael Bailon-Ruiz
Three new windows will appear
87 11 Rafael Bailon-Ruiz
88
| !server_lisa_neph_0.png! | !server_lisa_neph_1.png! | 
89 1 Rafael Bailon-Ruiz
90
{{thumbnail(paparazzi_gcs_2_UAV_simulation_tutorial.png, size=600, title=Paparazzi GCS)}}
91
92 19 Rafael Bailon-Ruiz
Wait a couple of seconds for the simulation to warm up and then click on the *launch button* !gcs_launch_button.png! followed by the *takeoff button* !gcs_takeoff_button.png! on *Lisa_Neph_0* and *Lisa_Neph_1*
93 13 Rafael Bailon-Ruiz
94
h2. Run the CAMS GUI
95
96
Go to the installation folder of nephelae_gui and in a terminal, run:
97
98
<pre><code class="shell">
99
export NEPHELAE_CONFIG="/PATH/TO/tutorial_simulation_mesonh_2uav.yaml"
100
make runserver
101
</code></pre>
102
103
Replacing @/PATH/TO/@ with the actual path.
104
105
h2. Create a mission for a UAV
106
107 15 Rafael Bailon-Ruiz
Open the CAMS GUI on the _Mapping_ tab. Go http://0.0.0.0:8000/map/
108
109 16 Rafael Bailon-Ruiz
{{thumbnail(CAMS gui mapping web.png, size=600, title=CAMS GUI mapping tab)}}
110 15 Rafael Bailon-Ruiz
111
Click somewhere over the map —preferably over the center of a cloud indicated by green shades— and select _New mission_. The _create mission_ window for the aircraft 200 (Lisa_Neph_0) will appear. Click on _Create_ .
112
113 16 Rafael Bailon-Ruiz
{{thumbnail(CAMS gui create mission modal.png, size=300, title=CAMS GUI create mission dialog)}}
114 15 Rafael Bailon-Ruiz
115
Go to the _Mission Validation_ tab and _Authorize_ the request to send the new mission to the paparazzi GCS.
116
117 18 Rafael Bailon-Ruiz
{{thumbnail(CAMS gui mission validation.png, size=600, title=CAMS GUI mission validation)}}
118 15 Rafael Bailon-Ruiz
119
Switch to the paparazzi GCS window and click on the _Mission_ button !gcs_mission_button.png! corresponding to the Lisa_Neph_0 UAV. This will tell the drone to start the mission.
120
121 16 Rafael Bailon-Ruiz
Now you can follow the adaptive cloud mapping mission in the _Mapping_ tab of the CAMS GUI and monitor live raw data in the _Sensor data_ tab
122 15 Rafael Bailon-Ruiz
123 17 Rafael Bailon-Ruiz
| {{thumbnail(CAMS gui adaptive mapping.png, size=400, title=CAMS GUI mapping)}} | {{thumbnail(CAMS GUI raw data.png, size=400, title=CAMS GUI raw data)}} |
124 15 Rafael Bailon-Ruiz
125
!cloud_mapping_video.gif!
126 21 Rafael Bailon-Ruiz
127
*For more information about the possibilities of CAMS you can continue exploring the [[Graphical User Interface Reference guide]].*
128 23 Rafael Bailon-Ruiz
129
h2. Set an arbitrary horizontal wind for the UAVs
130
131
In the paparazzi center open the _Tools_ menu &#8594; _Environment Simulator_ to start the _Gaia_ window. You can select there the _desired wind_ and the _simulation speed_.
132
133 29 Rafael Bailon-Ruiz
p{border: solid 1px #FF8C00; padding: 1em; margin: 1em; background: #FEE}. %{color:darkorange; font-weight: bold; font-size: large}Warning:% Changing the time scale setting can produce unintended consequences with the accuracy of the flight simulation. *CAMS is tied to the wallclock so it will not be aware of this setting*!
134 28 Rafael Bailon-Ruiz
135
h2. See also
136
137
* [[Available datasets]]
138
* [[Working with the database]]