Giter Club home page Giter Club logo

selfdrivingcar_modelpredictivecontrol's Introduction

Model Predictive Control

alt text

Overview

In this project, Self Driving Car is controlled successfully by Model Predictive Control. The goal of this project is to navigate a track in the simulator, which communicates telemetry and track waypoint data via websocket, by sending steering and acceleration commands back to the simulator. The solution needs to handle 100ms latency, because one may encounter in real-world application. In this work, the IPOPT and CPPAD libraries are utilized to calculate an optimal trajectory and its associated actuation commands in order to minimize error with a third-degree polynomial fit to the given waypoints. The optimization takes into consideration only a short duration's worth of waypoints, and produces a trajectory for that duration based upon a model of the vehicle's kinematics and a cost function based mostly on the vehicle's cross-track error (roughly the distance from the track waypoints) and orientation angle error, with other cost factors included to improve performance

Controller Design

The kinematic model includes the vehicle's x and y coordinates, orientation angle (psi), and velocity, as well as the cross-track error and psi error (epsi). Actuator outputs are acceleration and delta (steering angle): alt text

N and dt values are optimized by trial-error method. The values chosen for N and dt are 10 and 0.1, respectively. These values mean that the optimizer is considering a one-second duration in which to determine a corrective trajectory.

The waypoints are transformed to the vehicle's perspective. This simplifies the process to fit a polynomial to the waypoints because the vehicle's x and y coordinates are now at the origin and the orientation angle is zero.

The original kinematic equations depend on the actuations from the previous timestep, but with a delay of 100ms. The actuations are applied another timestep later in order to solve latency problem. Also, in addition to the cost functions suggested before (penalizing cte, epsi, velocity error, delta, acceleration, change in delta, and change in acceleration) an extra penalizing term, which is a combination of velocity and delta, is added. According to the simulation results, the controller is promising.

Prerequisites

The project has the following dependencies :

Build Instructions

  1. Clone this repo.
  2. Make a build directory: mkdir build && cd build
  3. Compile: cmake .. && make
  4. Run it: ./mpc.

selfdrivingcar_modelpredictivecontrol's People

Contributors

domluna avatar baumanab avatar mvirgo avatar akgunonur avatar ianboyanzhang avatar swwelch avatar awbrown90 avatar

Watchers

 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.