Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
bernatx committed Nov 15, 2021
2 parents bb4b95e + ae65a52 commit a1b37f7
Show file tree
Hide file tree
Showing 152 changed files with 7,418 additions and 1,854 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
## CARLA 0.9.13

* Added new **instance aware semantic segmentation** sensor `sensor.camera.instance_segmentation`
* Added new API classes: `MaterialParameter`, `TextureColor` and `TextureFloatColor` to encode texture data and field (normal map, diffuse, etc)
* Added new API functions: `apply_color_texture_to_object`, `apply_float_color_texture_to_object` and `apply_textures_to_object` to paint objects in **runtime**
* Added the option for users to set a **route** using RoadOption elements to a vehicle controlled by the Traffic Manager.
* **Cache** now has an extra folder with current version of CARLA (so different cache per version)
* Added **set_percentage_random_left_lanechange** and **set_percentage_random_right_lanechange**.
* Improved handling of **collisions** in Traffic Manager when driving at **very high speeds**.
* Added physical simulation to **vehicle doors**, capable of opening and closing
* Added **open/close doors** feature for vehicles.
* Added API functions to **3D vectors**: `squared_length`, `length`, `make_unit_vector`, `dot`, `dot_2d`, `distance`, `distance_2d`, `distance_squared`, `distance_squared_2d`, `get_vector_angle`
* Added API functions to **2D vectors**: `squared_length`, `length`, `make_unit_vector`
* Added a **seed** for better reproducibility of pedestrians
- New API function `set_pedestrians_seed`
- New parameter **--seedw** in generate_traffic.py script
* Added missing dependency `libomp5` to **Release.Dockerfile**
* Added API functions to interact with **pedestrian bones**:
- `get_bones / set_bones`: to get/set the bones of a pedestrian
- `blend_pose`: to blend a custom pose with current animation
- `show_pose / hide_pose`: to show or hide the custom pose
- `get_pose_from_animation`: to set the custom pose with the animation current frame
* Added a new script in **PythonAPI/examples/draw_skeleton.py** to draw the bones of a pedestrian from client side
* Improved **collision** detection of the Python agents
* Added the new **VehicleLightStage** to the Traffic Manager to dynamically update the vehicle lights.
* Added two new examples to **PythonAPI/util**: Conversion of OpenStreetMaps to OpenDRIVE maps `osm_to_xodr.py` and Extraction of map spawn points `extract_spawn_points.py`
* Fixed the **import of props** without any map
* Fixed **global route planner** crash when being used at maps without lane markings
* Fixed bug causing the server to **sigsegv** when a vehicle collides an environment object in recording mode.
* Fixed **RSSSensor**: made client side calculations threaded
* Fixed **keep_right_rule** parameter.

## CARLA 0.9.12

* Changed the resolution of the cached map in Traffic Manager from 0.1 to 5 meters
Expand Down
59 changes: 59 additions & 0 deletions Docs/adv_synchrony_timestep.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,65 @@ CARLA supports physics and collision determinism under specific circumstances:
- __The world must be reloaded for each new repetition:__ Reload the world each time you want to reproduce a simulation.
- __Commands should be batched instead of issued one at a time:__ Although rare, in a busy simulation or overloaded server, single issued commands can become lost. If commands are batched in a [`apply_batch_sync`](python_api.md/#carla.Client.apply_batch_sync) command, the command is guaranteed to be executed or return a failure response.

Here is an example of the steps mentioned above:

```py
client = carla.Client(HOST, PORT) # connect to the server
client.set_timeout(10.0)
world = client.get_world()

# Load the desired map
client.load_world("Town10HD_Opt")

# Set synchronous mode settings
new_settings = world.get_settings()
new_settings.synchronous_mode = True
new_settings.fixed_delta_seconds = 0.05
world.apply_settings(new_settings)

client.reload_world(False) # reload map keeping the world settings

# Set up the traffic manager
traffic_manager = client.get_trafficmanager(TM_PORT)
traffic_manager.set_synchronous_mode(True)
traffic_manager.set_random_device_seed(SEED) # define TM seed for determinism

# Spawn your vehicles, pedestrians, etc.

# Simulation loop
while True:
# Your code
world.tick()
```

And a particular example for the playback feature:

```py
client = carla.Client(HOST, PORT) # connect to the server
client.set_timeout(10.0)
world = client.get_world()

# Load the desired map
client.load_world("Town10HD_Opt")

# Set synchronous mode settings
new_settings = world.get_settings()
new_settings.synchronous_mode = True
new_settings.fixed_delta_seconds = 0.05
world.apply_settings(new_settings)

client.reload_world(False) # reload map keeping the world settings

client.replay_file(FILE_TO_PLAY, 0, 0, 0, False)
world.tick() # a tick is necessary for the server to process the replay_file command

# Simulation loop
while True:
# Your code
world.tick()
```

Running these steps will ensure the same outcome for every simulation run.

---

Expand Down
42 changes: 40 additions & 2 deletions Docs/adv_traffic_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ The TM generates viable commands for all vehicles in the [vehicle registry](#veh
>Vehicle movement is computed based on the defined path. A [PID controller](#pid-controller) determines how to reach the target waypoints. This is then translated into a CARLA command for application in the next step.
>__2.5 - [Vehicle Lights Stage](#stage-5-vehicle-lights-stage).__
> The vehicle lights switch on/off dynamically based on environmental factors (e.g. sunlight and the presence of fog or rain) and vehicle behavior (e.g. turning on direction indicators if the vehicle will turn left/right at the next junction, or turn on the stop lights if braking).

__3. Apply the commands in the simulation.__

Commands generated in the previous step are collected into the [command array](#command-array) and sent to the CARLA server in a batch to be applied in the same frame.
Expand Down Expand Up @@ -119,7 +124,7 @@ __Related .cpp files:__ `SimulationState.cpp`, `SimulationState.h`.

### Control loop

The control loop manages the calculations of the next command for all autopilot vehicles so they are performed synchronously. The control loop consists of four different [stages](#stages-of-the-control-loop); localization, collision, traffic light, and motion planner.
The control loop manages the calculations of the next command for all autopilot vehicles so they are performed synchronously. The control loop consists of five different [stages](#stages-of-the-control-loop); localization, collision, traffic light, motion planner and vehicle lights.

The control loop:

Expand All @@ -128,7 +133,7 @@ The control loop:
- Divides calculations into a series of [stages](#stages-of-the-control-loop).
- Creates synchronization barriers between stages to guarantee consistency. Calculations for all vehicles are finished before any of them move to the next stage, ensuring all vehicles are updated in the same frame.
- Coordinates the transition between [stages](#stages-of-the-control-loop) so all calculations are done in sync.
- Sends the [command array](#command-array) to the server when the last stage ([Motion Planner Stage](#stage-4-motion-planner-stage)) finishes so there are no frame delays between the command calculations and the command application.
- Sends the [command array](#command-array) to the server when the last stages ([Motion Planner Stage](#stage-4-motion-planner-stage) and [Vehicle Lights Stage](#stage-5-vehicle-lights-stage)) finishes so there are no frame delays between the command calculations and the command application.

__Related .cpp files:__ `TrafficManagerLocal.cpp`.

Expand Down Expand Up @@ -228,6 +233,25 @@ The Motion Planner Stage:

__Related .cpp files:__ `MotionPlannerStage.cpp`.


##### Stage 5- Vehicle Lights Stage

The Vehicle Lights Stage activates the lights based on the condition of the vehicle and the surrounding environment.

The Vehicle Lights Stage:

- Retrieves the planned waypoints for the vehicle, information about vehicle lights (eg. light state and the planned command to be applied) and the weather conditions.

- Determines the new state of the vehicle lights:
- Turns on the blinkers if the vehicle is planning to turn left/right at the next junction.
- Turns on the stop lights if the applied command is asking the vehicle to brake.
- Turns on the low beams and the position lights from sunset to dawn, or under heavy rain.
- Turns on the fog lights under heavy fog conditions.

- Update the vehicle lights state if it has changed.

__Related .cpp files:__ `VehicleLightStage.cpp`.

---
## Using the Traffic Manager

Expand Down Expand Up @@ -315,6 +339,20 @@ for v in my_vehicles:
tm.auto_lane_change(v,False)
```

#### Delegating the Traffic Manager to automatically update vehicle lights

By default, vehicle lights (brake, turn indicators, etc...) of the vehicles managed by the TM are never updated. It is possible to delegate the TM to update the vehicle lights of a given vehicle actor:

```python
tm = client.get_trafficmanager(port)
for actor in my_vehicles:
tm.update_vehicle_lights(actor, True)
```

Vehicle lights management has to be specified on a per-vehicle basis, and there could be at any given time both vehicles with and without the automatic light management.



### Stopping a Traffic Manager

The TM is not an actor that needs to be destroyed; it will stop when the client that created it stops. This is automatically managed by the API, the user does not have to do anything. However, when shutting down a TM, the user must destroy the vehicles controlled by it, otherwise they will remain immobile on the map. The script `generate_traffic.py` does this automatically:
Expand Down
Loading

0 comments on commit a1b37f7

Please sign in to comment.