A framework for testing autonomous agents in the CARLA simulator
A versatile framework for deploying and evaluating autonomous driving agents (ADAs) from the CARLA Leaderboard on your own vehicle.
PCLA currently supports 27 agents and 24 additional training seeds from 12 major autonomous driving projects:
SimLingo | LMDrive | Transfuser | Transfuser++ | CaRL | Roach | PlanT | Interfuser | NEAT | WoR | LBC | LAV
PCLA (Pretrained CARLA Leaderboard Agents) is a versatile framework designed to decouple the autonomous driving agents (ADAs) from the restrictive CARLA Leaderboard codebase.
- Decoupled Deployment: Deploy high-performing ADAs onto a vehicle without relying on the original Leaderboard core codebase.
- Easy Switching: Effortlessly switch between 27 different agents and their 24 additional training seeds without requiring changes to CARLA versions or programming environments.
- Version Independent: Fully compatible with the latest version of CARLA, independent of the Leaderboard’s specific CARLA version.
- Multi-Agent Support: Run multiple vehicles with different autonomous agents simultaneously (note: requires high graphical memory).
- CARLA Action Access: Retrieve the computed CARLA movement action from the chosen agent for use in any custom application.
The corresponding paper is available at Foundations of Software Engineering (FSE).
PCLA was tested on Linux Ubuntu 22 and CARLA 0.9.16 (Unreal Engine 4).
A video tutorial on how to use PCLA is available below (an updated version is coming soon).
- Download and install the CARLA simulator from the official website (quick installation or build from source).
- Ensure CUDA and PyTorch are installed on your system.
-
Clone the repository and build the Conda environment:
git clone https://github.com/MasoudJTehrani/PCLA cd PCLA conda env create -f environment.yml conda activate PCLA -
Install
torch-scatter:Note: Please make sure to install
torch-scatteraccording to your specific CUDA version. You can check your CUDA version using the includedpython cuda.pyscript. -
Additional setup for LMDrive agent:
conda activate PCLA # 1. Vision Encoder cd pcla_agents/lmdrive/vision_encoder pip uninstall timm python setup.py develop # 2. LAVIS cd ../LAVIS python setup.py develop # 3. Fix ftfy dependency pip uninstall ftfy -y pip install "ftfy==6.1.1" cd ../../../
-
CARLA 0.9.16 Specific Installation: If you intend to use PCLA with CARLA 0.9.16, you need to install the wheel from the
distfolder:cd dist python3 -m pip install carla-0.9.16-cp38-cp38-linux_x86_64.whlWarning: Some agents may act weird when used with CARLA 0.9.16.
You have two options to download the required pre-trained model weights:
Run the following script to automatically download and unzip the weights into the correct location:
python pcla_functions/download_weights.py-
Manually download the
pretrained.zipfile from Hugging Face. -
Extract the contents into the
PCLA/pcla_agents/directory.
Ensure that the downloaded pre-trained weight folders are placed directly next to their respective model's folder. The final pcla_agents directory should look like this:
├── pcla_agents/
│ ├── transfuserpp/
│ ├── transfuserpp_pretrained/
│ ├── interfuser/
│ ├── interfuser_pretrained/
│ ├── ...
PCLA includes 27 different autonomous agents and 24 additional training seeds to choose from.
Find the repository of each agent at the top this page.
simlingo_simlingo: The best-performing agent, which secured first place at CARLA Leaderboard 2 SENSORS track (previously named CarLLava).
-
lmdrive_llava: Best performing LMDrive agent. -
lmdrive_vicuna: Second best performing LMDrive agent. -
lmdrive_llama: Third best performing LMDrive agent.
-
tf_tf: The main Transfuser agent. -
tf_ltf: The LatentTF agent. -
tf_lf: The Late_Fusion agent. -
tf_gf: The Geometric_Fusion agent.
-
Seeds: Replace
#with the seed number from 0 to 2 (e.g.,tfpp_l6_0). -
tfpp_l6_#: Best performing Transfuser++ agent. Second place at CARLA Leaderboard 2 SENSORS track. -
tfpp_lav_#: Transfuser++ not trained on Town02 and Town05. -
tfpp_wp_#: Transfuser++ WP from their paper's appendix. -
tfpp_aim_#: Reproduction of the AIM method.
-
carl_carl_#: CaRL agent with a driving score of 64. Replace#with 0 or 1. -
carl_carlv11: The best CaRL agent with a driving score of 73. Best open-source RL planner on longest6 v2 and nuPlan.
carl_roach_#: The Roach planner agent (paper) reproduced by the authors of CaRL. Replace#with a number from 0 to 4 for the 5 available seeds.
carl_plant_#: The PlanT planner agent (paper) reproduced by the authors of CaRL. Replace#with a number from 0 to 4 for the 5 available seeds.
-
neat_neat -
neat_aimbev -
neat_aim2dsem -
neat_aim2ddepth
if_if: Second best performing CARLA Leaderboard 1 SENSORS track agent.
-
lav_lav: The original LAV agent. -
lav_fast: Leaderboard submission optimized for inference speed with temporal LiDAR scans.
-
lbc_nc: Learning By Cheating, the NoCrash model. -
lbc_lb: Learning By Cheating, the Leaderboard model.
-
wor_nc: World on Rails, the NoCrash model. -
wor_lb: World on Rails, the Leaderboard model.
Start the CARLA simulator. You only need the -vulkan flag for LBC, WoR, and LAV agents.
./CarlaUE4.sh -vulkanOpen a new terminal and run your custom Python code. To use PCLA, import the library, define your agent and route, and initialize the PCLA class.
Core Usage Snippet:
from PCLA import PCLA
# 1. Define Agent and Route
agent = "tf_tf" # e.g., Transfuser
route = "./sample_route.xml"
# 2. Initialize PCLA (requires a CARLA client and a vehicle object)
pcla = PCLA(agent, vehicle, route, client)
# 3. Get action and apply control (within your simulation loop)
ego_action = pcla.get_action()
vehicle.apply_control(ego_action)
# 4. Cleanup when done
pcla.cleanup()-
agent: Your chosen autonomous agent string (e.g.,"tf_tf"). See Autonomous Agents. -
route: The path to an XML file defining the vehicle's route, formatted according to the Leaderboard waypoints. -
client&vehicle: The standard CARLA client and the ego-vehicle actor you wish to control.
PCLA provides utility functions to help you generate waypoints and routes usable by the agents.
To see all available spawn points and their associated index numbers in your current map:
Shell
python pcla_functions/spawn_points.py
Use the location_to_waypoint() method to generate a sequence of CARLA waypoints between two CARLA locations.
from PCLA import location_to_waypoint
import carla
world = client.get_world()
vehicle_spawn_points = world.get_map().get_spawn_points() # Get CARLA spawn points
startLoc = vehicle_spawn_points[31].location # Define Start location
endLoc = vehicle_spawn_points[42].location # Define End location
# Returns a list of CARLA waypoints between the two locations
waypoints = location_to_waypoint(client, startLoc, endLoc) Pass the generated CARLA waypoints to route_maker() to format them into a Leaderboard-compliant XML file that PCLA can read.
from PCLA import route_maker
route_maker(waypoints, "route.xml")This combined example demonstrates generating an XML route from two CARLA locations:
from PCLA import route_maker, location_to_waypoint
import carla
client = carla.Client('localhost', 2000)
world = client.get_world()
vehicle_spawn_points = world.get_map().get_spawn_points()
startLoc = vehicle_spawn_points[31].location
endLoc = vehicle_spawn_points[42].location
# 1. Generate waypoints
waypoints = location_to_waypoint(client, startLoc, endLoc)
# 2. Create the PCLA XML route file
route_maker(waypoints, "route.xml")A comprehensive sample script is provided to help you test PCLA immediately.
To run the sample (which uses the LAV agent in Town02):
python sample.pyAttention: You may need to change the vehicle spawn point's index number on line 45 of
sample.pybased on your specific CARLA version.
Frequently asked questions and possible issues are addressed and solved in the PCLA issues section.
If you have a request for a new agent to be integrated into the framework, please feel free to open a new issue and ask!
If you find PCLA useful in your research or project, please consider giving it a star ⭐ and citing our published work.
@inproceedings{tehrani2025pcla,
title={PCLA: A Framework for Testing Autonomous Agents in the CARLA Simulator},
author={Tehrani, Masoud Jamshidiyan and Kim, Jinhan and Tonella, Paolo},
booktitle={Proceedings of the 33rd ACM International Conference on the Foundations of Software Engineering},
pages={1040--1044},
year={2025}
}