CARLA 0.9.8 release

CARLA and ROS Debian packages, night mode, weather extension, improvements on the traffic manager, new documentation, SUMO co-simulation and much more.

Posted by @sergi-e on March 09, 2020

The CARLA team is delighted to finally announce the release of CARLA 0.9.8!

This release makes for a new CARLA experience, bringing improvements to well established modules, along with a bunch of new features. Among these features we would like to highlight the new installation method using deb packages for Ubuntu. A new repository provides deb packages for the CARLA simulator and the ROS bridge, which can be easily installed using apt.

This post will dive deep into all the new features, but first let’s see a brief summary of what CARLA 0.9.8 brings to the table.

  • Debian installation for CARLA. A step-by-step guide on how to use the deb packages to get the latest CARLA release and the ROS bridge.
  • ROS bridge. An updated integration between CARLA and ROS that makes for a ubiquitous and out-of-the-box experience.
  • Python API extension. An extended parser for OpenDRIVE to support new geometries.
  • Traffic Manager. Major fixes for synchronous mode, support for multiple clients, and a reduction in computational costs.
  • SUMO integration (experimental). Support for bidirectional co-simulation between CARLA and SUMO (an open-source traffic simulator prepared to handle large road networks).
  • OpenDRIVE Standalone mode (experimental). A new mode in CARLA to create maps from a single OpenDRIVE file. This new feature generates the road mesh automatically using procedural methods.
  • Documentation. Previous writing has been revisited to improve installation guides and include first steps for newcomers and in-depth explanations of advanced features.
  • Weather extension. A fully configurable weather API, now including fog, wetness of the road and many visual improvements.
  • Night mode. Now the sun sets in CARLA and the streets and vehicles turn on their lights. A complete makeover for the simulations.
  • Mesh distance fields. An increase of visual realism via Mesh Distance Fields.
  • General fixes. As always this release also includes major fixes for bugs, as listed in the changelog.

Let’s take a look!

Get CARLA 0.9.8


Deb installation for CARLA


The new deb package system consists of an online repository containing a collection of files to easily distribute CARLA. This is available in Ubuntu using APT command. This feature makes the installation of CARLA a straightforward process.

The following commands show how to use APT to install CARLA 0.9.8 in a Ubuntu system.

# Install dependencies
pip install --user pygame numpy
# Add the repository
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 304F9BC29914A77D &&
sudo add-apt-repository "deb [arch=amd64 trusted=yes] http://dist.carla.org/carla-0.9.8/ all main"
# Install CARLA
sudo apt-get update
sudo apt-get install carla
# CARLA is in the /opt/ folder
cd /opt/carla
# Get the resources for the simulator.
./ImportAssets.sh
# Run the CARLA server.
cd bin
./CarlaUE4.sh

ROS bridge


CARLA is moving towards a soon-to-be full integration with Autoware, and in its way to do so, an out-of-the-box integration between CARLA and ROS is now easier than ever. The creation of a deb package for the CARLA-ROS bridge eases the installation process. Now, the ROS bridge can be installed in Linux systems using tools such as APT. Let’s take a look at how:

# After installing ROS Melodic and CARLA 0.9.8
# For ROS Kinetic, change "melodic" instances for "kinetic" and the key server to 9BE2A0CDC0161D6C

# Add the repository
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 81061A1A042F527D &&
sudo add-apt-repository "deb [arch=amd64 trusted=yes] http://dist.carla.org/carla-ros-bridge-melodic/ bionic main"

# Install the ROS bridge
sudo apt update &&
sudo apt install carla-ros-bridge-melodic

# The ROS bridge will be in the /opt/ folder

# Launch CARLA (this example runs the apt package)
cd /opt/carla/bin/ && ./CarlaUE4.sh

# Add the source for melodic bridge
source /opt/carla-ros-bridge/melodic/setup.bash

# Launch ROS bridge launchfile to test
roslaunch carla_ros_bridge carla_ros_bridge.launch

The CARLA messages have a specific repository and soon they will be available from the ROS-buildfarm. Sensors have also been upgraded, now including IMU and RADAR, along with some improvements to LIDAR, GNSS and RGB cameras. The ROS bridge includes now packages to integrate with RVIZ and run traffic scenarios directly from ROS. The demo provided will load an autonomous driving agent that avoids collisions, respects traffic lights and follows a specified route. To sum up:

  • carla_ros_scenario_runner. Executes a traffic scenario using Scenario_Runner.
  • carla_ad_agent. Launches an autonomous vehicle’s stack.
  • rviz_carla_plugin. Displays the simulation. The camera orientation can be changed directly from the RVIZ view and manual control can be enabled and used in the same window using a grid.

The carla_ad_demo meta-package is an all-in-one solution that brings everything together.

roslaunch ros_ad_demo ros_ad_demo.launch

ros_ad_demo

Python API extension


CARLA now provides full support for all the OpenDRIVE geometries, including for B-splines and spirals. The library now makes use of RTrees to accelerates queries (such as closest waypoint in a road).

Additionally, the functionalities of the PythonAPI now include the carla.Junction class to help finding different ways in these road segments, and the option in carla.Map to obtain waypoints from a .xodr definition.

Traffic Manager


This module has been greatly improved for this release. In addition to the many bug fixes, the greatest changes are related to the behavior of the Traffic Manager in synchronous mode, which is now stable. Traffic Manager can now also manage situations where multiple clients are running different Traffic Managers. Besides that, the Traffic Manager includes an improved lane changing behavior and vehicles can successfully avoid joining crowded junctions by using an anticipation algorithm.

traffic_manager

SUMO integration


CARLA is now also compatible with SUMO so that both simulators can work together to run a synchronous co-simulation. The feature is experimental for CARLA 0.9.8. In this co-simulation mode, the actions or events happening in one simulator are automatically propagated to the other, e.g.: vehicle’s motion, agent spawning, vehicle’s lights, etc.

All the scripts related to this feature can be found in Co-Simulation/Sumo. It contains an example for Town 01 that runs the following command:

python3 run_synchronization.py -c examples/town01/Town01.sumocfg

sumo_example

There are some helper scripts that translate CARLA blueprints to SUMO vehicle types so that the vehicles’ specifications are the same in both simulators. If these are not used, CARLA will spawn a random vehicle based on the given SUMO vehicle type.

sumo_spawn

Warning! This feature has only been tested thoroughly in Town01.

ASAM OpenDRIVE standalone mode


This new and experimental mode allows to perform full simulation starting from a single OpenDRIVE file: no additional geometries or assets required. Finally your own OpenDRIVE files can be easily ingested by CARLA. To this end, the simulator takes an OpenDRIVE file and procedurally creates a 3D mesh to run simulations with. In order to test this feature, the config.py script in PythonAPI/util/ has a new argument, -x or --xodr-path, which is a string containing the path to the .xml file. This script calls a new method in carla.Client, client.generate_opendrive_world(), which blocks the simulation (as load_world() would do) until the new map is active.

There are some considerations to be taken into account:

  • OpenDRIVE maps created with RoadRunner present some issues related to tilted junctions.
  • The standalone mode uses the .xml directly so any issues in it will propagate to the simulation. This could be an issue especially at junctions, where many lanes are mixed.
  • The map will consists of only roads and sidewalks with no walls: just void outside. Vehicles will fall when driving outside of roads. Avoid this situation.
  • Traffic lights are not supported yet.
  • Walkers cannot cross pedestrian crossings yet.
  • Lateral slope for roads is not supported yet.
  • The sidewalks height is currently hardcoded. This ensures collisions with them are detected even if the map definition does not include this field.
python3 config.py -x path/to/some/file.xodr

OpenDRIVEStandalone

Documentation


There have been major (dramatic) changes in the CARLA documentation. Almost every section has been revisited, from the installation and build guides to the Python API and sensor references. Everything is now up-to-date with the current version of CARLA.

There have been also remarkable changes on the structure of the documentation to simplify the learning curve. The First steps section now acts as a step-by-step guide for newcomers, and the Advanced steps include in-depth explanations for some specific CARLA features such as synchronous mode, Traffic Manager, ROS bridge and much more.

Check all of these changes in the CARLA documentation!

Weather extension


Continuing the path started in CARLA to make weather fully configurable by the user, this upgrade includes two new weather parameters and many improvements on previous ones. First of all, now fog can be controlled in CARLA using two different variables. Distance sets the meters for the fog to start being applied. Density will state the opacity of the elements in scene depending on their distance from the point of view.

/carla/PythonAPI/util >weather.py --clouds 100 --rain 80 --wetness 100 --puddles 60 --wind 80 --fog 50

weather_fog

There is also wetness of the road, which applies a fader to the road to make it look wet. This new parameter works hand-in-hand with the previous precipitation deposits and improves realism on rainy environments.

/carla/PythonAPI/util >weather.py --clouds 100 --rain 80 --wetness 100

weather_wetness

The wind parameter has also been improved. Previously it was only obvious when looking at tree leaves. Now it also influences other types of vegetation, rain’s direction, and clouds’ movement.

/carla/PythonAPI/util >weather.py --weather overcast

weather_wind

As for other visual improvements made for this release:

  • Rain particles have been made more realistic.
  • Cludiness will darken the sky.
  • The sun intensity is regulated by both the sun position and cloudiness.
  • All these elements influence the intensity and color temperature of the light in the scene.

All of these improvements can be perceived using a RGB camera sensor. The dynamic_weather.py script in /PythonAPI/examples has been updated to include all of these changes in its main cycle. The Weather.py script in /Utils/ allows to modify the weather parameters at will:

# Set a morning scenario.
/carla/PythonAPI/util >weather.py  --altitude 30
# Change the azimuth for an evening scenario.
/carla/PythonAPI/util >weather.py  --altitude 30 --azimuth 220

custom_weather

Night mode


A whole new mode in CARLA! The moment the sun disappears in the horizon (altitude is below 0), it is considered night time and therefore streets and vehicles turn their lights automatically on.

# Go to night mode by locating the sun below the horizon. Midnight = -90
/carla/PythonAPI/util >weather.py  --altitude -90

Streetlights

Warning! The complex lightning in Night mode may cause FPS drops. By the time of the release every city can manage a hundred vehicles and run at least at 20FPS.

Vehicle lights

For this release, lights have been added to a specific set of vehicles.

  • Bikes. All of them have a front and back position light.
  • Motorcycles. Yamaha and Harley Davidson models
  • Cars. Audi TT, Chevrolet, Dodge (the police car), Etron, Lincoln, Mustang, Tesla 3S, Wolkswagen T2 and the new guests coming to CARLA.

Speaking of which, CARLA is glad to announce the arrival of a new car model, the Cybertruck!

Cybertruck

The light set for vehicles is base on real examples, including front and back beams, blinkers and some special ones such as license plates, interior lights or sirens, among others. Some of them turn on automatically (brake and reverse lights), but most of them are implemented to be accessible using the API. In order to do this, the carla.VehicleLightState class lists the set of lights as flags that can be enabled or disabled using binary operations.

# Turn on position lights  

current_lights = carla.VehicleLightState.NONE
current_lights |= carla.VehicleLightState.Position
vehicle.set_light_state(current_lights)

The manual_control.py script in /PythonAPI/examples has been updated to include commands for lights. Left/Right blinkers correspond to the Z/X keys. High beams are turned on when Shift+L is pressed. There is also a specific cycle of vehicle lights that is enabled when L is pressed: No lights --> position light + license plate --> low beam --> fog lights.

car_lights

Mesh distance fields


Unreal Engine uses mesh distance fields to represent elements and actors in scene and gain some information about the scene’s illumination. In previous releases these features were disabled due to ghosting issues that now have been palliated.

Distance field shadows works along with the previous Cascade shadows to create shadows with non-sharp edges based on light sources. Distance field ambient occlusion helps placing the objects on scene by creating shadows that take into consideration the proximity between elements in scene.

These are complex Unreal Engine features that allow for higher visual realism. To learn more about this feature and its possibilities take a look at Unreal Engine’s documentation.

Mesh distance fields can be disabled via code, in DefaultEngine.ini set to false the parameter r.GenerateMeshDistanceFields=False or through the UE Editor. Go to Project Settings, look up mesh distance fields and just disable these:

DisableMDF

Changelog


  • Debian repositories for CARLA release and ROS bridge.
  • CARLA forum open to everybody.
  • OpenDRIVE standalone mode:
    • New argument --xodr-path in config.py to load .xml files into CARLA.
  • SUMO co-simulation:
    • Run a SUMO simulation synchronously with CARLA.
    • Helper scripts to translate CARLA blueprints into SUMO vehicle types.
  • New documentation:
    • Getting started: Introduction and Quickstart.
    • CARLA build: Linux build, Windows build, Update CARLA, F.A.Q.
    • First steps: Core concepts, 1st. World and client, 2nd. Actors and blueprints, 3rd. Maps and navigation, 4th. Sensors and data.
    • Advanced steps: Recorder, Rendering options, Synchrony and time-step, Traffic Manager.
    • ROS bridge: ROS bridge installation, CARLA messages reference, launchfiles reference.
    • References: Python API reference, Sensors reference.
  • Traffic manager:
    • Support to multiclient and multiTM scenarios.
    • Enhanced waypoint connectivity.
    • Improved performance by avoiding internal lists repetitions.
    • Traffic light groups have now customized time cycles to improve performance and avoid jams.
    • Anticipation algorithm for vehicles near crowded junctions.
  • Python API extensions:
    • New class Junction.
    • Class Waypoint extended.
    • Class Vector3D extended.
    • Method get_waypoint() extended for new geometries.
    • OpenDRIVE spirals and splines support.
  • ROS bridge:
    • Creation of a Debian package for ROS bridge installation.
    • New sensors added: IMU and Radar. Improvements on previous sensors.
    • New packages: carla_ad_agent, carla_ad_demo, carla_ros_scenario_runner, rviz_carla_plugin.
  • Mesh distance fields implementation:
    • Distance field shadows.
    • Distance field ambient occlusion.
  • Weather extension:
    • Fog feature with density and distance parameters.
    • Wetness (percentage) feature: humidity of the road.
    • Wind affects clouds, vegetation and rain direction.
    • New features are accessible from the Python API.
    • Weather script in /Utils eases weather control by the user.
    • New rain particles.
  • Night mode:
    • Night defined as the moment sun goes below 0 degrees (horizon).
    • City lights automatically turn on when in night mode (listed below).
    • Car lights have been added for a few examples (listed below).
  • City lights available in night mode:
    • Highway light.
    • Multiple highway light.
    • Simple street light.
    • Double street light.
    • Wall street light.
    • Tall lampost street light.
    • Short lampost street light.
    • Lampost wall.
    • Railway light.
  • Vehicle lights:
    • Lights are only available for user controlled cars.
    • Lights have to be turned on by the user. Otherwise these will be off even in night mode.
    • All the lights are accessible from the API.
    • Manual control L key manages lights in four states: off, position, low beam and fog lights.
    • Manual control shitf+L turns on main beam lights.
    • Manual control Z and X control blinkers.
    • A few lights are automatic for controlled vehicle: brake…
  • List of vehicle lights:
    • Indicator (front and back).
    • Position (front and back).
    • Antifog (front and back).
    • Low beam.
    • High beam.
    • Brake.
    • Reverse.
    • License plate.
    • Special.
  • Cars with lights:
    • Cybertruck.
    • Etron.
    • Lincoln.
    • Mustang.
    • Tesla 3S.
    • Wolkswagen T2.
    • Chevrolet.
    • Police car (Dodge).
    • Audi TT.
  • Motorycles with lights:
    • Yamaha.
    • Harley Davidson.
  • Bikes with lights:
    • All of them.
  • New assets:
    • New vehicle: Cybertruck.
  • Visual quality:
    • Sun intensity determines color temperature of the light.
    • Sun intensity affected by sun position and cloudiness.
    • Darkness of the clouds affected by amount of these.
    • New sets of colors for vehicles to look more realistic.
    • Different LODs for vehicles with no effect on lights.
  • Fixes:
    • Docker: binary build issue fixed.
    • Python API documentation: index now properly ordered.
    • Town 03: inconsistencies between OpenDRIVE and some traffic signs.
    • Traffic manager: fake lane changes (especially present in Town03) have been fixed.
    • Traffic manager: fake junctions (present in barns and double lanes with lane departures) have been fixed.
    • Traffic manager: stuck vehicles now are deleted after 90 seconds both in asynchronous and synchronous modes (—> wait, simulated or real seconds?).
    • Windows: make Python API fixed.
    • ROS bridge: tf publishing in synchronous mode.
  • Warning:
    • Night mode with lots of actors on scene causes FPS drops that may interfere with the Traffic Manager.