Skip to content
forked from OATML/oatomobile

A research framework for autonomous driving

License

Notifications You must be signed in to change notification settings

for-ai/carsuite

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CARSUITE: A research framework for autonomous driving

Overview | Installation | Baselines | Paper

PyPI Python Version PyPI version arXiv

CARSUITE is a library for autonomous driving research. CARSUITE strives to expose simple, efficient, well-tuned and readable agents, that serve both as reference implementations of popular algorithms and as strong baselines, while still providing enough flexibility to do novel research.

Overview

If you just want to get started using CARSUITE quickly, the first thing to know about the framework is that we wrap CARLA towns and scenarios in OpenAI gyms:

import carsuite

# Initializes a CARLA environment.
environment = carsuite.envs.CARLAEnv(town="Town01")

# Makes an initial observation.
observation = environment.reset()
done = False

while not done:
  # Selects a random action.
  action = environment.action_space.sample()
  observation, reward, done, info = environment.step(action)
  
  # Renders interactive display.
  environment.render(mode="human")

# Book-keeping: closes 
environment.close()

Baselines can also be used out-of-the-box:

# Rule-based agents.
import carsuite.baselines.rulebased

agent = carsuite.baselines.rulebased.AutopilotAgent(environment)
action = agent.act(observation)

# Imitation-learners.
import torch
import carsuite.baselines.torch

models = [carsuite.baselines.torch.ImitativeModel() for _ in range(4)]
ckpts = ... # Paths to the model checkpoints.
for model, ckpt in zip(models, ckpts):
  model.load_state_dict(torch.load(ckpt))
agent = carsuite.baselines.torch.RIPAgent(
  environment=environment,
  models=models,
  algorithm="WCM",
)
action = agent.act(observation)

Installation

We have tested CARSUITE on Python 3.5.

  1. To install the core libraries (including CARLA, the backend simulator):

    # The path to download CARLA 0.9.6.
    export CARLA_ROOT=...
    mkdir -p $CARLA_ROOT
    
    # Downloads hosted binaries.
    wget http://carla-assets-internal.s3.amazonaws.com/Releases/Linux/CARLA_0.9.6.tar.gz
    
    # CARLA 0.9.6 installation.
    tar -xvzf CARLA_0.9.6.tar.gz -C $CARLA_ROOT
    
    # Installs CARLA 0.9.6 Python API.
    easy_install $CARLA_ROOT/PythonAPI/carla/dist/carla-0.9.6-py3.5-linux-x86_64.egg
  2. To install the CARSUITE core API:

    pip install --upgrade pip setuptools
    pip install carsuite
  3. To install dependencies for our PyTorch- or TensorFlow-based agents:

    pip install carsuite[torch]
    # and/or
    pip install carsuite[tf]

Citing CARSUITE

If you use CARSUITE in your work, please cite the accompanying technical report:

@inproceedings{filos2020can,
    title={Can Autonomous Vehicles Identify, Recover From, and Adapt to Distribution Shifts?},
    author={Filos, Angelos and
            Tigas, Panagiotis and
            McAllister, Rowan and
            Rhinehart, Nicholas and
            Levine, Sergey and
            Gal, Yarin},
    booktitle={International Conference on Machine Learning (ICML)},
    year={2020}
}

About

A research framework for autonomous driving

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%