New iteration with a few fixes.

This commit is contained in:
sergi-e 2020-07-29 22:37:14 +02:00 committed by bernat
parent ab692ade56
commit f42f3df093
2 changed files with 11 additions and 12 deletions

View File

@ -836,7 +836,7 @@ A value of 1.5 means that we want the sensor to capture data each second and a h
<td>0.675</td>
<td>Intensity for the bloom post-process effect, <code>0.0</code> for disabling it.</td>
<tr>
<code>fov</code> </td>
<td><code>fov</code> </td>
<td>float</td>
<td>90.0</td>
<td>Horizontal field of view in degrees.</td>

View File

@ -1,15 +1,15 @@
# Generate maps with OpenStreetMap
OpenStreetMap is an open license map of the world developed by contributors. Sections of these map can be exported to an XML file. CARLA can convert this file to OpenDRIVE format and ingest it as any other OpenDRIVE map using the [OpenDRIVE Standalone Mode](#adv_opendrive.md). The process is quite straightforward.
OpenStreetMap is an open license map of the world developed by contributors. Sections of these map can be exported to a `.osm` file, the OpenSreetMap format, which is essentially an XML. CARLA can convert this file to OpenDRIVE format and ingest it as any other OpenDRIVE map using the [OpenDRIVE Standalone Mode](#adv_opendrive.md). The process is quite straightforward.
* [__1- Obtain a map with OpenStreetMap__](#1-obtain-a-map-with-openstreetmap)
* [__2- Convert to OpenDRIVE format__](#2-convert-to-OpenDRIVE-format)
* [__2- Convert to OpenDRIVE format__](#2-convert-to-opendrive-format)
* [__3- Import into CARLA__](#3-import-into-carla)
---
## 1- Obtain a map with OpenStreetMap
The first thing to do is using [OpenStreetMap](https://www.openstreetmap.org) to generate an XML file containing the map information.
The first thing to do is use [OpenStreetMap](https://www.openstreetmap.org) to generate the file containing the map information.
__1.1. Go to [openstreetmap.org](https://www.openstreetmap.org)__. If the map is not properly visualized, try changing the layer in the righ pannel.
@ -17,7 +17,7 @@ __1.2 Search for a desired location__ and zoom in to a specific area.
![openstreetmap_view](img/tuto_g_osm_web.jpg)
!!! Warning
Due to the Unreal Engine limitations, CARLA can ingest maps of a limited size (large cities like Paris pushes the limits of the engine). Additionally, the bigger the map, the longer the conversion to OpenDRIVE will take.
Due to the Unreal Engine limitations, CARLA can ingest maps of a limited size (large cities like Paris push the limits of the engine). Additionally, the bigger the map, the longer the conversion to OpenDRIVE will take.
__1.3.Click on `Export`__ in the upper left side of the window. The __Export__ pannel will open.
@ -25,14 +25,14 @@ __1.4. Click on `Manually select a different area`__ in the __Export__ pannel.
__1.5. Select a custom area__ by dragging the corners of the square area in the viewport.
__1.6. Click the `Export` button__ in the __Export__ pannel, and save the map information of the selected area as a XML file.
__1.6. Click the `Export` button__ in the __Export__ pannel, and save the map information of the selected area as a `.osm` file.
![openstreetmap_area](img/tuto_g_osm_area.jpg)
---
## 2- Convert to OpenDRIVE format
CARLA can read a XML file generated with OpenStreetMaps, and convert it to OpenDRIVE format that can be ingested as a CARLA map. This can be done through the PythonAPI using the following classes.
CARLA can read a the content in the `.osm` file generated with OpenStreetMap, and convert it to OpenDRIVE format so that it can be ingested as a CARLA map. This can be done using the following classes in the PythonAPI.
* __[carla.Osm2Odr](python_api.md#carla.Osm2Odr)__ The class that does the conversion. It takes the content of the `.osm` parsed as strind, and returns a string containing the resulting `.xodr`.
* `osm_file` — The content of the initial `.osm` file parsed as string.
@ -44,7 +44,6 @@ CARLA can read a XML file generated with OpenStreetMaps, and convert it to OpenD
* `default_lane_width` *(default 4.0)* — Determines the width that lanes should have in the resulting XODR file.
* `elevation_layer_height` *(default 0.0)* — Determines the height separating elements in different layers, used for overlapping elements. Read more on [layers](https://wiki.openstreetmap.org/wiki/Key:layer).
The input and output of the conversion are not the `.osm` and `.xodr` files itself, but their content. For said reason, the code should be similar to the following.
```
# Read the .osm data
@ -69,7 +68,8 @@ The resulting file contains the road information in OpenDRIVE format.
Finally, the OpenDRIVE file can be easily ingested in CARLA using the [OpenDRIVE Standalone Mode](#adv_opendrive.md).
__a) Using your own script__ — Call for [`client.generate_opendrive_world()`](python_api.md#carla.Client.generate_opendrive_world) through the API. This will generate the new map, and block the simulation until it is ready. Use the [carla.OpendriveGenerationParameters](python_api.md#carla.OpendriveGenerationParameters) class to set the parameterization of the mesh generation.
__a) Using your own script__ — Call for [`client.generate_opendrive_world()`](python_api.md#carla.Client.generate_opendrive_world) through the API. This will generate the new map, and block the simulation until it is ready.
Use the [carla.OpendriveGenerationParameters](python_api.md#carla.OpendriveGenerationParameters) class to set the parameterization of the mesh generation.
```
vertex_distance = 2.0 # in meters
@ -89,13 +89,12 @@ world = client.generate_opendrive_world(
!!! Note
`wall_height = 0.0` is strongly recommended. OpenStreetMap defines lanes in opposing directions as different roads. If walls are generated, this result in wall overlapping and undesired collisions.
__b) Using config.py__ — We also provide the means to load an OpenStreetMap file directly to CARLA using the `config.py` script provided with CARLA.
__b) Using `config.py`__ — The script can load an OpenStreetMap file directly into CARLA using a new argument.
```
config.py --osm-file=/path/to/OSM/file
```
!!! Warning
[client.generate_opendrive_world()](python_api.md#carla.Client.generate_opendrive_world) uses __content of the OpenDRIVE file parsed as string__, and allows parameterization. On the contrary, __`config.py`__ script needs __the path to the `.xodr` file__ and always uses default parameters.
[client.generate_opendrive_world()](python_api.md#carla.Client.generate_opendrive_world) requires the __content of the OpenDRIVE file parsed as string__, and allows parameterization. On the contrary, __`config.py`__ script needs __the path to the `.xodr` file__ and always uses default parameters.
Either way, the map should be ingested automatically in CARLA and the result should be similar to this.
![opendrive_meshissue](img/tuto_g_osm_carla.jpg)