Traffic Simulation in CARLA
Traffic simulation is integral to the accurate and efficient training and testing of autonomous driving stacks. CARLA provides a number of different options to simulate traffic and specific traffic scenarios. This section is an overview of the options available to help decide which is the best fit for your use case.
Scenario Runner and OpenScenario
The primary use of OpenSCENARIO is the description of complex maneuvers that involve multiple vehicles. Users can see which features of OpenSCENARIO are supported by Scenario Runner here. These features include Maneuvers, Actions, Conditions, Stories and the Storyboard.
Scenario Runner has to be installed separately from the main CARLA package.
- Creating complex traffic scenarios and routes to prepare AD agents for evaluation in the CARLA leaderboard.
- Defining bespoke metrics that can be run against recordings of the scenario simulation, foregoing the need to run simulations repeatedly.
Traffic Manager is a module within CARLA that controls certain vehicles in a simulation from the client side. Vehicles are registered to Traffic Manager via the
carla.Vehicle.set_autopilot method or
command.SetAutopilot class. Control of each vehicle is managed through a cycle of distinct stages which each run on a different thread.
- Populating a simulation with realistic urban traffic conditions.
- Customizing traffic behaviours to set specific learning circumstances.
- Developing phase-related functionalities and data structures while improving computational efficiency.
Scenic is a domain-specific probabilistic programming language for modeling the environments of cyber-physical systems like robots and autonomous cars. Scenic provides an specialized domain to facilitate execution of Scenic scripts on the CARLA simulator.
Scenic scenario definitions are easy to read and construct. A tutorial to create a simple scenario is provided here.
- Generating multiple, diverse scenarios with a single scenario definition.
- Defining probabilistic policies for dynamic agents to take actions over time in response to the state of the world.
SUMO is an open source, microscopic, multi-modal traffic simulation. In SUMO, each vehicle is modelled explicitly, has its own route, and moves individually through the network. Simulations are deterministic by default but there are various options for introducing randomness.
CARLA provides a co-simulation feature with SUMO that allows distribution of tasks between the two simulators. Vehicles can be spawned in CARLA through SUMO, and managed by SUMO much as the Traffic Manager would do.
- Exploitation of the capabilities of both CARLA and SUMO in one package.
If you have any doubts about the different options available to simulate traffic in CARLA, feel free to post in the forum or in Discord.