diff --git a/Docs/core_world.md b/Docs/core_world.md index 4f0c439e9..ec2ebebc0 100644 --- a/Docs/core_world.md +++ b/Docs/core_world.md @@ -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. + +
+ Optional arguments in environment.py + +```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] +``` +

+ +* __`dynamic_weather.py`__ *(in `PythonAPI/examples`)* — Enables a particular weather cycle prepared by developers for each CARLA map. + +
+ Optional arguments in dynamic_weather.py + +```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) +``` +

+ !!! 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. diff --git a/Docs/python_api.md b/Docs/python_api.md index ec9cc2784..96d75ea0e 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -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. - **wetness** (_float_) Wetness intensity. It only affects the RGB camera sensor. Values range from 0 to 100. -- **falloff** (_float_) +- **fog_falloff** (_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 Fog Height Falloff in the UE docs.
If the value is 0, the fog will be lighter than air, and will cover the whole scene.
A value of 1 is approximately as dense as the air, and reaches normal-sized buildings.
For values greater than 5, the air will be so dense that it will be compressed on ground level.

Methods

-- **\__init__**(**self**, **cloudiness**=0.0, **precipitation**=0.0, **precipitation_deposits**=0.0, **wind_intensity**=0.0, **sun_azimuth_angle**=0.0, **sun_altitude_angle**=0.0, **fog_density**=0.0, **fog_distance**=0.0, **wetness**=0.0, **falloff**=0.2) +- **\__init__**(**self**, **cloudiness**=0.0, **precipitation**=0.0, **precipitation_deposits**=0.0, **wind_intensity**=0.0, **sun_azimuth_angle**=0.0, **sun_altitude_angle**=0.0, **fog_density**=0.0, **fog_distance**=0.0, **wetness**=0.0, **fog_falloff**=0.2) 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:** _ClearNoon, CloudyNoon, WetNoon, WetCloudyNoon, SoftRainNoon, MidRainyNoon, HardRainNoon, ClearSunset, CloudySunset, WetSunset, WetCloudySunset, SoftRainSunset, MidRainSunset, HardRainSunset. _ diff --git a/Docs/start_quickstart.md b/Docs/start_quickstart.md index 3b7f11e20..1c2d86bf9 100644 --- a/Docs/start_quickstart.md +++ b/Docs/start_quickstart.md @@ -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)__ diff --git a/Docs/tuto_A_map_customization.md b/Docs/tuto_A_map_customization.md index 562cfc53b..cd03e6666 100644 --- a/Docs/tuto_A_map_customization.md +++ b/Docs/tuto_A_map_customization.md @@ -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`. diff --git a/Docs/tuto_G_retrieve_data.md b/Docs/tuto_G_retrieve_data.md index badd05b5e..510b77eef 100644 --- a/Docs/tuto_G_retrieve_data.md +++ b/Docs/tuto_G_retrieve_data.md @@ -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 ```
- Optional arguments in weather.py + Optional arguments in environment.py ```sh -h, --help show this help message and exit diff --git a/PythonAPI/docs/weather.yml b/PythonAPI/docs/weather.yml index 544e90c28..9794239bf 100644 --- a/PythonAPI/docs/weather.yml +++ b/PythonAPI/docs/weather.yml @@ -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 Fog Height Falloff in the UE docs.
If the value is 0, the fog will be lighter than air, and will cover the whole scene.
A value of 1 is approximately as dense as the air, and reaches normal-sized buildings.
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: >