A comprehensive framework for simulating and implementing Model Predictive Control (MPC) strategies for vehicle platooning, featuring ROS 2 integration and Python simulations.
platoon-control/
├── WK/ # ROS 2 simulation package
│
├── simulation.py # Python simulation for string stability without MPC
│
├── MPC/ # MPC implementation core
│ ├── MPCPkg/ # Compiled MATLAB MPC package
│ ├── TMPC.m # Traditional MPC controller function
│ ├── LMPC.m # Laguerre in MPC controller function
│ └── casadi-3.7.0/ # Optimization library
│ └── sample.py # Python simulation for string stability using MPC
│
│── Dynamic Programming Decision Making.ipynb # DP based decision making for merging and splitting
│
└── README.md # This document
- ROS 2 Integration: Full-scale Gazebo simulation with articulated vehicle models
- Predictive Control: MPC implementation using CasADi for real-time optimization
- Multi-Scale Testing: From 3-vehicle Python simulations to 10+ vehicle ROS scenarios
sudo apt install ros-humble-moveit ros-humble-depth-image-procpip install numpy matplotlib casadi controlRequired Toolboxes:
- Control System Toolbox
- MATLAB Compiler SDK
git clone https://github.com/yourusername/platoon-control.git
cd platoon-controlcd WK/
rosdep install --from-paths . --ignore-src -r -y
colcon buildcd ../simulation
pip install -r requirements.txtIn MATLAB:
cd MPC/
addpath(genpath('casadi-3.7.0-windows64-matlab2018b')) % Update this path as per your OS and MATLAB versioncd WK/
ros2 launch platoon_sim.launch.py vehicle_count:=10cd simulation/
python platoon_sim.py --taus 0.51 0.6 0.55 --pos 200 195 175 --vel 22.2 20 25y = TMPC(4, [0.51, 0.6, 0.55, 0.49], [22.2, 20, 25, 21]);from platoon_mpc import TMPC
control_signals = TMPC(4, [0.51, 0.6, 0.55, 0.49], [22.2, 20, 25, 21])| Parameter | File Location | Description |
|---|---|---|
| Vehicle Dynamics | MPC/TMPC.m (Lines 25–40) |
τ values, state-space models |
| MPC Weights | MPC/TMPC.m (Lines 115–120) |
Q/R matrices for cost function |
| Platoon Spacing | WK/config/platoon.yaml |
Inter-vehicle distance policies |
-
Liang, C.-Y., and Peng, H., “String Stability Analysis of Adaptive Cruise Controlled Vehicles,” Journal of Dynamic Systems, Measurement, and Control, vol. 122, no. 3, pp. 576–586, Sep. 2000. [Online].
-
Y. Zheng, S. E. Li, J. Wang, K. Li, and S. E. Shladover, “A Cooperative Driving Strategy for Merging at On-Ramps Based on Dynamic Programming,” IEEE Transactions on Intelligent Transportation Systems, vol. 21, no. 1, pp. 172–184, Jan. 2020. [Online].
-
J. Li, B. Yang, and F. Wang, “PeerVote: A Decentralized Voting Mechanism for P2P Collaboration Systems,” in Proc. 10th IEEE Int. Conf. on Computer Communications and Networks (ICCCN), Scottsdale, AZ, USA, 2001, pp. 277–282. doi:10.1109/ICCCN.2001.956282
-
L. Guo, P. Ge, D. Sun, and Y. Qiao, “Adaptive Cruise Control Based on Model Predictive Control with Constraints Softening,” Applied Sciences, vol. 10, no. 5, pp. 1–16, Feb. 2020. doi:10.3390/app10051635
-
Elsevier, “Laguerre Function – An Overview,” ScienceDirect Topics, [Online]. Available: https://www.sciencedirect.com/topics/mathematics/laguerre-function