First iteration

This commit is contained in:
sergi-e 2020-09-09 16:48:04 +02:00 committed by bernat
parent fd89ec4cd7
commit d18a506edf
15 changed files with 37 additions and 36 deletions

View File

@ -76,15 +76,15 @@ world.apply_settings(settings)
``` ```
And here is an example on how to disable and then enable rendering using the `config.py`. And here is an example on how to disable and then enable rendering using the `config.py`.
```sh ```sh
cd PythonAPI/util && ./config.py --no-rendering cd PythonAPI/util && python3 config.py --no-rendering
``` ```
```sh ```sh
cd PythonAPI/util && ./config.py --rendering cd PythonAPI/util && python3 config.py --rendering
``` ```
The script `PythonAPI/examples/no_rendering_mode.py` will enable no-rendering mode, and use __Pygame__ to create an aerial view using simple graphics. The script `PythonAPI/examples/no_rendering_mode.py` will enable no-rendering mode, and use __Pygame__ to create an aerial view using simple graphics.
```sh ```sh
cd PythonAPI/examples && ./no_rendering_mode.py cd PythonAPI/examples && python3 no_rendering_mode.py
``` ```
!!! Warning !!! Warning

View File

@ -27,13 +27,13 @@ Run a CARLA simulation with __Town04__.
cd ~/carla cd ~/carla
./CarlaUE4.sh ./CarlaUE4.sh
cd PythonAPI/util cd PythonAPI/util
python config.py --map Town04 python3 config.py --map Town04
``` ```
Then, run the SUMO co-simulation example. Then, run the SUMO co-simulation example.
```sh ```sh
cd ~/carla/Co-Simulation/Sumo cd ~/carla/Co-Simulation/Sumo
python run_synchronization.py examples/Town04.sumocfg --sumo-gui python3 run_synchronization.py examples/Town04.sumocfg --sumo-gui
``` ```
!!! Important !!! Important
@ -83,7 +83,7 @@ Once a simulation is ready and saved as a `.sumocfg`, it is ready to run. There
* __`--tls-manager`__ *(default: none)* — Choose which simulator should manage the traffic lights. The other will update those accordingly. The options are `carla`, `sumo`, and `none`. If `none` is chosen, traffic lights will not be synchronized. Each vehicle would only obey the traffic lights in the simulator that spawn it. * __`--tls-manager`__ *(default: none)* — Choose which simulator should manage the traffic lights. The other will update those accordingly. The options are `carla`, `sumo`, and `none`. If `none` is chosen, traffic lights will not be synchronized. Each vehicle would only obey the traffic lights in the simulator that spawn it.
```sh ```sh
python run_synchronization.py <SUMOCFG FILE> --tls-manager carla --sumo-gui python3 run_synchronization.py <SUMOCFG FILE> --tls-manager carla --sumo-gui
``` ```
!!! Warning !!! Warning
@ -114,7 +114,7 @@ As the script runs a synchronous simulation, and spawns vehicles in it, the argu
# Spawn 10 vehicles, that will be managed by SUMO instead of Traffic Manager. # Spawn 10 vehicles, that will be managed by SUMO instead of Traffic Manager.
# CARLA in charge of traffic lights. # CARLA in charge of traffic lights.
# Open a window for SUMO visualization. # Open a window for SUMO visualization.
python spawn_sumo_npc.py -n 10 --tls-manager carla --sumo-gui python3 spawn_sumo_npc.py -n 10 --tls-manager carla --sumo-gui
``` ```
--- ---

View File

@ -35,7 +35,7 @@ world.apply_settings(settings)
``` ```
`PythonAPI/util/config.py` sets the time-step using an argument. Zero equals variable time-step. `PythonAPI/util/config.py` sets the time-step using an argument. Zero equals variable time-step.
```sh ```sh
cd PythonAPI/util && ./config.py --delta-seconds 0 cd PythonAPI/util && python3 config.py --delta-seconds 0
``` ```
### Fixed time-step ### Fixed time-step
@ -52,7 +52,7 @@ world.apply_settings(settings)
This can also be set using the provided script `PythonAPI/util/config.py`. This can also be set using the provided script `PythonAPI/util/config.py`.
```sh ```sh
cd PythonAPI/util && ./config.py --delta-seconds 0.05 cd PythonAPI/util && python3 config.py --delta-seconds 0.05
``` ```
### Tips when recording the simulation ### Tips when recording the simulation
@ -101,7 +101,7 @@ world.apply_settings(settings)
To disable synchronous mode just set the variable to false or use the script `PythonAPI/util/config.py`. To disable synchronous mode just set the variable to false or use the script `PythonAPI/util/config.py`.
```sh ```sh
cd PythonAPI/util && ./config.py --no-sync # Disables synchronous mode cd PythonAPI/util && python3 config.py --no-sync # Disables synchronous mode
``` ```
Synchronous mode cannot be enabled using the script, only disabled. Enabling the synchronous mode makes the server wait for a client tick. Using this script, the user cannot send ticks when desired. Synchronous mode cannot be enabled using the script, only disabled. Enabling the synchronous mode makes the server wait for a client tick. Using this script, the user cannot send ticks when desired.

View File

@ -295,7 +295,7 @@ Go to `Edit/Editor Preferences/Performance` in the editor preferences, and disab
Some scripts have requirements. These are listed in files named __Requirements.txt__, in the same path as the script itself. Be sure to check these in order to run the script. The majority of them can be installed with a simple `pip` command. Some scripts have requirements. These are listed in files named __Requirements.txt__, in the same path as the script itself. Be sure to check these in order to run the script. The majority of them can be installed with a simple `pip` command.
Sometimes on Windows, scripts cannot run with just `> script_name.py`. Try adding `> python script_name.py`, and make sure to be in the right directory. Sometimes on Windows, scripts cannot run with just `> script_name.py`. Try adding `> python3 script_name.py`, and make sure to be in the right directory.
</details> </details>

View File

@ -87,7 +87,7 @@ make PythonAPI
# Press play in the Editor to initialize the server, and run an example script to test CARLA. # Press play in the Editor to initialize the server, and run an example script to test CARLA.
cd PythonAPI/examples cd PythonAPI/examples
python3 spawn_npc.py python3 spawn_npc.py # Support for Python2 was provided until 0.9.10 (not included)
``` ```
</details> </details>
@ -264,7 +264,7 @@ The project may ask to build other instances such as `UE4Editor-Carla.dll` the f
* __make PythonAPI__ compiles the API client, necessary to grant control over the simulation. It is only needed the first time. Remember to run it again when updating CARLA. Scripts will be able to run after this command is executed. The following example will spawn some life into the town. * __make PythonAPI__ compiles the API client, necessary to grant control over the simulation. It is only needed the first time. Remember to run it again when updating CARLA. Scripts will be able to run after this command is executed. The following example will spawn some life into the town.
```sh ```sh
make PythonAPI && cd PythonAPI/examples && python3 spawn_npc.py make PythonAPI && cd PythonAPI/examples && python3 spawn_npc.py # Support for Python2 was provided until 0.9.10 (not included)
``` ```
!!! Important !!! Important
If the simulation is running at very low FPS rates, go to `Edit/Editor preferences/Performance` in the UE editor and disable __Use less CPU when in background__. If the simulation is running at very low FPS rates, go to `Edit/Editor preferences/Performance` in the UE editor and disable __Use less CPU when in background__.

View File

@ -52,7 +52,7 @@ make launch
make PythonAPI make PythonAPI
# Press play in the Editor to initialize the server, and run an example script to test CARLA. # Press play in the Editor to initialize the server, and run an example script to test CARLA.
cd PythonAPI/Examples && python3 spawn_npc.py cd PythonAPI/Examples && python3 spawn_npc.py # Support for Python2 was provided until 0.9.10 (not included)
``` ```
</details> </details>
@ -154,7 +154,7 @@ The project may ask to build other instances such as `UE4Editor-Carla.dll` the f
* __make PythonAPI__ compiles the API client, necessary to grant control over the simulation. It is only needed the first time. Remember to run it again when updating CARLA. Scripts will be able to run after this command is executed. The following example will spawn some life into the town. * __make PythonAPI__ compiles the API client, necessary to grant control over the simulation. It is only needed the first time. Remember to run it again when updating CARLA. Scripts will be able to run after this command is executed. The following example will spawn some life into the town.
```sh ```sh
make PythonAPI && cd PythonAPI/examples && python3 spawn_npc.py make PythonAPI && cd PythonAPI/examples && python3 spawn_npc.py # Support for Python2 was provided until 0.9.10 (not included)
``` ```
!!! Important !!! Important
If the simulation is running at very low FPS rates, go to `Edit/Editor preferences/Performance` in the UE editor and disable __Use less CPU when in background__. If the simulation is running at very low FPS rates, go to `Edit/Editor preferences/Performance` in the UE editor and disable __Use less CPU when in background__.

View File

@ -30,7 +30,7 @@ This will re-generate the respective Markdown files inside `carla/Docs/`, which
--- ---
## Exceptions ## Exceptions
* Documentation generated via python scripts like PythonAPI reference * Documentation generated via Python scripts like PythonAPI reference
Handy markdown [cheatsheet][cheatlink]. Handy markdown [cheatsheet][cheatlink].

View File

@ -495,7 +495,7 @@ For a better realism, points in the cloud can be dropped off. This is an easy wa
Additionally, the `noise_stddev` attribute makes for a noise model to simulate unexpected deviations that appear in real-life sensors. For positive values, each point is randomly perturbed along the vector of the laser ray. The result is a LIDAR sensor with perfect angular positioning, but noisy distance measurement. Additionally, the `noise_stddev` attribute makes for a noise model to simulate unexpected deviations that appear in real-life sensors. For positive values, each point is randomly perturbed along the vector of the laser ray. The result is a LIDAR sensor with perfect angular positioning, but noisy distance measurement.
The rotation of the LIDAR can be tuned to cover a specific angle on every simulation step (using a [fixed time-step](adv_synchrony_timestep.md)). For example, to rotate once per step (full circle output, as in the picture below), the rotation frequency and the simulated FPS should be equal. <br> __1.__ Set the sensor's frequency `sensors_bp['lidar'][0].set_attribute('rotation_frequency','10')`. <br> __2.__ Run the simulation using `python config.py --fps=10`. The rotation of the LIDAR can be tuned to cover a specific angle on every simulation step (using a [fixed time-step](adv_synchrony_timestep.md)). For example, to rotate once per step (full circle output, as in the picture below), the rotation frequency and the simulated FPS should be equal. <br> __1.__ Set the sensor's frequency `sensors_bp['lidar'][0].set_attribute('rotation_frequency','10')`. <br> __2.__ Run the simulation using `python3 config.py --fps=10`.
![LidarPointCloud](img/lidar_point_cloud.jpg) ![LidarPointCloud](img/lidar_point_cloud.jpg)
@ -1329,7 +1329,7 @@ for detection in semantic_lidar_measurement:
The rotation of the LIDAR can be tuned to cover a specific angle on every simulation step (using a [fixed time-step](adv_synchrony_timestep.md)). For example, to rotate once per step (full circle output, as in the picture below), the rotation frequency and the simulated FPS should be equal. <br> The rotation of the LIDAR can be tuned to cover a specific angle on every simulation step (using a [fixed time-step](adv_synchrony_timestep.md)). For example, to rotate once per step (full circle output, as in the picture below), the rotation frequency and the simulated FPS should be equal. <br>
__1.__ Set the sensor's frequency `sensors_bp['lidar'][0].set_attribute('rotation_frequency','10')`. <br> __1.__ Set the sensor's frequency `sensors_bp['lidar'][0].set_attribute('rotation_frequency','10')`. <br>
__2.__ Run the simulation using `python config.py --fps=10`. __2.__ Run the simulation using `python3 config.py --fps=10`.
![LidarPointCloud](img/semantic_lidar_point_cloud.jpg) ![LidarPointCloud](img/semantic_lidar_point_cloud.jpg)

View File

@ -110,7 +110,7 @@ roslaunch carla_ros_bridge carla_ros_bridge_with_example_ego_vehicle.launch
</summary> </summary>
The path to CARLA Python is missing. The apt installation does this automatically, but it may be missing for other installations. Execute the following command with the complete path to the <i>.egg</i> file (included). Use the one supported by the Python version installed. The path to CARLA Python is missing. The apt installation does this automatically, but it may be missing for other installations. Execute the following command with the complete path to the <i>.egg</i> file (included). Use the one supported by the Python version installed.
<br> <br><br>
<i><small><b>Note: </b>.egg files may be either in `/PythonAPI/` or `/PythonAPI/dist/` depending on the CARLA installation.</small></i> <i><small><b>Note: </b>.egg files may be either in `/PythonAPI/` or `/PythonAPI/dist/` depending on the CARLA installation.</small></i>
```sh ```sh
@ -119,7 +119,7 @@ The path to CARLA Python is missing. The apt installation does this automaticall
Import CARLA from Python and wait for a sucess message to check the installation. Import CARLA from Python and wait for a sucess message to check the installation.
```sh ```sh
python -c 'import carla;print("Success")' python3 -c 'import carla;print("Success")'
``` ```
</details> </details>

View File

@ -47,7 +47,7 @@ cd /opt/carla-simulator
# Run a script to test CARLA. # Run a script to test CARLA.
cd PythonAPI/examples cd PythonAPI/examples
python3 spawn_npc.py python3 spawn_npc.py # Support for Python2 was provided until 0.9.10 (not included)
``` ```
</details> </details>
@ -146,8 +146,9 @@ Now it is time to start running scripts. The following example will spawn some l
# Go to the folder containing example scripts # Go to the folder containing example scripts
> cd PythonAPI/examples > cd PythonAPI/examples
> python3 spawn_npc.py > python3 spawn_npc.py # Support for Python2 was provided until 0.9.10 (not included)
``` ```
#### Command-line options #### Command-line options
There are some configuration options available when launching CARLA. There are some configuration options available when launching CARLA.

View File

@ -85,7 +85,7 @@ chmod 777 input_folder
__2. Run the script to cook the map.__ In the folder `~/carla/Util/Docker` there is a script that connects with the Docker image previously created, and makes the ingestion automatically. It only needs the path for the input and output files, and the name of the package to be ingested. If no `.json` is provided, the name must be `map_package`. __2. Run the script to cook the map.__ In the folder `~/carla/Util/Docker` there is a script that connects with the Docker image previously created, and makes the ingestion automatically. It only needs the path for the input and output files, and the name of the package to be ingested. If no `.json` is provided, the name must be `map_package`.
```sh ```sh
python docker_tools.py --input ~/path_to_input_folder --output ~/path_to_output_folder --packages map_package python3 docker_tools.py --input ~/path_to_input_folder --output ~/path_to_output_folder --packages map_package
``` ```
!!! Warning !!! Warning
If the argument `--package <package_name>` is not provided, the Docker will make a package of CARLA. If the argument `--package <package_name>` is not provided, the Docker will make a package of CARLA.

View File

@ -119,7 +119,7 @@ __1. Build a Docker image of Unreal Engine.__ Follow [these instructions](https:
__2. Run the script to cook the props.__ In the folder `~/carla/Util/Docker` there is a script that connects with the Docker image previously created, and makes the ingestion automatically. It only needs the path for the input and output files, and the name of the package to be ingested. __2. Run the script to cook the props.__ In the folder `~/carla/Util/Docker` there is a script that connects with the Docker image previously created, and makes the ingestion automatically. It only needs the path for the input and output files, and the name of the package to be ingested.
```sh ```sh
python docker_tools.py --input ~/path_to_package --output ~/path_for_output_assets --package=Package01 python3 docker_tools.py --input ~/path_to_package --output ~/path_for_output_assets --package=Package01
``` ```
__3. Locate the package__. The Docker should have generated the package `Package01.tar.gz` in the output path. This is the standalone package for the assets. __3. Locate the package__. The Docker should have generated the package `Package01.tar.gz` in the output path. This is the standalone package for the assets.

View File

@ -111,7 +111,7 @@ __4. Export the result__. Select all the meshes and the base of the skeleton a
* __11. Test the vehicle__. Launch CARLA, open a terminal in `PythonAPI/examples` and run the following command. * __11. Test the vehicle__. Launch CARLA, open a terminal in `PythonAPI/examples` and run the following command.
```sh ```sh
python manual_control.py --filter <model_name> # The name used in step 10.2 python3 manual_control.py --filter <model_name> # The name used in step 10.2
``` ```
--- ---

View File

@ -91,7 +91,7 @@ world = client.generate_opendrive_world(
__b) Using `config.py`__ — The script can load an OpenStreetMap file directly into CARLA using a new argument. __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 python3 config.py --osm-file=/path/to/OSM/file
``` ```
!!! Warning !!! Warning
[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. [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.

View File

@ -87,7 +87,7 @@ Open a new terminal. Change the map using the __config.py__ script.
``` ```
cd /opt/carla/PythonAPI/utils cd /opt/carla/PythonAPI/utils
./config.py --map Town01 python3 config.py --map Town01
``` ```
This script can enable different settings. Some of them will be mentioned during the tutorial, others will not. Hereunder there is a brief summary. This script can enable different settings. Some of them will be mentioned during the tutorial, others will not. Hereunder there is a brief summary.
@ -133,14 +133,14 @@ Each town is loaded with a specific weather that fits it, however this can be se
```sh ```sh
cd /opt/carla/PythonAPI/examples cd /opt/carla/PythonAPI/examples
python dynamic_weather.py --speed 1.0 python3 dynamic_weather.py --speed 1.0
``` ```
* __To set custom conditions__. Use the script __environment.py__. There are quite a lot of possible settings. Take a look at the optional arguments, and the documentation for [carla.WeatherParameters](python_api.md#carla.WeatherParameters). * __To set custom conditions__. Use the script __environment.py__. There are quite a lot of possible settings. Take a look at the optional arguments, and the documentation for [carla.WeatherParameters](python_api.md#carla.WeatherParameters).
```sh ```sh
cd /opt/carla/PythonAPI/util cd /opt/carla/PythonAPI/util
python environment.py --clouds 100 --rain 80 --wetness 100 --puddles 60 --wind 80 --fog 50 python3 environment.py --clouds 100 --rain 80 --wetness 100 --puddles 60 --wind 80 --fog 50
``` ```
<details> <details>
@ -182,7 +182,7 @@ Open a new terminal, and run __spawn_npc.py__ to spawn vehicles and walkers. Let
```sh ```sh
cd /opt/carla/PythonAPI/examples cd /opt/carla/PythonAPI/examples
python spawn_npc.py -n 50 -w 50 --safe python3 spawn_npc.py -n 50 -w 50 --safe
``` ```
<details> <details>
<summary> Optional arguments in <b>spawn_npc.py</b> </summary> <summary> Optional arguments in <b>spawn_npc.py</b> </summary>
@ -228,7 +228,7 @@ echo "export SUMO_HOME=/usr/share/sumo" >> ~/.bashrc && source ~/.bashrc
* With the CARLA server on, run the [SUMO-CARLA synchrony script](https://github.com/carla-simulator/carla/blob/master/Co-Simulation/Sumo/run_synchronization.py). * With the CARLA server on, run the [SUMO-CARLA synchrony script](https://github.com/carla-simulator/carla/blob/master/Co-Simulation/Sumo/run_synchronization.py).
```sh ```sh
cd ~/carla/Co-Simulation/Sumo cd ~/carla/Co-Simulation/Sumo
python run_synchronization.py examples/Town01.sumocfg --sumo-gui python3 run_synchronization.py examples/Town01.sumocfg --sumo-gui
``` ```
* A SUMO window should have opened. __Press Play__ in order to start traffic in both simulations. * A SUMO window should have opened. __Press Play__ in order to start traffic in both simulations.
``` ```
@ -632,7 +632,7 @@ The same `config.py` used to [set the map](#map-setting) can disable rendering,
``` ```
cd /opt/carla/PythonAPI/utils cd /opt/carla/PythonAPI/utils
./config.py --no-rendering --delta-seconds 0.05 # Never greater than 0.1s python3 config.py --no-rendering --delta-seconds 0.05 # Never greater than 0.1s
``` ```
!!! Warning !!! Warning
@ -644,12 +644,12 @@ The script `PythonAPI/examples/no_rendering_mode.py` provides an overview of the
``` ```
cd /opt/carla/PythonAPI/examples cd /opt/carla/PythonAPI/examples
python manual_control.py python3 manual_control.py
``` ```
``` ```
cd /opt/carla/PythonAPI/examples cd /opt/carla/PythonAPI/examples
python no_rendering_mode.py --no-rendering python3 no_rendering_mode.py --no-rendering
``` ```
<details> <details>
@ -712,7 +712,7 @@ while True:
``` ```
cd /opt/carla/PythonAPI/examples cd /opt/carla/PythonAPI/examples
python manual_control.py python3 manual_control.py
``` ```
!!! Note !!! Note
@ -742,7 +742,7 @@ It is time to run a new simulation.
To reenact the simulation, [choose a fragment](#choose-a-fragment) and run the script containing the code for the playback. To reenact the simulation, [choose a fragment](#choose-a-fragment) and run the script containing the code for the playback.
```sh ```sh
python tuto_replay.py python3 tuto_replay.py
``` ```
### Query the events ### Query the events