New draft with parameters. Pending questions.

This commit is contained in:
sergi-e 2020-04-14 15:13:22 +02:00 committed by Marc Garcia Puig
parent d2a16e9a47
commit 9d3d97377b
4 changed files with 52 additions and 37 deletions

View File

@ -31,12 +31,26 @@ Traffic lights, stops and yields will be generated on the fly, as happens when u
---
## Run a standalone map
In order to test this feature, the `config.py` script in `PythonAPI/util/` has a new argument, `-x` or `--xodr-path`. This argument contains a string with the path to the `.xodr` file. The script calls a client method, [`client.generate_opendrive_world()`](python_api.md#carla.Client.generate_opendrive_world). This will block the simulation, as [`load_world()`](python_api.md#carla.World.load_world) would do, until the new map is active.
In order to open an OpenDRIVE file, the Python API includes now the method [`client.generate_opendrive_world()`](python_api.md#carla.Client.generate_opendrive_world). This will block the simulation until the new one is ready. The method needs for two parameters.
* __`opendrive`__ is the content of the OpenDRIVE file parsed as a string.
* __`parameters`__ is a [carla.OpendriveGenerationParameters](python_api.md#carla.OpendriveGenerationParameters) containing settings for the generation of the mesh.
* `vertex_distance` is the distance between the vertices of the mesh. --> The bigger the more inaccuracies?? The smallest, the more detailed but heavier ??
* `max_road_length`
* `wall_height` states the height of the additional walls created on the boundaries of the road. These prevent vehicles from falling to the void.
* `additional_width` is an small width increment applied to the junction lanes. This is a safety measure to prevent vehicles from falling.
* `smooth_junctions` if __True__, the mesh at junctions will be smoothed, to prevent some inaccuracies that may occur when various lanes meet. --> And why can I choose to disable them??
* `enable_mesh_visibility` if __True__, the mesh will be rendered. --> If False? Vehicles rendered, no rendering mode or what?
In order to easily test this feature, the `config.py` script in `PythonAPI/util/` has a new argument, `-x` or `--xodr-path`. This argument contains a string with the path to the `.xodr` file. If the mesh is generated with this script, the parameters used will always be the default ones.
```sh
python3 config.py -x path/to/some/file.xodr
```
!!! Important
__[carla.OpendriveGenerationParameters](python_api.md#carla.OpendriveGenerationParameters)__ uses __content of the OpenDRIVE file parsed as string__. On the contrary, __`config.py`__ script needs __the path to the `.xodr` file__.
---
## Mesh generation

View File

@ -328,11 +328,11 @@ Executes a list of commands on a single simulation step, blocks until the comman
- `commands` (_list_) A list of commands to execute in batch. The commands available are listed right above, in the function **<font color="#7fb800">apply_batch()</font>**.
- `due_tick_cue` (_bool_) A boolean parameter to specify whether or not to perform a [carla.World.tick](#carla.World.tick) after applying the batch in _synchronous mode_. It is __False__ by default.
- **Return:** _list(command.Response)_
- <a name="carla.Client.generate_opendrive_world"></a>**<font color="#7fb800">generate_opendrive_world</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**opendrive**</font>, <font color="#00a6ed">**parameters**</font>)
- <a name="carla.Client.generate_opendrive_world"></a>**<font color="#7fb800">generate_opendrive_world</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**opendrive**</font>, <font color="#00a6ed">**parameters**=(2.0, 50.0, 1.0, 0.6, true, true)</font>)
Loads a new world with a basic 3D topology generated from the content of an OpenDRIVE file. This content is passed as a `string` parameter. It is similar to `client.load_world(map_name)` but allows for custom OpenDRIVE maps in server side. Cars can drive around the map, but there are no graphics besides the road and sidewalks.
- **Parameters:**
- `opendrive` (_str_) Content of an OpenDRIVE file as `string` (**NOT** the path of the `.xodr` file!).
- `parameters` (_[carla.OpendriveGenerationParameters](#carla.OpendriveGenerationParameters)_) Parameters used when generating a world using an OpenDRIVE file.
- `opendrive` (_str_) Content of an OpenDRIVE file as `string`, __not the path to the `.xodr`__.
- `parameters` (_[carla.OpendriveGenerationParameters](#carla.OpendriveGenerationParameters)_) Additional settings for the mesh generation. If none are provided, default values will be used.
- <a name="carla.Client.load_world"></a>**<font color="#7fb800">load_world</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**map_name**</font>)
Creates a new world with default settings using `map_name` map. All actors in the current world will be destroyed.
- **Parameters:**
@ -1078,17 +1078,17 @@ This class defines the parameters used when generating a world using an OpenDRIV
<h3>Instance Variables</h3>
- <a name="carla.OpendriveGenerationParameters.vertex_distance"></a>**<font color="#f8805a">vertex_distance</font>** (_float_)
The distance between vertices when generating the world mesh from OpenDRIVE.
Distance between vertices of the mesh generated. __Default is `2.0`__.
- <a name="carla.OpendriveGenerationParameters.max_road_length"></a>**<font color="#f8805a">max_road_length</font>** (_float_)
Max road length for a single mesh portion.
Max road length for a single mesh portion. The mesh of the map is divided into portions, in order to avoid propagating issues. __Default is `50.0`__.
- <a name="carla.OpendriveGenerationParameters.wall_height"></a>**<font color="#f8805a">wall_height</font>** (_float_)
Defines the height of walls added to roads to prevent vehicles from falling.
Height of walls created on the boundaries of the road. These prevent vehicles from falling off the road. __Default is `1.0`__.
- <a name="carla.OpendriveGenerationParameters.additional_width"></a>**<font color="#f8805a">additional_width</font>** (_float_)
Additional with to junction lanes to prevent vehicles from falling.
Additional with applied junction lanes. Complex situations tend to occur at junctions, and a little increase can prevent vehicles from falling off the road. __Default is `0.6`__.
- <a name="carla.OpendriveGenerationParameters.smooth_junctions"></a>**<font color="#f8805a">smooth_junctions</font>** (_bool_)
When this variable is `True` the generated junctions will be smoothed to prevent roads from blocking other roads.
If __True__, the mesh at junctions will be smoothed to prevent issues where roads blocked other roads. __Default is `True`__.
- <a name="carla.OpendriveGenerationParameters.enable_mesh_visibility"></a>**<font color="#f8805a">enable_mesh_visibility</font>** (_bool_)
This variable indicates whether the mesh should be rendered to reduce the rendering overhead.
If __True__, the road mesh will be rendered. Setting this to __False__ should reduce the rendering overhead. __Default is `True`__.
---

View File

@ -65,11 +65,12 @@
- param_name: opendrive
type: str
doc: >
Content of an OpenDRIVE file as `string` (**NOT** the path of the `.xodr` file!).
Content of an OpenDRIVE file as `string`, __not the path to the `.xodr`__.
- param_name: parameters
type: carla.OpendriveGenerationParameters
default: (2.0, 50.0, 1.0, 0.6, true, true)
doc: >
Parameters used when generating a world using an OpenDRIVE file.
Additional settings for the mesh generation. If none are provided, default values will be used.
doc: >
Loads a new world with a basic 3D topology generated from the content of an OpenDRIVE file. This content is passed as a `string` parameter.
It is similar to `client.load_world(map_name)` but allows for custom OpenDRIVE maps in server side.
@ -425,24 +426,24 @@
- var_name: vertex_distance
type: float
doc: >
The distance between vertices when generating the world mesh from OpenDRIVE.
Distance between vertices of the mesh generated. __Default is `2.0`__.
- var_name: max_road_length
type: float
doc: >
Max road length for a single mesh portion.
Max road length for a single mesh portion. The mesh of the map is divided into portions, in order to avoid propagating issues. __Default is `50.0`__.
- var_name: wall_height
type: float
doc: >
Defines the height of walls added to roads to prevent vehicles from falling.
Height of walls created on the boundaries of the road. These prevent vehicles from falling off the road. __Default is `1.0`__.
- var_name: additional_width
type: float
doc: >
Additional with to junction lanes to prevent vehicles from falling.
Additional with applied junction lanes. Complex situations tend to occur at junctions, and a little increase can prevent vehicles from falling off the road. __Default is `0.6`__.
- var_name: smooth_junctions
type: bool
doc: >
When this variable is `True` the generated junctions will be smoothed to prevent roads from blocking other roads.
If __True__, the mesh at junctions will be smoothed to prevent issues where roads blocked other roads. __Default is `True`__.
- var_name: enable_mesh_visibility
type: bool
doc: >
This variable indicates whether the mesh should be rendered to reduce the rendering overhead.
If __True__, the road mesh will be rendered. Setting this to __False__ should reduce the rendering overhead. __Default is `True`__.