Skip to content

PreCyseGroup/Feedback-Linearized-MPC-for-self-driving-cars

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Feedback-Linearized-MPC-for-self-driving-cars

Code developed for the paper: "C. Tiriolo, W. Lucia - A Feedback Linearized Model Predictive Control Strategy for Input-Constrained Self-Driving Cars" A novel Model Predictive Control strategy based on feedback linearization aimed at performing trajectory tracking with self-driving cars. The algorithm works with Quanser Qcar, and it is implemented in Simulink and supports automatic C code generation for Qcar.

Trajectory Tracking Problem Formulation

Consider the input-constrained differential-drive robot and a bounded and smooth trajectory $q_r(k)=\left[x_r(k),y_r(k),\theta_r(k),\varphi_r(k)\right]^T$ Design a trajectory tracking control law $[v(k),\omega(k)]^T=\phi(k,q(k),q_r(k))\in\mathcal{U}_{car}$ such that the tracking error $\tilde{q}(k)=q(k)-q_r(k)$ remains bounded $\forall k\geq 0$.

Prerequisites

The code was tested on Matlab 2022b environment. It requires the Ellipsoidal Toolbox ET (https://www.mathworks.com/matlabcentral/fileexchange/21936-ellipsoidal-toolbox-et) and MPT3 toolbox (https://www.mpt3.org/) for plotting purposes. To reproduce the experiments discussed in the paper, see the Experiment folder, a Quanser Qcar, Quarc license, and a Vicon Vero camera system are required.

File Descriptions - Simulation

The "Simulations" folder contains the Matlab and Simulink files to simulate the three tracking controller compared in the paper: the proposed Feedback Linearized MPC, a Nonlinear MPC, and a Backstepping controller. All the controllers are simulated considering an eight-shaped reference trajectory. Each tracking controller consist of a Matlab setup script and a Simulink model, outlined as follows:

  • "setup_trajectory_FL_MPC.m", "setup_trajectory_NL_MPC.m", and "setup_trajectory_backstepping.m" define all the variables and parameters needed by the Simulink models, including the trajectory and controller configuration parameters.
  • "Trajectory_Tracking_Car_FL_MPC.slx", "Trajectory_Tracking_Car_NL_MPC.slx", and "Trajectory_Tracking_Car_Backstepping.slx", are the Simulink models that simulate the considered tracking algorithms. Each Simulink Model consists of a controller block and a Car model block. The controller implement the tracking control algorithm using Matlab funcitons, while the car's model block implement the bicycle kinematic equations.

File Descriptions - Experiment

  • The "Experiments" folder contains the Matlab and Simulink files to reproduce the experimental comparison presented in the paper. The experiments require the use of a Vicon Vero camera system Quanser Qcar, a ground workstation running Vicon Tracker software and Quarc license, and a WiFi router. The code is implemented through Simulink models configured for automatic C code generation which is cross-compiled and executed onboard on the Qcar. The car's position and orientation is measured an ad-hoc camera-based Indoor Localization System (IPS) and streamead to the car through WiFi communication. The car executes an Unscented Kalman Filter algorithm to estimate its state (position, orientation and steering angle), using the IPS and IMU measurements. The considered reference is a "race-based" trajectory, pre-generated by acquiring a sequence of waypoints disseminated in the considered workspace, and interpolating them using an ad-hoc cubic spline-based algorithm. The following files are available in the "experiments" folder:
  • "Vicon_server.mdl", which runs on the ground workstation, acquires the pose of the Qcar from Vicon Tracker software, and it streams it to the Qcar using a TCP server.
  • "setup_FL_MPC.m", "setup_NL_MPC.m", and "setup_backstepping.m" are the Matlab configurations scripts defining all variables and parameters needed by the Simulink models, including the trajectory and controller configuration parameters.
  • "Experiment_Qcar_FL_MPC.slx", "Experiment_Qcar_NL_MPC.slx", and "Experiment_Qcar_backstepping.slx", are the Simulink models that performs localization and state estimation, reference acquisition, and control law computation using the three investigated controllers. All the tasks are separeted in different matlab functions and subsystems.

Demo - Simulation

  • Run "setup_trajectory_XXXX.m", and then "Trajectory_Tracking_Car_XXXX.slx", where "XXXX" is the algorithm of interest (see File Descriptions - Simulation)

Demo - Experiment (Qcar and Vicon Vero cameras setup required)

  • Place a set of at least 5 reflective markers on the Qcar.
  • Launch Vicon Tracker software and confugure it to acquire the position of the center of the car's rear axis (not the center of mass of the car).
  • Launch "Vicon_server.mdl", setup the Vicon block with the IP address and object of interest. The object must have the same name as the one specified in Vicon Tracker.
  • Configure the parameters configuration scripts "setup_XXXX.m", specificy the IP address of the running Vicon server. Then, run the script.
  • Configure the Simulink models "Experiment_Qcar_XXXX.slx", specifying the IP address of the Vicon server inside the Stream Client block, and the IP address of the Qcar inside the Quarc Code Generation option panel (refer to Quarc official documentation). Then, run the model through "Monitor&Tune" button. If no errors pop up, Simulink will generate the executable file and will send it to the car. The experiment will start.

Plot paper's results.

All the data collected in the performed experiments have been saved in the folder Results and those can be displayed without the need of reproducing the experiments. For this purpose, run the Matlab script inside the results folder

Videos

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • MATLAB 100.0%