Git Product home page Git Product logo

pandas-team / automatic-parking Goto Github PK

View Code? Open in Web Editor NEW
293.0 5.0 76.0 1.47 MB

Python implementation of an automatic parallel parking system in a virtual environment, including path planning, path tracking, and parallel parking

License: GNU General Public License v3.0

Python 100.00%
self-driving-car autonomous-vehicles autonomous-driving python path-planning path-tracking control autopark autonomous-parking automatic-parking

automatic-parking's Introduction

Automatic Parallel Parking: Path Planning, Path Tracking & Control

This repository contains a python implementation of an automatic parallel parking system in a virtual environment that includes path planning, path tracking, and parallel parking. The agent navigates its route through the environment and is directed to the assigned park location by the MPC controller. You can find the article on Towards Data Science.

Envroinment

The first step to develop an auto park system is to design and develop an environment capable of giving visual render using OpenCV library. The environment is implemented in environment.py as a class and receives obstacles at the beginning env = Environment(obs). The agent can be placed using env.render(x,y,angle). A sample of the environment is displayed below. You can choose the parking spot from 1 to 24.

developed environment

Path Planning

A* Algorithm

The agent will find a path from start to its goal using A*. This implementation of A* from PythonRobotics considers parameters like obstacles and robot radius.

Interpolating Path With B-spline

After finding a path in a discrete 100*100 space, the path is smoothed and scaled to 1000*1000 space of environment using b-spline. The result is a set of points to guide our agent!

Path Tracking

The kinematic model of the car is:

$$\left\{\begin{matrix} \dot{x} = v . cos(ψ)\\\ \dot{y} = v . sin(ψ)\\\ \dot{v} = a\\\ \dot{ψ} = v . tan(δ)/L \end{matrix}\right.$$

a: acceleration, δ: steering angle, ψ: yaw angle, L: wheelbase, x: x-position, y: y-position, v: velocity

The state vector is:

$$z=[x,y,v,ψ]$$

x: x-position, y: y-position, v: velocity, ψ: yaw angle

The input vector is:

$$u=[a,δ]$$

a: acceleration, δ: steering angle

Control

The MPC controller controls vehicle speed and steering based on the model and the car is directed through the path. There is an option for using the linearized model for MPC. In this case MPC linearizes the kinematic model around the operating point and then does the optimization.

Parallel Parking

This part consists of 4 rules that the agent must choose according to parking position. At first, the agent will find a path to park position then it will compute the arriving angle. Based on the arriving angle, the agent chooses a coordinate as ensure1. After that, the parking path is planned from ensure1 to ensure2 using 2 circle equations as mentioned below. MPC controls the agent and car parks in ensure2 coordinate.

automatic_parking_process

Inference

Run the code using this command:

$ python main_autopark.py --x_start 0 --y_start 90 --psi_start 0 --parking 7

Citation

DOI

About Us

We as Team Pandas won 1st place in the National Rahneshan competition 2020-2021 for autonomous vehicles. This contest has been one of the most competitive and challenging contests in the Rahneshan tournaments with more than 15 teams competing from top universities in Iran.

Contact

Feel free to contact us via email or connect with us on linkedin.

automatic-parking's People

Contributors

abbasomidi77 avatar aidamohammadshahi avatar amirhossein-kz avatar amirhosseinh77 avatar miladsoltany avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

automatic-parking's Issues

README

Some typo in README.

1/ kinematic.

Currently, written:

The kinematic model of the car is:
x = vcos(ϕ)
y = vsin(ϕ)
v = a
ϕ = vtan(δ)/L

1.1/ Missing derivative symbol '. Should be:

The kinematic model of the car is:
x' = v . cos(ϕ)
y' = v . sin(ϕ)
v' = a
ϕ' = v . tan(δ)/L

1.2/ Missing: a: acceleration, δ: steering angle, ϕ: yaw angle, L: wheelbase, x: x-position, y: y-position, v: velocity
1.3/ v was stuck to cos, sin, tan.

2/ The state vector.

The symbol φ should be ϕ

3/ The input vector

There is a typo a: accellation, δ: steering angle => acceleration :)

Questions about environment

If I want to create a new parking lot map and create new obstacles, what are the coordinates of obstacles and walls based on in the example?

psi

May I ask what psi represents?

problem about car control

Hi,

Please see the attached video, I don't change any thing, but the control looks very wired, could someone tell me what the problem is? Thanks.

20220520_161338.mp4

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.