This page introduces the main features and modules in CARLA. Detailed explanations of the different subjects can be found in their corresponding page.
In order to learn about the different classes and methods in the API, take a look at the Python API reference. Besides, the Code recipes reference contains some common code chunks, specially useful during these first steps.
- First steps
- Advanced steps
This documentation refers to CARLA 0.9.X.
The API changed significantly from previous versions (0.8.X). There is another documentation regarding those versions that can be found here.
1st- World and client
The client is the module the user runs to ask for information or changes in the simulation. A client runs with an IP and a specific port. It communicates with the server via terminal. There can be many clients running at the same time. Advanced multiclient managing requires thorough understanding of CARLA and synchrony.
The world is an object representing the simulation. It acts as an abstract layer containing the main methods to spawn actors, change the weather, get the current state of the world, etc. There is only one world per simulation. It will be destroyed and substituted for a new one when the map is changed.
2nd- Actors and blueprints
An actor is anything that plays a role in the simulation.
- The spectator.
- Traffic signs and traffic lights.
Blueprints are already-made actor layouts necessary to spawn an actor. Basically, models with animations and a set of attributes. Some of these attributes can be customized by the user, others don't. There is a Blueprint library containing all the blueprints available as well as information on them.
3rd- Maps and navigation
The map is the object representing the simulated world, the town mostly. There are eight maps available. All of them use OpenDRIVE 1.4 standard to describe the roads.
Roads, lanes and junctions are managed by the Python API to be accessed from the client. These are used along with the waypoint class to provide vehicles with a navigation path.
Traffic signs and traffic lights are accessible as carla.Landmark objects that contain information about their OpenDRIVE definition. Additionally, the simulator automatically generates stops, yields and traffic light objects when running using the information on the OpenDRIVE file. These have bounding boxes placed on the road. Vehicles become aware of them once inside their bounding box.
4th- Sensors and data
Sensors wait for some event to happen, and then gather data from the simulation. They call for a function defining how to manage the data. Depending on which, sensors retrieve different types of sensor data.
A sensor is an actor attached to a parent vehicle. It follows the vehicle around, gathering information of the surroundings. The sensors available are defined by their blueprints in the Blueprint library.
- Cameras (RGB, depth and semantic segmentation).
- Collision detector.
- Gnss sensor.
- IMU sensor.
- Lidar raycast.
- Lane invasion detector.
- Obstacle detector.
CARLA offers a wide range of features that go beyond the scope of this introduction to the simulator. Here are listed some of the most remarkable ones. However, it is highly encouraged to read the whole First steps section before starting with the advanced steps.
- OpenDRIVE standalone mode. Generates a road mesh using only an OpenDRIVE file. Allows to load any OpenDRIVE map into CARLA without the need of creating assets.
- PTV-Vissim co-simulation. Run a synchronous simulation between CARLA and PTV-Vissim traffic simulator.
- Recorder. Saves snapshots of the simulation state to reenact a simulation with exact precision.
- Rendering options. Graphics quality settings, off-screen rendering and a no-rendering mode.
- RSS. Integration of the C++ Library for Responsibility Sensitive Safety to modify a vehicle's trajectory using safety checks.
- Simulation time and synchrony. Everything regarding the simulation time and server-client communication.
- SUMO co-simulation. Run a synchronous simulation between CARLA and SUMO traffic simulator.
- Traffic manager. This module is in charge of every vehicle set to autopilot mode. It simulates traffic in the city for the simulation to look like a real urban environment.
That is a wrap on the CARLA basics. The next step takes a closer look to the world and the clients connecting to it.
Keep reading to learn more. Visit the forum to post any doubts or suggestions that have come to mind during this reading.