Model Predictive Control (MPC) for Unmanned Ground Vehicles (UGV): (Course Project)
Problem Statement:
Model Predictive Control(MPC) for trajectory tracking on Unmanned Ground Vehicle (UGV) with waypoint generation in an unknown environment using perception.
Possible Extensions: (Maybe someday in future :P)
Dynamic obstacle avoidance
Implementation and demonstration on hardware
Setup:
This is the setup for Ubuntu (22.04). Not sure how it works on Windows/Mac.
(Recommended) Make a separate conda environment and install the package in that environment: conda create -n FOR_Project python=3.8 conda activate FOR_Project
First clone the repository: git clone https://github.com/prakrutk/FOR_Project.git
Checkout to the branch named 'Prakrut': git checkout Prakrut
Then go into the directory and install the package using pip: cd FOR_Project pip install --upgrade pip pip install -e . pip install -r requirements.txt
To run MPC code: python3 dynamics/MPC.py (disclaimer: Something is working now we have to figure out what exactly is working)
To run Waypoint generation code: python3 Waypoint_generation/Waypoint_new.py
State variable: $ X = (x,y,\psi , \dot x, \dot y, \dot \psi )$
Input/control variable: $U = (\delta, \omega )$
Where, $x,y$ are coordinates of the COM of the car in world frame. $\psi$ is the heading angle of the car. $\delta$ is the steering angle of the car. $\omega$ is the rotational speed of both the wheels.
$f_{f_x},f_{f_y},f_{r_x},f_{r_y}$ are the force acting in the body frame of the front and rear wheels of the car respectively.
$l_f$ is the distance of the front wheel from the COM of the car. $l_r$ is the distance of the rear wheel from the COM of the car. $\beta$ is the sideslip angle of the car. (Not used)
$C_l$ is the cornering stiffness of the tire. $s_f$ is the slip ratio of the front wheel. $s_r$ is the slip ratio of the rear wheel. $c_l$ is the longitudinal stiffness of the tire. $\alpha_f$ is the slip angle of the front wheel. $\alpha_r$ is the slip angle of the rear wheel.
Assuming a small slip angle and small slip ratio, the forces acting on the car can be written as:
$$ f_{f_x} = C_ls_f$$
$$ f_{f_y} = C_c\alpha_f$$
With the assumptions and substituting the above equations in the dynamics equation of the car, we get:
$$\Phi = \begin{bmatrix} \bar C \bar B & 0 & 0 & \cdots \\ \bar C \bar A \bar B & \bar C \bar B & 0 & \cdots \\ \bar C \bar A^2 \bar B & \bar C \bar A \bar B & \bar C \bar B & \cdots \\ \vdots & \vdots & \vdots & \ddots \end{bmatrix}$$
$$\Theta = \begin{bmatrix} \bar C \bar A \\ \bar C \bar A^2 \\ \bar C \bar A^3 \\ \vdots \end{bmatrix}$$