Giter VIP home page Giter VIP logo

reinforcement_learning_auto_parking's Introduction

Auto Parking using DQN with Webots & Airsim simulator

This is a simple implementation of auto-parking using reinforcement learning methods with GPS and Lidar sensors.

We have deployed our model on 2 different environments to validate its superiority.

Airsim Environment

Quick Start

  1. download the Neighborhood4 environment from the release ( modified from swri-robotics/Neighborhood )

  2. unzip the environment

  3. run the Unreal Engine generated .exe file in the environment package

  4. clone this repository and cd into the Airsim directory then execute the evaluation by

    python eval.py

This environment is manually controllable, you can impress F10 to see the control panel

Training

follow the instructions upon, train the model by

python dqn_car.py

Methods

We train an agent by setting a reward function by

image-20220808191559048

where the rewards are calculated as follows respectively

image-20220808191658029

Some of the functions are modified from Train PPO Agent for Automatic Parking Valet - MATLAB & Simulink, and we added some special reward when something bad happened such as collision and drive out of our bounded area or total time out

The reward function can be viewed like this

figure

We defined 11 kinds of actions of our car, which can be illustrated mainly by the figure below

car1

there a 10 directions each performs as an action, and we set a stop action which can raise the brake.

Results

pos

image-20220808190143412

We finally made a stable auto-parking model after about 4000 episodes training, countless fails, 15 days figuring out problems and adjusting the hyper parameters using the relative distance and orientation.

Extend

There are possibilities using CNN and a backward camera on the car to train a more robust model, but because the queite simple environment(thus CNN can not extract ample valid information) we didn't try that, but we can tell that it can be easily performed by just setting the DQN policy to "CNNpolicy"

This code is modified from AirSim/PythonClient/reinforcement_learning at main · microsoft/AirSim

Webots Environment

car.jpg

First download Webots

python==3.8 gym==0.21.0 numpy==1.22.3 stable_baselines3==1.6.0 torch==1.12.0

configure python interpreter in

9SQ56K8N_~Z_4I72RL1Y4EW.png

observation:

  • position

  • orientation

  • distance_sensor_value

We can simply add any sensors including camera,lidar to the car. The observation we choose is based on the reality.

reward:

see function in .\Webots\controllers\rl_controller\rl_controller.py compute_reward

environments and action code:

.\Webots\controllers\rl_controller\car_controller.py

train code:

.\Webots\controllers\rl_controller\rl_controller.py

algorithm:

DQN

training_logs:

.\Webots\controllers\rl_controller\训练记录

result:

park_pose

logs

reference

using Webots in reinforcement learning

Real World Deployment

image-20220808184519145

Under Developing

reinforcement_learning_auto_parking's People

Contributors

nicolaus-huang avatar ztysdu 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.