Skip to content

Self parking with reinforcement learning

License

Notifications You must be signed in to change notification settings

tjshiheng/Autoparking

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autoparking

Website shields.io License: MIT C++ GitHub stars GitHub forks DOI

Autoparking simulates a typical car parking scenario, where the goal is to re-position a car with a series of manuevers, while avoiding obstacles nearby. Thanks to Q-Learning, a popular reinforcement learning algorithm, I show that the car is able to park on its own, without any external input.

Everything, including the AI logic, is implemented from scratch in C++. The only dependency is the open-source graphics library (Allegro).

Want to know more about how it works? Watch the video or read the short paper. Enjoy!

Autoparking GIF
Demo of Autoparking trained model

Table of Contents

Folders organization

bin -> contains the executable binaries after building
build -> contains the .o object files generated during the compilation
cache -> contains pre-trained weights of Q and R so that you can skip the learning phase
conf -> contains the configuration files
docs -> contains .pdf files with interesting information about this project. Give it a look!
font -> contains few fonts used by the application
img -> contains the gif image above
Makefile -> just a makefile
README -> this file
src -> contains the most important source files, here's the core of the application
stats -> contains some data for statistical purposes generated during the training, if logging is enabled

Setup

First of all, download this repository with:

git clone https://www.github.com/leoll2/Autoparking.git

Install dependencies

The only dependency is Allegro5. The following steps refer to Debian/Ubuntu and are based on the official Allego wiki. Installing on other distros is possible, though some dependencies may differ. For instance, Centos/RHEL users shall refer to the relative documentation. Honestly, I'm not sure which deps are mandatory and which are optional, but unless you have limited storage capacity (or enough time to figure out), I recommend to download them all.

Setup your repo list:

cd /etc/apt/
sudo gedit sources.list

and add contrib and free at the end of those lines starting with deb or deb-src. Then update:

sudo apt-get update

Now install required dependencies:

sudo apt-get install build-essential git cmake cmake-curses-gui xorg-dev libgl1-mesa-dev libglu1-mesa-dev

and optional ones:

sudo apt-get install -y cmake g++ freeglut3-dev libxcursor-dev libpng-dev libjpeg-dev libfreetype6-dev libgtk2.0-dev libasound2-dev libpulse-dev libopenal-dev libflac-dev libdumb1-dev libvorbis-dev libphysfs-dev

From the Autoparking directory, clone the Allegro5 git repository:

git clone https://github.com/liballeg/allegro5.git

and switch to version 5.2.4:

git checkout 5.2.4

Get ready to compile:

mkdir build
cd build
ccmake -DCMAKE_INSTALL_PREFIX=/usr ..

Inside the cmake environment, press 'C' (configure) and 'E' if it complains about few missing libraries (don't worry, it still works). Then press 'G' (generate).

Here comes the fun, compile:

make

You can optionally add the -j option to parallelize the compilation on multiple cores.
Finally, install:

sudo make install

If all the previous steps went fine, Allegro5 is properly installed and setup.

Build

Compiling Autoparking is straightforward. From the project root directory:

make

Run

Start the simulation:

bin/main

About

This work has first proposed as final project for the 'Neural Networks' exam at SSSUP, and later presented at EEML 2020. [video] [paper]

Anyone is encouraged to fork, modify or extend it for non-commercial purposes, as long as the original author is explicitly credited (cite as below). Feel free to contact me for any doubt!

@misc{LaiAutoparking2018,  
  author = {Lai, Leonardo},  
  title = {Autoparking},  
  year = {2018},  
  publisher = {GitHub},  
  journal = {GitHub repository},  
  howpublished = {\url{https://github.com/leoll2/Autoparking}},  
  doi = {10.5281/zenodo.4568892},
}

About

Self parking with reinforcement learning

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 96.0%
  • C 2.6%
  • Makefile 1.4%