Coder Social home page Coder Social logo

learning2drive's Introduction

Learning to Drive in CARLA

Learning to drive in CARLA v0.8.2 using reinforcement learning. The code has been tested with Python 3.5 and Tensorflow 1.14.0.

Quick Start

  1. Install CARLA v0.8.2.
  2. Install dependencies (cf requirements.txt).
  3. (Optional) Download pre-trained VAE here.
  4. Train a control policy for 10000 steps using Soft Actor-Critic (SAC).
python train.py --algo sac -vae <path-to-vae> -n 10000
  1. Test the trained agent for 2000 steps.
python enjoy.py --algo sac -vae path-to-vae.pkl --exp-id 0 -n 2000

Check enjoy.py for more options.

Train the Variational Autoencoder (VAE)

  1. Collect images by manually driving the car around the track. Don't forget to store the images captured by the camera on the car into a folder.
python manual_control.py 
  1. Train a VAE.
python -m vae.train --n-epochs 50 --verbose 0 --z-size 64 -f <path-to-recorded-images>
  1. Explore Latent Space
python -m vae.enjoy_latent -vae <path-to-vae>

Smooth Control

With the current reward function used, the car doesn't achieve a smooth control. A way around the is to restrict the maximum change in the steering angle at each step. This is generally acceptable since humans drive in a similar manner. For more information check this awesome post.

Set the following values in config.py.

MAX_STEERING_DIFF = 0.15 # 0.1 for very smooth control, but it requires more steps
MAX_THROTTLE = 0.6 # MAX_THROTTLE = 0.5 is fine, but we can go faster

Credits

learning2drive's People

Contributors

sheelabhadra avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.