autoware_carla_interface#
ROS 2 / Autoware Universe bridge for CARLA simulator#
Thanks to https://github.com/gezp for ROS 2 Humble support for CARLA Communication. This ros package enables communication between Autoware and CARLA for autonomous driving simulation.
Supported Environment#
| ubuntu | ros | carla | autoware |
|---|---|---|---|
| 22.04 | humble | 0.9.15 | Main |
Setup#
Install#
Prerequisites#
-
Install CARLA 0.9.15: Follow the CARLA Installation Guide
-
Install CARLA Python Package: Install CARLA 0.9.15 ROS 2 Humble communication package
- Option A: Install the wheel using pip
- Option B: Add the egg file to your
PYTHONPATH
-
Download CARLA Lanelet2 Maps: Get the y-axis inverted maps from CARLA Autoware Contents
Map Setup#
- Download the maps (y-axis inverted version) to an arbitrary location
- Create the map folder structure in
$HOME/autoware_data/maps:- Rename
point_cloud/Town01.pcd→$HOME/autoware_data/maps/Town01/pointcloud_map.pcd - Rename
vector_maps/lanelet2/Town01.osm→$HOME/autoware_data/maps/Town01/lanelet2_map.osm
- Rename
-
Create
$HOME/autoware_data/maps/Town01/map_projector_info.yamlwith:yaml projector_type: Local
Build#
bash
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
Run#
-
Run carla, change map, spawn object if you need
bash cd CARLA ./CarlaUE4.sh -prefernvidia -quality-level=Low -RenderOffScreen -
Run Autoware with CARLA
bash ros2 launch autoware_launch e2e_simulator.launch.xml \ map_path:=$HOME/autoware_data/maps/Town01 \ vehicle_model:=sample_vehicle \ sensor_model:=carla_sensor_kit \ simulator_type:=carlaFor E2E planning with VAD:
bash ros2 launch autoware_launch e2e_simulator.launch.xml \ map_path:=$HOME/autoware_data/maps/Town01 \ vehicle_model:=sample_vehicle \ sensor_model:=carla_sensor_kit \ simulator_type:=carla \ use_e2e_planning:=true -
Set initial pose (Init by GNSS)
- Set goal position
- Wait for planning
- Engage
Viewing Multi-Camera View in RViz#
The carla_sensor_kit includes 6 cameras providing 360-degree coverage (Front, Front-Left, Front-Right, Back, Back-Left, Back-Right). A multi-camera combiner node automatically combines all camera feeds into a single 2x3 grid view.
To view the combined camera feed in RViz:
- In the Displays panel (left side), click the "Add" button
- Select the "By topic" tab
- Navigate to
/sensing/camera/all_cameras/image_raw - Select "Image" display type
- Click OK

The combined view shows all 6 cameras with labels: FL (Front-Left), F (Front), FR (Front-Right), BL (Back-Left), B (Back), BR (Back-Right).
Note: If you don't need the multi-camera combiner (to save CPU resources), you can comment out the following line in launch/autoware_carla_interface.launch.xml:
```xml
```
Following the Ego Vehicle with the CARLA Spectator Camera#
The spectator_follow script locks the CARLA spectator (free) camera to the ego vehicle, so the in-simulator view chases the car automatically instead of having to pan manually. It connects to the running CARLA server, looks up the ego actor by its role_name, and updates the spectator transform at a fixed rate.
Run it in a separate terminal while CARLA and the Autoware bridge are running:
bash
ros2 run autoware_carla_interface spectator_follow
Common options (all optional):
| Flag | Default | Description |
|---|---|---|
--host |
localhost |
CARLA server host |
--port |
2000 |
CARLA server RPC port |
--role |
ego_vehicle |
role_name attribute of the ego actor to follow |
--distance |
8.0 |
Meters behind the ego vehicle (use 0 for a top-down view) |
--height |
4.0 |
Meters above the ego vehicle |
--pitch |
-15.0 |
Camera pitch in degrees (negative looks down) |
--rate |
30.0 |
Update rate in Hz |
For a top-down view directly above the ego vehicle:
bash
ros2 run autoware_carla_interface spectator_follow --distance 0 --height 30 --pitch -90
Press Ctrl+C to stop the script. It will keep retrying if the ego actor is not yet spawned, and re-acquire it if it is removed and respawned.
Inner-workings / Algorithms#
The InitializeInterface class is key to setting up both the CARLA world and the ego vehicle. It fetches configuration parameters through the autoware_carla_interface.launch.xml.
The main simulation loop runs within the carla_ros2_interface class. This loop ticks simulation time inside the CARLA simulator at fixed_delta_seconds time, where data is received and published as ROS 2 messages at frequencies defined in self.sensor_frequencies.
Ego vehicle commands from Autoware are processed through the autoware_raw_vehicle_cmd_converter, which calibrates these commands for CARLA. The calibrated commands are then fed directly into CARLA control via CarlaDataProvider.
Configurable Parameters for World Loading#
All the key parameters can be configured in autoware_carla_interface.launch.xml.
| Name | Type | Default Value | Description |
|---|---|---|---|
host |
string | "localhost" | Hostname for the CARLA server |
port |
int | "2000" | Port number for the CARLA server |
timeout |
int | 20 | Timeout for the CARLA client |
ego_vehicle_role_name |
string | "ego_vehicle" | Role name for the ego vehicle |
vehicle_type |
string | "vehicle.toyota.prius" | Blueprint ID of the vehicle to spawn. The Blueprint ID of vehicles can be found in CARLA Blueprint ID |
spawn_point |
string | None | Coordinates for spawning the ego vehicle (None is random). Format = [x, y, z, roll, pitch, yaw] |
sync_mode |
bool | True | Boolean flag to set synchronous mode in CARLA |
fixed_delta_seconds |
double | 0.05 | Time step for the simulation (related to client FPS) |
use_traffic_manager |
bool | False | Boolean flag to set traffic manager in CARLA |
max_real_delta_seconds |
double | 0.05 | Parameter to limit the simulation speed below fixed_delta_seconds |
sensor_kit_name |
string | "carla_sensor_kit_description" | Name of the sensor kit package to use for sensor configuration. Should be the *_description package containing config/sensor_kit_calibration.yaml |
use_light_weight_sensor_mapping |
bool | False | If True, uses sensor_mapping_light_weight.yaml instead of the default sensor_mapping.yaml to reduce simulator load. See Sensor Mapping (CARLA-specific) for details. |
sensor_mapping_file |
string | "$(find-pkg-share autoware_carla_interface)/config/sensor_mapping.yaml" | Path to sensor mapping YAML configuration file. When use_light_weight_sensor_mapping is True, this defaults to config/sensor_mapping_light_weight.yaml. |
config_file |
string | "$(find-pkg-share autoware_carla_interface)/raw_vehicle_cmd_converter.param.yaml" | Control mapping file to be used in autoware_raw_vehicle_cmd_converter. Current control are calibrated based on vehicle.toyota.prius Blueprints ID in CARLA. Changing the vehicle type may need a recalibration. |
Sensor Configuration#
The interface uses the carla_sensor_kit which provides 6 cameras for 360-degree coverage, LiDAR, IMU, and GNSS sensors. Sensor configurations are dynamically loaded from Autoware sensor kit calibration files through two configuration files:
1. Sensor Kit Calibration (from Autoware sensor kit)#
Located in <sensor_kit_name>_description/config/sensor_kit_calibration.yaml
Defines sensor positions and orientations relative to base_link (rear axle center). Example:
yaml
sensor_kit_base_link:
CAM_FRONT/camera_link:
x: 2.225
y: 0.000
z: 1.600
roll: 0.000
pitch: 0.000
yaw: 0.000 # Angles in radians
2. Sensor Mapping (CARLA-specific)#
Located in config/sensor_mapping.yaml
Maps Autoware sensors to CARLA sensor types and parameters. Key sections:
default_sensor_kit_name: Default sensor kit to use (e.g.,carla_sensor_kit_description)sensor_mappings: Maps each sensor to CARLA type and ROS topicsenabled_sensors: List of sensors to spawn in CARLAvehicle_config(optional): Vehicle parameters like wheelbase
Example sensor mapping:
yaml
sensor_mappings:
CAM_FRONT/camera_link:
carla_type: sensor.camera.rgb
id: CAM_FRONT
ros_config:
frame_id: CAM_FRONT/camera_optical_link
topic_image: /sensing/camera/CAM_FRONT/image_raw
topic_info: /sensing/camera/CAM_FRONT/camera_info
frequency_hz: 11
qos_profile: reliable
parameters:
image_size_x: 1600
image_size_y: 900
fov: 70.0
For CARLA sensor parameters, see CARLA Sensor Reference.
Light-Weight Sensor Mapping#
For machines with limited GPU/CPU resources, an alternative config/sensor_mapping_light_weight.yaml is provided to reduce simulator load. Compared to the default mapping, it:
- Uses a single front camera (
CAM_FRONT) instead of the 6-camera 360-degree setup, with a wider FOV (120°) and lower resolution (1080x720) to roughly cover the area in front of the vehicle. - Lowers sensor frequencies (e.g., LiDAR/camera at 10 Hz instead of 11 Hz).
- Keeps the same LiDAR, IMU, and GNSS configuration as the default mapping.
When enabled via use_light_weight_sensor_mapping:=True, the launch file also skips the image_transport republish nodes for the disabled cameras and the multi_camera_combiner node automatically.
Example usage:
bash
ros2 launch autoware_launch e2e_simulator.launch.xml \
map_path:=$HOME/autoware_map/Town01 \
vehicle_model:=sample_vehicle \
sensor_model:=carla_sensor_kit \
simulator_type:=carla \
use_light_weight_sensor_mapping:=True
Note that with this configuration, features that depend on the surround cameras (such as the multi-camera RViz view) are unavailable.
World Loading#
The carla_ros.py sets up the CARLA world:
-
Client Connection:
python client = carla.Client(self.local_host, self.port) client.set_timeout(self.timeout) -
Load the Map:
Map loaded in CARLA world with map according to
carla_mapparameter.python client.load_world(self.map_name) self.world = client.get_world() -
Spawn Ego Vehicle:
Vehicle are spawn according to
vehicle_type,spawn_point, andagent_role_nameparameter.python spawn_point = carla.Transform() point_items = self.spawn_point.split(",") if len(point_items) == 6: spawn_point.location.x = float(point_items[0]) spawn_point.location.y = float(point_items[1]) spawn_point.location.z = float(point_items[2]) + 2 spawn_point.rotation.roll = float(point_items[3]) spawn_point.rotation.pitch = float(point_items[4]) spawn_point.rotation.yaw = float(point_items[5]) CarlaDataProvider.request_new_actor(self.vehicle_type, spawn_point, self.agent_role_name)
Traffic Light Recognition#
The maps provided by the Carla Simulator (Carla Lanelet2 Maps) currently lack proper traffic light components for Autoware and have different latitude and longitude coordinates compared to the pointcloud map. To enable traffic light recognition, follow the steps below to modify the maps.
-
Options to Modify the Map
- A. Create a New Map from Scratch
- Use the TIER IV Vector Map Builder to create a new map.
- B. Modify the Existing Carla Lanelet2 Maps
- Adjust the longitude and latitude of the Carla Lanelet2 Maps to align with the PCD (origin).
- Use this tool to modify the coordinates.
- Snap Lanelet with PCD and add the traffic lights using the TIER IV Vector Map Builder.
- When using the TIER IV Vector Map Builder, you must convert the PCD format from
binary_compressedtoascii. You can usepcl_toolsfor this conversion. - For reference, an example of Town01 with added traffic lights at one intersection can be downloaded here.
Tips#
- Misalignment might occurs during initialization, pressing
init by gnssbutton should fix it. - Changing the
fixed_delta_secondscan increase the simulation tick (default 0.05 s), some sensor params insensor_mapping.yamlneed to be adjusted when it is changed (example: LIDAR rotation frequency should match the FPS).
Known Issues and Future Works#
- Testing on procedural maps (Adv Digital Twin): Currently unable to test due to failures in creating the Adv Digital Twin map.
- Traffic light recognition: The default CARLA Lanelet2 maps lack proper traffic light regulatory elements. See the "Traffic Light Recognition" section above for workarounds.