Giter VIP home page Giter VIP logo

model-predictive-controllers's Introduction

Model-Predictive-Controllers

Making model predictive controllers for making a Self-Driving or Autonomous Car follow the speed limit, pull into parking spaces, and avoid obstacles.

Installation and Setup

  • Fork the repo and clone it.
git clone https://github.com/Frostday/Model-Predictive-Controllers.git
  • Install the necessary packages required to run the code
pip install -r requirements.txt
  • To see highway speed control run the following command
python -u HighwaySpeedControl.py
  • To see parking control run the following command
python -u ParkingControl.py
  • To see obstacle avoidance run the following command
python -u ObstacleAvoidance.py
  • If you wanna play around with the simuator then try editing playground.py

Highway Speed Control

This was the most basic controller, with only two states - x axis position and the speed and only one input - pedal. I designed the cost function to penalize high distances from the goal, overshooting from the goal and also increasing the speed over a given speed limit of 10km/h.

Parking Control

This was much more difficult since I had to work with four states - x axis position, y axis position, angle of car and the speed and two inputs - steering wheel and pedal. Here I designed the cost function to penalize distance from the final goal, difference in angle from the angle of the final goal, rapid changes in velocity and steering (so passengers don't get motion sickness).

Obstacle Avoidance

Here I again had to work with four states - x axis position, y axis position, angle of car and the speed and two inputs - steering wheel and pedal. I designed the cost function to penalize distance from the final goal, difference in angle from the angle of the final goal and also using if statements I introduced a very high cost term if the vehicle got too close to the obstacle. You might notice that the obstacle is not exactly between the initial position and final goal but slightly above on the y-axis. This is because in an ideal condition if it is directly between the car and the final goal then the optimizer will get confused as it won't be able to decide wether it wants to go above it or below it and hence instead of going around it the optimizer will get stuck and the vehicle will stop right in front of the obstacle.

model-predictive-controllers's People

Contributors

frostday avatar

Stargazers

Hao 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.