Skip to content

Commit 1e4c715

Browse files
committed
updated launch files
1 parent 58046fd commit 1e4c715

File tree

11 files changed

+52
-550
lines changed

11 files changed

+52
-550
lines changed

GADEN_tutorial.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
# GADEN TUTORIAL
88
# HOW TO SET UP YOUR OWN SIMULATIONS
99

10-
This document is a guide for creating a new environment, setting up the wind conditions and generating the desired gas dispersion withing it with Gaden. It is targeted at people who have little or no experience with CFD and CAS design.
10+
This document is a guide for creating a new environment, setting up the wind conditions and generating the desired gas dispersion within it with Gaden. It is targeted at people who have little or no experience with CFD and CAD design.
1111

1212
It is assumed that you have read and understood the general mechanism of [Gaden](http://www.mdpi.com/1424-8220/17/7/1479) and that you have downloaded and compiled the [GADEN ROS pkgs](https://github.com/MAPIRlab/gaden).
1313

1414

15-
If you use Gaden in your research, plese cite the paper:
15+
If you use Gaden in your research, please cite the paper:
1616

1717
> J. Monroy, V. Hernandez-Bennetts, H. Fan, A. Lilienthal, J. Gonzalez-Jimenez, GADEN: A 3D Gas
1818
Dispersion Simulator for Mobile Robot Olfaction in Realistic Environments. MDPI Sensors, vol. 17,
@@ -22,8 +22,7 @@ no. 7: 1479, pp. 1--16, 2017
2222

2323
## 1. CAD MODEL
2424

25-
The generation of a CAD model of the environment is the first step on every GADEN simulation. There is a wide range of CAD tools available both online and offline and for different expertise levels.
26-
Independent of your election, there are a couple of important facts to be considered when generating the CAD model of our new environment:
25+
The generation of a CAD model of the environment is the first step on every GADEN simulation. There is a wide range of CAD tools available both online and offline and for different expertise levels. Regardless of your choice of tool, there are a couple of important things to be considered when generating the CAD model of our new environment:
2726

2827
1. It must be understood that the CAD model we are going to employ is composed of two parts. Part_1 represents the walls, furniture, and objects in general that give shape to the environment, while Part_2 represents the “inner” volume of the environment where the gases are going to be released. In general, this is achieved by creating multiple “parts” in the CAD design, one representing walls and obstacles, and then obtaining the inner space as a different CAD part. If you are not an expert in CAD design (as it is my case), below you can find a very basic guide using a free online tool called [OnShape](https://cad.onshape.com).
2928

@@ -33,19 +32,20 @@ Independent of your election, there are a couple of important facts to be consid
3332

3433
### 1.1. CAD Model Example
3534
<img style="float: left;margin:0px 10px" src="tutorial/CAD_outlines.jpg" width="300">
36-
In this simple example, we employ a free basic online application named [OnShape](https://cad.onshape.com), which has plenty of video tutorials in case of need. In the process, we may need to generate different CAD parts for the rooms, walls, furniture, obstacles, inlets, and outlets, etc., but keep in mind that we also need the CAD model of the free space left (inner volume). Having this in mind, the basic commands to use in the case of OnShape are:
35+
In this simple example, we employ a free basic online application named [OnShape](https://cad.onshape.com), which has plenty of video tutorials. During this process, we may need to generate different CAD parts for the rooms, walls, furniture, obstacles, inlets, and outlets, etc., but keep in mind that we also need the CAD model of the free space left (inner volume). Having this in mind, the basic commands to use in the case of OnShape are:
3736

3837

3938
- **Sketch** → Creates a new plane in which to draw parts. It is the basic and mandatory item for every CAD model. We will start with a rectangle (representing the inner volume), and drawing on it any desired obstacle (or we can also use another sketch for it).
4039
- **Extrude** → It allows adding volume to a Sketch. That is, we create a sketch plane, draw for example some obstacles on it, and then rise it up to a volume with the extrude option.
4140
- **Boolean** → This option allows the intersection/add/subtraction of different parts of the CAD model. This is very interesting for merging parts and for obtaining the “inner” volume of the environment as a single CAD part.
4241

43-
To illustrate this phase, we show here the CAD models of an office-like environment. First,we obtain the CAD model of the inner volume (part_2 to be used for wind simulation), and then a second CAD part representing the obstacles and walls of our environment (part_1 to be used byGADEN filament simulator).
42+
To illustrate this phase, we show here the CAD models of an office-like environment. First,we obtain the CAD model of the inner volume (part_2, to be used for wind simulation), and then a second CAD part representing the obstacles and walls of our environment (part_1, to be used by GADEN filament simulator).
4443

4544

4645
<img style="float: right;" src="tutorial/CAD_interior_volume.jpg" width="250">
4746

4847
<br>
48+
4949
**PART_2**: Inner volume where wind flow would be simulated
5050
using CFD (see Section 2). Most CFD tools only accept one
5151
CAD part, so it is important that this CAD model is composed
@@ -71,7 +71,7 @@ Pictures of the office-like environment as seen on RVIZ. Different CAD parts hav
7171

7272

7373
## 2. CFD Wind Flow Simulation
74-
The simulation of the wind flows within our newly created environment is a very complex processand depends on multiple parameters. The most common approach is to obtain a “more or less” realistic approximation by means of Computational Fluid Dynamics (CFD). In this tutorial, we rely on the free and open access platform named OpenFOAM, arguably one of the most widespread and active open-source CFD projects. OpenFOAM takes as input the polyMesh of the inner volume of the environment, together with an extensive list of parameters that control the simulation process, such as boundary wind conditions, transient or steady simulation, turbulence level (i.e., Reynolds number), material properties, solver, etc.
74+
The simulation of the wind flows within our newly created environment is a very complex process and depends on multiple parameters. The most common approach is to obtain a realistic approximation by means of Computational Fluid Dynamics (CFD). In this tutorial, we rely on the free and open access platform named OpenFOAM, arguably one of the most widespread and active open-source CFD projects. OpenFOAM takes as input the polyMesh of the inner volume of the environment, together with an extensive list of parameters that control the simulation process, such as boundary wind conditions, transient or steady simulation, turbulence level (i.e., Reynolds number), material properties, solver, etc.
7575

7676
In general, non-experts in fluid dynamics may find this software too complex and with too many parameters, leading to unsuccessful simulations on many occasions. To relax this drawback, different graphical tools have appeared in the last years to control OpenFOAM from a more user-friendly interface. This is the case, for example, of [SimScale](https://www.simscale.com), a web-based tool which allows importing the inner volume of the environment as a CAD model, generating the mesh required by OpenFOAM, and configuring the most important parameters of the CFD simulation through an easy and intuitive interface. There are many other tools for interfacing OpenFOAM, or you can even work directly with it if you feel confident.
7777

@@ -89,10 +89,9 @@ For those willing to work with SimScale, here you can find a very basic guide of
8989

9090
<img style="float: right;" src="tutorial/Simscale_cells.jpg" width="250">
9191

92-
2. **Generate the PolyMesh** from the CAD model. It is recommended not to use the
93-
automatic mesh tool, but to try to obtain a more rigid grid based on cubes by using the “Hex-dominant parametric” tool, under the “Mesh-Creator” tab. The reason is that GADEN will work with a perfect 3D grid of cube cells, so as close the simulations of OpenFOAM are to this perfect grid, the better results we will obtain. <br><br> For the “Hex-dominant parametric” tool we need to define the outer environment dimensions (i.e the bounding box). Since we are only interested in wind simulations within the environment, we can set it to the real dimensions of the environment. Similarly, we need to set the number of cells on each dimension. Here we need to ensure that the environment dimensions are multiple of the cell dimension used, since in another case we will face problems with cells falling half in an obstacle, half in free space.
92+
2. **Generate the PolyMesh** from the CAD model. It is recommended not to use the automatic mesh tool, but to try to obtain a more rigid grid based on cubes by using the “Hex-dominant parametric” tool, under the “Mesh-Creator” tab. The reason is that GADEN will work with a perfect 3D grid of cube cells, so as close the simulations of OpenFOAM are to this perfect grid, the better results we will obtain. <br><br> For the “Hex-dominant parametric” tool we need to define the outer environment dimensions (i.e the bounding box). Since we are only interested in wind simulations within the environment, we can set it to the real dimensions of the environment. Similarly, we need to set the number of cells on each dimension. Here we need to ensure that the environment dimensions are multiple of the cell dimension used, since in another case we will face problems with cells falling half in an obstacle, half in free space.
9493

95-
3. **Run Simulation:** Once the mesh has been generated, we need to set the simulation parameters. We focus on Fluid Dynamics - Incompressible flows - k-epsilon turbulence model - Transient simulation with the PIMPLE solver. Other options can also be selected according to the desired results. We select the mesh to simulate over it and set the medium as “AIR”. We also need to set the Boundary conditions, setting an input wind speed for the inlets of our environment, and constant pressure at the outlets. The walls and obstacles need also to be defined as “slip/non-slip” boundary conditions. As a tip set a short interval simulation step to allow a nice convergence of the algorithms, but allow an “adjustable timestep”, setting the max courant number to 0.7. Since this option will cause the time-steps to vary in length, set the writing parameters to “Adjustable at runtime” and select the time interval to save the data.
94+
3. **Run Simulation:** Once the mesh has been generated, we need to set the simulation parameters. We focus on Fluid Dynamics - Incompressible flows - k-epsilon turbulence model - Transient simulation with the PIMPLE solver. Other options can also be selected according to the desired results. We select the mesh to simulate in it and set the medium as “AIR”. We also need to set the Boundary conditions, setting an input wind speed for the inlets of our environment, and constant pressure at the outlets. The walls and obstacles need also to be defined as “slip/non-slip” boundary conditions. As a tip set a short interval simulation step to allow a nice convergence of the algorithms, but allow an “adjustable timestep”, setting the max courant number to 0.7. Since this option will cause the time-steps to vary in length, set the writing parameters to “Adjustable at runtime” and select the time interval to save the data.
9695

9796

9897
<div style="width:400px; margin:0 auto;">
@@ -110,8 +109,8 @@ Snapshot of the wind flow in the simulated environment
110109
Once the CFD simulation is finished, download the result data (in OpenFoam format) to your computer. Then open it with the OpenFOAM viewer, called ParaView. With this application, you can ensure that the wind flow results are correct (at least that they seem to be representative of the boundary conditions you established). It must be noticed that for most simulations neither all the cells are perfect cubes, nor they are equally sized. To solve this problem (in GADEN we need a perfect 3D grid with uniform cell sizes), we can apply in ParaView the “cell centers” filter, and then export the data to a CSV file. This file will be a list of points (x,y,z) with their corresponding wind conditions (u,v,w). This way we simplify the problem of non-uniform cell dimensions. As a tip, when applying the “centerCells” filter, ensure that you have selected the option “Vertex Cells” to be able to display the center of the cells as points in the Paraview visualization frame. Snapshot of the wind flows in our new environment after applying the cell_centers filter in ParaView.
111110

112111
## 4. PreProcessing of GADEN Data
113-
At this step, we have all the data we need to start the gas dispersal simulation, but we still need to get it to the right format for GADEN. That is, we need to turn the CAD models describing the environment (walls, furniture, etc) and the point cloud of wind flow vectors into 3D cubic grids of occupancy and wind, respectively. GADEN includes a node (the gaden_preprocessing node) that does this work for us. We will only need to provide this node with:
114-
- The CAD models describing the environment (part_1) in .stl format. As described above, for the environment we can set up multiple CAD parts, making even more dynamic the simulations. Paths to the CAD models are specified as parameters “model_0” to “model_n” in the configuration file.
112+
At this step, we have all the data we need to start the gas dispersal simulation, but we still need to get it to the right format for GADEN. That is, we need to turn the CAD models describing the environment (walls, furniture, etc) and the point cloud of wind flow vectors into 3D cubic grids of occupancy and wind, respectively. GADEN includes a node (the *gaden_preprocessing* node) that does this work for us. We will only need to provide this node with:
113+
- The CAD models describing the environment (**part_1**) in .stl format. As described above, for the environment we can set up multiple CAD parts, making even more dynamic the simulations. Paths to the CAD models are specified as parameters “model_0” to “model_n” in the configuration file.
115114
- A separate CAD model (.stl) containing the shape and dimensions of the outlets considered in the environment. It is important to notice that GADEN requires this “outlet” CAD model to be able to “remove” the gases released in the environment. However, this is not mandatory, you may set up an environment where the gases just get trapped inside the environment.
116115
- The coordinates of a 3D-point in the environment that we know falls in free-space (not inside of an obstacle). This is used to differentiate free space (where gases will be dispersed) from the interior of obstacles.
117116
- The desired resolution of the gas simulation, that is, the cell size.

test_env/launch/gaden_preproc_launch.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
from launch.actions import IncludeLaunchDescription
1212
from launch.launch_description_sources import PythonLaunchDescriptionSource, FrontendLaunchDescriptionSource
1313
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
14-
from launch.substitutions import LaunchConfiguration, PythonExpression
14+
from launch.substitutions import LaunchConfiguration, PythonExpression, PathJoinSubstitution
1515
from launch_ros.actions import Node
1616
from launch_ros.parameter_descriptions import ParameterFile
17-
from nav2_common.launch import RewrittenYaml
1817
from launch.conditions import IfCondition
1918
from ament_index_python.packages import get_package_share_directory
2019

@@ -82,7 +81,11 @@ def generate_launch_description():
8281
),
8382
condition=IfCondition( PythonExpression([str(generateCoppeliaScene)]) ),
8483
launch_arguments={
85-
'coppelia_scene_path': os.path.join(get_package_share_directory('test_env'), 'navigation_config', 'default_coppelia_scene.ttt'),
84+
'coppelia_scene_path': PathJoinSubstitution([
85+
get_package_share_directory('test_env'),
86+
'navigation_config',
87+
'default_coppelia_scene.ttt'
88+
]),
8689
'coppelia_headless': 'True',
8790
}.items()
8891
)
Binary file not shown.

0 commit comments

Comments
 (0)