Top Related Projects
An open autonomous driving platform
openpilot is an operating system for robotics. Currently, it upgrades the driver assistance system in 275+ supported cars.
Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
A ROS/ROS2 Multi-robot Simulator for Autonomous Vehicles
A self-driving car simulator built with Unity
Autoware - the world's leading open-source software project for autonomous driving
Quick Overview
CARLA is an open-source simulator for autonomous driving research. It provides a realistic urban environment with various weather conditions, vehicles, and pedestrians, allowing researchers and developers to test and train autonomous driving algorithms in a safe, controlled virtual environment.
Pros
- Highly realistic graphics and physics simulation
- Supports various sensors including cameras, LiDAR, and GPS
- Extensive Python API for easy integration with machine learning frameworks
- Active community and regular updates
Cons
- High system requirements for optimal performance
- Steep learning curve for beginners
- Limited variety of urban environments compared to real-world scenarios
- Can be resource-intensive, especially for large-scale simulations
Code Examples
- Connecting to the CARLA server and spawning a vehicle:
import carla
client = carla.Client('localhost', 2000)
world = client.get_world()
blueprint_library = world.get_blueprint_library()
vehicle_bp = blueprint_library.filter('vehicle.tesla.model3')[0]
spawn_point = world.get_map().get_spawn_points()[0]
vehicle = world.spawn_actor(vehicle_bp, spawn_point)
- Adding a camera sensor to the vehicle:
camera_bp = blueprint_library.find('sensor.camera.rgb')
camera_bp.set_attribute('image_size_x', '800')
camera_bp.set_attribute('image_size_x', '600')
camera_transform = carla.Transform(carla.Location(x=1.5, z=2.4))
camera = world.spawn_actor(camera_bp, camera_transform, attach_to=vehicle)
- Applying control to the vehicle:
control = carla.VehicleControl()
control.throttle = 0.5
control.steer = 0.2
vehicle.apply_control(control)
Getting Started
-
Install CARLA:
pip install carla
-
Start the CARLA server:
./CarlaUE4.sh
-
Run a Python script to connect and interact with the simulator:
import carla client = carla.Client('localhost', 2000) world = client.get_world() # Your simulation code here
-
Explore the CARLA documentation for more advanced features and examples.
Competitor Comparisons
An open autonomous driving platform
Pros of Apollo
- Comprehensive autonomous driving platform with real-world deployment focus
- Extensive hardware integration and support for various sensors
- Strong community and industry partnerships
Cons of Apollo
- Steeper learning curve due to complexity
- Higher system requirements for running simulations
- Less focus on visual realism compared to CARLA
Code Comparison
Apollo (C++):
void Planning::RunOnce(const LocalView& local_view,
ADCTrajectory* const trajectory_pb) {
// Planning logic implementation
}
CARLA (Python):
def run_step(self, vehicle, sensors_data):
# Autonomous driving logic implementation
pass
Key Differences
- Apollo is a full-stack autonomous driving platform, while CARLA is primarily a simulation environment
- Apollo focuses on real-world deployment, whereas CARLA emphasizes research and development
- CARLA offers more realistic graphics and urban environments, while Apollo provides more comprehensive sensor integration
Use Cases
- Apollo: Developing and testing complete autonomous driving systems for real-world deployment
- CARLA: Simulating urban driving scenarios for research, algorithm development, and initial testing of autonomous driving components
openpilot is an operating system for robotics. Currently, it upgrades the driver assistance system in 275+ supported cars.
Pros of openpilot
- Real-world application: Designed for actual vehicle control and autonomous driving
- Active community: Large user base contributing to development and testing
- Hardware compatibility: Supports various car models and aftermarket devices
Cons of openpilot
- Limited simulation capabilities: Primarily focused on real-world deployment
- Steeper learning curve: Requires understanding of automotive systems and hardware
Code Comparison
openpilot (Python):
def update(self):
self.sm.update()
self.state = State.from_dict(self.sm['controlsState'])
self.enabled = self.state.enabled
self.active = self.state.active
CARLA (Python):
def tick(self, world, clock):
self._notifications.tick(world, clock)
if not self._show_info:
return
t = world.get_snapshot().timestamp
Summary
openpilot is a real-world autonomous driving system with broad hardware support and an active community. CARLA, on the other hand, is a powerful simulation environment for developing and testing autonomous driving algorithms. While openpilot excels in practical application, CARLA offers a more controlled and diverse testing environment for research and development purposes.
Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
Pros of AirSim
- Supports multiple platforms (Windows, Linux) and environments (indoor, outdoor)
- Offers physics simulation for drones and ground vehicles
- Provides APIs for various programming languages (C++, Python, C#, Java)
Cons of AirSim
- Less realistic urban environments compared to CARLA
- Smaller community and fewer ready-to-use scenarios
- Limited built-in sensor types
Code Comparison
AirSim Python API example:
import airsim
client = airsim.MultirotorClient()
client.takeoffAsync().join()
client.moveToPositionAsync(-10, 10, -10, 5).join()
CARLA Python API example:
import carla
client = carla.Client('localhost', 2000)
world = client.get_world()
blueprint = world.get_blueprint_library().find('vehicle.tesla.model3')
spawn_point = world.get_map().get_spawn_points()[0]
vehicle = world.spawn_actor(blueprint, spawn_point)
Both simulators offer intuitive APIs for controlling vehicles and accessing sensor data. AirSim focuses on drone simulation and cross-platform support, while CARLA excels in realistic urban environments and traffic scenarios. The choice between them depends on specific project requirements and the type of autonomous systems being developed.
A ROS/ROS2 Multi-robot Simulator for Autonomous Vehicles
Pros of LGSVL Simulator
- More flexible and customizable environment creation
- Better support for ROS (Robot Operating System) integration
- Easier to set up and use for beginners
Cons of LGSVL Simulator
- Smaller community and less extensive documentation compared to CARLA
- Fewer built-in scenarios and less diverse pre-made assets
- Less frequent updates and maintenance
Code Comparison
LGSVL Simulator (Python API):
import lgsvl
sim = lgsvl.Simulator(address="localhost", port=8181)
ego_vehicle = sim.add_agent("Lincoln2017MKZ (Apollo 5.0)", lgsvl.AgentType.EGO, state)
sim.run(time_limit=10)
CARLA (Python API):
import carla
client = carla.Client('localhost', 2000)
world = client.get_world()
blueprint = world.get_blueprint_library().find('vehicle.lincoln.mkz2017')
vehicle = world.spawn_actor(blueprint, spawn_point)
world.tick()
Both simulators offer Python APIs for vehicle spawning and simulation control. LGSVL's API appears slightly more concise, while CARLA's API provides more granular control over the simulation environment.
A self-driving car simulator built with Unity
Pros of self-driving-car-sim
- Simpler and more lightweight, making it easier to set up and run
- Designed specifically for Udacity's Self-Driving Car Nanodegree, providing a focused learning experience
- Includes a track editor for creating custom environments
Cons of self-driving-car-sim
- Less realistic graphics and physics compared to CARLA
- Limited sensor options and environmental conditions
- Lacks advanced features like pedestrians, traffic, and weather simulation
Code Comparison
CARLA example (Python):
import carla
client = carla.Client('localhost', 2000)
world = client.get_world()
blueprint = world.get_blueprint_library().find('vehicle.tesla.model3')
spawn_point = world.get_map().get_spawn_points()[0]
vehicle = world.spawn_actor(blueprint, spawn_point)
self-driving-car-sim example (Unity/C#):
public class CarController : MonoBehaviour
{
private float steeringAngle;
private float acceleration;
void FixedUpdate()
{
ApplySteeringAndAcceleration();
}
}
The code examples show that CARLA uses a Python API for vehicle spawning and control, while self-driving-car-sim uses Unity's C# scripting for car behavior. CARLA's approach offers more flexibility and realism, while self-driving-car-sim's Unity-based system is more accessible for beginners.
Autoware - the world's leading open-source software project for autonomous driving
Pros of Autoware
- Real-world focused: Designed for actual autonomous vehicle deployment
- Comprehensive: Includes planning, perception, and control modules
- Open-source ecosystem: Large community and extensive ROS integration
Cons of Autoware
- Steeper learning curve: More complex setup and configuration
- Hardware requirements: Needs powerful hardware for full functionality
- Limited simulation capabilities: Primarily focused on real-world applications
Code Comparison
CARLA (Python):
import carla
client = carla.Client('localhost', 2000)
world = client.get_world()
blueprint = world.get_blueprint_library().find('vehicle.tesla.model3')
spawn_point = carla.Transform(carla.Location(x=230, y=195, z=40))
vehicle = world.spawn_actor(blueprint, spawn_point)
Autoware (C++):
#include <autoware_auto_msgs/msg/vehicle_kinematic_state.hpp>
#include <rclcpp/rclcpp.hpp>
rclcpp::Node::SharedPtr node = rclcpp::Node::make_shared("vehicle_node");
auto publisher = node->create_publisher<autoware_auto_msgs::msg::VehicleKinematicState>("/vehicle/state", 10);
Both repositories offer valuable tools for autonomous vehicle development, with CARLA focusing on simulation and Autoware on real-world deployment. CARLA provides an easier entry point for beginners, while Autoware offers a more comprehensive solution for production-ready autonomous systems.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
CARLA Simulator
CARLA is an open-source simulator for autonomous driving research. CARLA has been developed from the ground up to support development, training, and validation of autonomous driving systems. In addition to open-source code and protocols, CARLA provides open digital assets (urban layouts, buildings, vehicles) that were created for this purpose and can be used freely. The simulation platform supports flexible specification of sensor suites and environmental conditions.
Download CARLA
Linux:
Windows:
Recommended system
- Intel i7 gen 9th - 11th / Intel i9 gen 9th - 11th / AMD ryzen 7 / AMD ryzen 9
- +32 GB RAM memory
- NVIDIA RTX 3070 / NVIDIA RTX 3080 / NVIDIA RTX 4090
- Ubuntu 20.04
Documentation
The CARLA documentation is hosted on ReadTheDocs. Please see the following key links:
- Building on Linux
- Building on Windows
- First steps
- CARLA asset catalogue
- Python API reference
- Blueprint library
CARLA Ecosystem
Repositories associated with the CARLA simulation platform:
- CARLA Autonomous Driving leaderboard: Automatic platform to validate Autonomous Driving stacks
- Scenario_Runner: Engine to execute traffic scenarios in CARLA 0.9.X
- ROS-bridge: Interface to connect CARLA 0.9.X to ROS
- Driving-benchmarks: Benchmark tools for Autonomous Driving tasks
- Conditional Imitation-Learning: Training and testing Conditional Imitation Learning models in CARLA
- AutoWare AV stack: Bridge to connect AutoWare AV stack to CARLA
- Reinforcement-Learning: Code for running Conditional Reinforcement Learning models in CARLA
- RoadRunner: MATLAB GUI based application to create road networks in the ASAM OpenDRIVE format
- Map Editor: Standalone GUI application to enhance RoadRunner maps with traffic lights and traffic signs information
Like what you see? Star us on GitHub to support the project!
Paper
If you use CARLA, please cite our CoRLâ17 paper.
CARLA: An Open Urban Driving Simulator
Alexey Dosovitskiy, German Ros,
Felipe Codevilla, Antonio Lopez, Vladlen Koltun; PMLR 78:1-16
[PDF]
[talk]
@inproceedings{Dosovitskiy17,
title = {{CARLA}: {An} Open Urban Driving Simulator},
author = {Alexey Dosovitskiy and German Ros and Felipe Codevilla and Antonio Lopez and Vladlen Koltun},
booktitle = {Proceedings of the 1st Annual Conference on Robot Learning},
pages = {1--16},
year = {2017}
}
Building CARLA
Clone this repository locally from GitHub:
git clone https://github.com/carla-simulator/carla.git .
Also, clone the CARLA fork of the Unreal Engine into an appropriate location:
git clone --depth 1 -b carla https://github.com/CarlaUnreal/UnrealEngine.git .
Once you have cloned the repositories, follow the instructions for building in Linux or building in Windows.
Contributing
Please take a look at our Contribution guidelines.
F.A.Q.
If you run into problems, check our FAQ.
Licenses
CARLA licenses
CARLA specific code is distributed under MIT License.
CARLA specific assets are distributed under CC-BY License.
CARLA Dependency and Integration licenses
The ad-rss-lib library compiled and linked by the RSS Integration build variant introduces LGPL-2.1-only License.
Unreal Engine 4 follows its own license terms.
CARLA uses three dependencies as part of the SUMO integration:
- PROJ, a generic coordinate transformation software which uses the X/MIT open source license.
- SQLite, part of the PROJ dependencies, which is in the public domain.
- Xerces-C, a validating XML parser, which is made available under the Apache Software License, Version 2.0.
CARLA uses one dependency as part of the Chrono integration:
- Eigen, a C++ template library for linear algebra which uses the MPL2 license.
CARLA uses the Autodesk FBX SDK for converting FBX to OBJ in the import process of maps. This step is optional, and the SDK is located here
This software contains Autodesk® FBX® code developed by Autodesk, Inc. Copyright 2020 Autodesk, Inc. All rights, reserved. Such code is provided "as is" and Autodesk, Inc. disclaims any and all warranties, whether express or implied, including without limitation the implied warranties of merchantability, fitness for a particular purpose or non-infringement of third party rights. In no event shall Autodesk, Inc. be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of such code."
Top Related Projects
An open autonomous driving platform
openpilot is an operating system for robotics. Currently, it upgrades the driver assistance system in 275+ supported cars.
Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
A ROS/ROS2 Multi-robot Simulator for Autonomous Vehicles
A self-driving car simulator built with Unity
Autoware - the world's leading open-source software project for autonomous driving
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot