https://github.com/zju-fast-lab/mpc-car-tutorial
A tutorial of using MPC (both implementations of nonlinear MPC and linear time-varying MPC) for reference tracking with a bicycle model.
https://github.com/zju-fast-lab/mpc-car-tutorial
Last synced: about 1 year ago
JSON representation
A tutorial of using MPC (both implementations of nonlinear MPC and linear time-varying MPC) for reference tracking with a bicycle model.
- Host: GitHub
- URL: https://github.com/zju-fast-lab/mpc-car-tutorial
- Owner: ZJU-FAST-Lab
- License: gpl-3.0
- Created: 2022-05-12T05:57:56.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-21T02:55:58.000Z (over 3 years ago)
- Last Synced: 2025-06-21T17:02:05.415Z (about 1 year ago)
- Language: C
- Size: 210 KB
- Stars: 32
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## How to Run
```
./install_tools.sh
catkin_make -j1
source devel/setup.zsh
roslaunch mpc_car simulation.launch
```
## How to Tune Parameters
```
./src/mpc_car/config/mpc_car.yaml -> mpc parameters
./src/car_simulator/config/car_simulator.yaml -> initial states (in simulation)
```
## Object and Constraints
> Implement MPC of tracking the reference trajectory in C++;
```
min J = \sum_{i=0}^N (x-x_r)^2+ (y-y_r)^2 + rho * (phi-phi_r)^2
s.t. -0.1 <= v_k <= v_max
|a_k| <= a_max
|delta_k| <= delta_max
|delta_{k+1} - delta_k| <= ddelta_max * dt
```
## NMPC or QP
```
./src/car_simulator/src/car_simulator_nodelet.cpp
```
>ret = mpcPtr_->solveNMPC(state_);
>ret = mpcPtr_->solveQP(state_);
QP is solved by OSQP and NMPC is solved by lbfgs.