New iteration with changes on environment.py, light explanation and lights explanation
This commit is contained in:
parent
07fe7a7153
commit
45da3ae55e
|
@ -11,6 +11,7 @@ This tutorial goes from defining the basics and creation of these elements, to d
|
|||
* [__The world__](#the-world)
|
||||
* [Actors](#actors)
|
||||
* [Weather](#weather)
|
||||
* [Lights](#lights)
|
||||
* [Debugging](#debugging)
|
||||
* [World snapshots](#world-snapshots)
|
||||
* [World settings](#world-settings)
|
||||
|
@ -127,13 +128,75 @@ There are some weather presets that can be directly applied to the world. These
|
|||
```py
|
||||
world.set_weather(carla.WeatherParameters.WetCloudySunset)
|
||||
```
|
||||
|
||||
The weather can also be customized using two scripts provided by CARLA.
|
||||
|
||||
* __`environment.py`__ *(in `PythonAPI/util`)* — Provides access to weather and light parameters so that these can be changed in real time.
|
||||
|
||||
<details>
|
||||
<summary> Optional arguments in <b>environment.py</b> </summary>
|
||||
|
||||
```sh
|
||||
-h, --help show this help message and exit
|
||||
--host H IP of the host server (default: 127.0.0.1)
|
||||
-p P, --port P TCP port to listen to (default: 2000)
|
||||
--sun SUN Sun position presets [sunset | day | night]
|
||||
--weather WEATHER Weather condition presets [clear | overcast | rain]
|
||||
--altitude A, -alt A Sun altitude [-90.0, 90.0]
|
||||
--azimuth A, -azm A Sun azimuth [0.0, 360.0]
|
||||
--clouds C, -c C Clouds amount [0.0, 100.0]
|
||||
--rain R, -r R Rain amount [0.0, 100.0]
|
||||
--puddles Pd, -pd Pd Puddles amount [0.0, 100.0]
|
||||
--wind W, -w W Wind intensity [0.0, 100.0]
|
||||
--fog F, -f F Fog intensity [0.0, 100.0]
|
||||
--fogdist Fd, -fd Fd Fog Distance [0.0, inf)
|
||||
--wetness Wet, -wet Wet
|
||||
Wetness intensity [0.0, 100.0]
|
||||
```
|
||||
</details><br>
|
||||
|
||||
* __`dynamic_weather.py`__ *(in `PythonAPI/examples`)* — Enables a particular weather cycle prepared by developers for each CARLA map.
|
||||
|
||||
<details>
|
||||
<summary> Optional arguments in <b>dynamic_weather.py</b> </summary>
|
||||
|
||||
```sh
|
||||
-h, --help show this help message and exit
|
||||
--host H IP of the host server (default: 127.0.0.1)
|
||||
-p P, --port P TCP port to listen to (default: 2000)
|
||||
-s FACTOR, --speed FACTOR
|
||||
rate at which the weather changes (default: 1.0)
|
||||
```
|
||||
</details><br>
|
||||
|
||||
!!! Note
|
||||
Changes in the weather do not affect physics. They are only visuals that can be captured by the camera sensors.
|
||||
|
||||
__Night mode starts when sun_altitude_angle < 0__, which is considered sunset. This is when street and vehicle lights become especially relevant.
|
||||
__Night mode starts when sun_altitude_angle < 0__, which is considered sunset. This is when lights become especially relevant.
|
||||
|
||||
### Lights
|
||||
|
||||
* __Street lights__ automatically turn on when night mode starts. The lights are placed by the developers of the map, and accessible as [__carla.Light__](python_api.md#carla.Light) objects. Their properties can be changed at will. An instance of [__carla.LightManager__](python_api.md#carla.LightManager) can be retrieved to handle groups of lights.
|
||||
* __Street lights__ automatically turn on when the simulation enters night mode. The lights are placed by the developers of the map, and accessible as [__carla.Light__](python_api.md#carla.Light) objects. Properties such as color and intensity can be changed at will. The variable __light_state__ of type [__carla.LightState__](python_api.md#carla.LightState) allows setting all of these in one call.
|
||||
Street lights are categorized using their attribute __light_group__, of type [__carla.LightGroup__](python_api.md#carla.LightGroup). This allows to classify lights as street lights, building lights... An instance of [__carla.LightManager__](python_api.md#carla.LightManager) can be retrieved to handle groups of lights in one call.
|
||||
|
||||
```py
|
||||
# Get the light manager and lights
|
||||
lmanager = world.get_light_manager()
|
||||
mylights = lmanager.get_all_lights()
|
||||
|
||||
# Custom a specific light
|
||||
light01 = mylights[0]
|
||||
light01.turn_on()
|
||||
light01.set_intensity(100.0)
|
||||
state01 = carla.LightState(200.0,red,carla.LightGroup.Building,True)
|
||||
light01.set_light_state(state01)
|
||||
|
||||
# Custom a group of lights
|
||||
my_lights = lmanager.get_light_group(carla.LightGroup.Building)
|
||||
lmanager.turn_on(my_lights)
|
||||
lmanager.set_color(my_lights,carla.Color(255,0,0))
|
||||
lmanager.set_intensities(my_lights,list_of_intensities)
|
||||
```
|
||||
|
||||
* __Vehicle lights__ have to be turned on/off by the user. Each vehicle has a set of lights listed in [__carla.VehicleLightState__](python_api.md#carla.VehicleLightState). So far, not all vehicles have lights integrated. Here is a list of those that are available by the time of writing.
|
||||
* __Bikes.__ All of them have a front and back position light.
|
||||
|
@ -149,6 +212,9 @@ current_lights |= carla.VehicleLightState.Position
|
|||
vehicle.set_light_state(current_lights)
|
||||
```
|
||||
|
||||
!!! Note
|
||||
Lights can also be set in real time using the `environment.py` described in the [weather](#weather) section.
|
||||
|
||||
### Debugging
|
||||
|
||||
World objects have a [carla.DebugHelper](python_api.md#carla.DebugHelper) object as a public attribute. It allows for different shapes to be drawn during the simulation. These are used to trace the events happening. The following example would draw a red box at an actor's location and rotation.
|
||||
|
|
|
@ -2362,11 +2362,11 @@ Fog concentration or thickness. It only affects the RGB camera sensor. Values ra
|
|||
Fog start distance (in meters). Values range from 0 to infinite.
|
||||
- <a name="carla.WeatherParameters.wetness"></a>**<font color="#f8805a">wetness</font>** (_float_)
|
||||
Wetness intensity. It only affects the RGB camera sensor. Values range from 0 to 100.
|
||||
- <a name="carla.WeatherParameters.falloff"></a>**<font color="#f8805a">falloff</font>** (_float_)
|
||||
- <a name="carla.WeatherParameters.fog_falloff"></a>**<font color="#f8805a">fog_falloff</font>** (_float_)
|
||||
Density of the fog (as in specific mass) from 0 to infinity. The bigger the value, the more dense and heavy it will be, and the fog will reach smaller heights. Corresponds to <a href="https://docs.unrealengine.com/en-US/Engine/Actors/FogEffects/HeightFog/index.html#:~:text=Using%20Exponential%20Height%20Fog%20Features,-The%20sections%20below&text=Add%20a%20second%20fog%20layer,height%20falloff%2C%20and%20height%20offset">Fog Height Falloff</a> in the UE docs. <br> If the value is 0, the fog will be lighter than air, and will cover the whole scene. <br> A value of 1 is approximately as dense as the air, and reaches normal-sized buildings. <br> For values greater than 5, the air will be so dense that it will be compressed on ground level.
|
||||
|
||||
<h3>Methods</h3>
|
||||
- <a name="carla.WeatherParameters.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**cloudiness**=0.0</font>, <font color="#00a6ed">**precipitation**=0.0</font>, <font color="#00a6ed">**precipitation_deposits**=0.0</font>, <font color="#00a6ed">**wind_intensity**=0.0</font>, <font color="#00a6ed">**sun_azimuth_angle**=0.0</font>, <font color="#00a6ed">**sun_altitude_angle**=0.0</font>, <font color="#00a6ed">**fog_density**=0.0</font>, <font color="#00a6ed">**fog_distance**=0.0</font>, <font color="#00a6ed">**wetness**=0.0</font>, <font color="#00a6ed">**falloff**=0.2</font>)
|
||||
- <a name="carla.WeatherParameters.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**cloudiness**=0.0</font>, <font color="#00a6ed">**precipitation**=0.0</font>, <font color="#00a6ed">**precipitation_deposits**=0.0</font>, <font color="#00a6ed">**wind_intensity**=0.0</font>, <font color="#00a6ed">**sun_azimuth_angle**=0.0</font>, <font color="#00a6ed">**sun_altitude_angle**=0.0</font>, <font color="#00a6ed">**fog_density**=0.0</font>, <font color="#00a6ed">**fog_distance**=0.0</font>, <font color="#00a6ed">**wetness**=0.0</font>, <font color="#00a6ed">**fog_falloff**=0.2</font>)
|
||||
Method to initialize an object defining weather conditions. This class has some presets for different noon and sunset conditions listed in a note below.
|
||||
- **Parameters:**
|
||||
- `cloudiness` (_float_) – 0 is a clear sky, 100 complete overcast.
|
||||
|
@ -2378,7 +2378,7 @@ Method to initialize an object defining weather conditions. This class has some
|
|||
- `fog_density` (_float_) – Concentration or thickness of the fog, from 0 to 100.
|
||||
- `fog_distance` (_float_) – Distance where the fog starts in meters.
|
||||
- `wetness` (_float_) – Humidity percentages of the road, from 0 to 100.
|
||||
- `falloff` (_float_) – Density (specific mass) of the fog, from 0 to infinity.
|
||||
- `fog_falloff` (_float_) – Density (specific mass) of the fog, from 0 to infinity.
|
||||
- **Note:** <font color="#8E8E8E">_ClearNoon, CloudyNoon, WetNoon, WetCloudyNoon, SoftRainNoon, MidRainyNoon, HardRainNoon, ClearSunset, CloudySunset, WetSunset, WetCloudySunset, SoftRainSunset, MidRainSunset, HardRainSunset.
|
||||
_</font>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* __[CARLA installation](#carla-installation)__
|
||||
* a) deb CARLA installation
|
||||
* b) GitHub repository installation
|
||||
* __[Import additional assets](#import-addditional-assets)__
|
||||
* __[Import additional assets](#import-additional-assets)__
|
||||
* __[Running CARLA](#running-carla)__
|
||||
* Command-line options
|
||||
* __[Updating CARLA](#updating-carla)__
|
||||
|
|
|
@ -153,7 +153,7 @@ __3. Choose the desired town__ and modify the parameters.
|
|||
|
||||
### BP_Sky
|
||||
|
||||
This blueprint groups all the weather parameters. It can be loaded into the scene when there is no CARLA server running, and used to easily test different configurations before setting a new default weather.
|
||||
This blueprint groups all the weather parameters. It can be loaded into the scene when there is no CARLA server running, and used to ea test different configurations before setting a new default weather.
|
||||
|
||||
__1. Find the BP_Sky__ in `Content/Carla/Blueprints/Weather`.
|
||||
|
||||
|
|
|
@ -136,15 +136,15 @@ cd /opt/carla/PythonAPI/examples
|
|||
python dynamic_weather.py --speed 1.0
|
||||
```
|
||||
|
||||
* __To set custom conditions__. Use the script __weather.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
|
||||
cd /opt/carla/PythonAPI/util
|
||||
python weather.py --clouds 100 --rain 80 --wetness 100 --puddles 60 --wind 80 --fog 50
|
||||
python environment.py --clouds 100 --rain 80 --wetness 100 --puddles 60 --wind 80 --fog 50
|
||||
|
||||
```
|
||||
<details>
|
||||
<summary> Optional arguments in <b>weather.py</b> </summary>
|
||||
<summary> Optional arguments in <b>environment.py</b> </summary>
|
||||
|
||||
```sh
|
||||
-h, --help show this help message and exit
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
doc: >
|
||||
Wetness intensity. It only affects the RGB camera sensor. Values range from 0 to 100.
|
||||
# --------------------------------------
|
||||
- var_name: falloff
|
||||
- var_name: fog_falloff
|
||||
type: float
|
||||
doc: >
|
||||
Density of the fog (as in specific mass) from 0 to infinity. The bigger the value, the more dense and heavy it will be, and the fog will reach smaller heights. Corresponds to <a href="https://docs.unrealengine.com/en-US/Engine/Actors/FogEffects/HeightFog/index.html#:~:text=Using%20Exponential%20Height%20Fog%20Features,-The%20sections%20below&text=Add%20a%20second%20fog%20layer,height%20falloff%2C%20and%20height%20offset">Fog Height Falloff</a> in the UE docs. <br> If the value is 0, the fog will be lighter than air, and will cover the whole scene. <br> A value of 1 is approximately as dense as the air, and reaches normal-sized buildings. <br> For values greater than 5, the air will be so dense that it will be compressed on ground level.
|
||||
|
@ -109,7 +109,7 @@
|
|||
default: 0.0
|
||||
doc: >
|
||||
Humidity percentages of the road, from 0 to 100.
|
||||
- param_name: falloff
|
||||
- param_name: fog_falloff
|
||||
type: float
|
||||
default: 0.2
|
||||
doc: >
|
||||
|
|
Loading…
Reference in New Issue