/Steering-MPC

Steering RC Car Model using MPC, compensating for drift dynamics.

Primary LanguageMATLAB

Steering-MPC

% Readme % This file contains brief information about the code. % Author : Shawn Daniel

About the Repository: The following code directories are the simulations of the steering car problem using MPC to track a trajectory.

Simulation I

In Simulation I we have the simulation of a Holonomic car model, meaning the states areonly inertial frame longitudinal, lateral positions, and heading.The vehicle is assumed to have body frame longitudinal velocity which can be generated by breaks, or acceleration(gas).

Simulation II

In Simulation II we have simulation of a simple full dynamic model of a car, and the states are body frame longitudinal and lateral velocity, inertial frame "X and Y", heading, heading rate of change. The longitudinal velocity o the vehicle is assumed constant and the only control herer is the front wheel turning angle. This code involves a nonlinear equation model of a pneumatic tire, using Pacejka Magic Tire formula. The equation of motion is nonlinear, so Linear time invariant LTV MPC was used with MPC to track reference trajectory in discrete time. Additionally, obstacle avoidance is also experimented and played with.

MPCC

Simulation environment of the Model Predictive Contouring Controller (MPCC) for Autonomous Racing developed by the Automatic Control Lab (IfA) at ETH Zurich.

Note

Code developed originally by Dr. Alex Liniger et al. My repository only uses an alternative to Quadprog(), (Quadratic Problem optimization solver) . My QP solver was coded from scratch.

How to run

Before running code

  1. Install ...
  2. Use quadprog, "MPC_vars.interface = 'quadprog';" Note: use of Quadprog yeilds more accurate solution than my QP solver.

Run code

  1. Run simulation.m
  2. Play with the tunning in getMPC_vars.m
  3. Change the car model between FullSize and ORCA
  4. Change the track layout between the ORCA and the RCP track

Illustration

Papers

The papers referenced throughout this repository: F. Borrelli, P. Falcone, T. Keviczky, J. Asgari, and D. Hrovat, “MPC-based approach to active steering for autonomous vehicle systems,” Int. J. Vehicle Autonomous Systems, vol. 3, no. 2/3/4, pp. 265–291, 2005.

Bakker, E., Nyborg, L., Pacejka, H. B., 1987. "Tyre modeling for use in vehicle dynamics studies". SAE paper # 870421. Please check the report for other references.

Liniger, A., et al., (2015). "Optimization-based autonomous racing of 1: 43 scale RC cars". Optimal Control Applications and Methods, 36(5), 628–647.

Notes

System Requirements You need to have the MATLAB Optimization Toolbox installed in order to run this program.

Fun Notes: In locations where the script "O PLAY" is seen, this notes where a user can change parameters to see the convergence nature of MPC.