This project implements a collision avoidance simulation framework for autonomous vehicles using Model Predictive Control (MPC) and vehicle dynamics. The simulation framework is based on the methodology described in the reference paper:
Reference Paper:
Title: A MPC COMBINED DECISION MAKING AND TRAJECTORY PLANNING FOR AUTONOMOUS VEHICHLE COLLISION AVOIDANCE
Authors: Manel Ammour, Rodolfo Orjuela, and Michel Basset
Published in: IEEE TRANSACTIONS ON INTELLIGENT TRANSPORTATION SYSTEMS, VOL. 23, NO. 12 DECEMBER 2022
The project integrates several modules:
- Vehicle Dynamics: Implements the point-mass model for vehicles.
- MPC Controller: Formulates the MPC optimization problem using CasADi to compute control actions (accelerations & steering) to avoid collisions.
- Simulation: Manages the simulation loop, state updates, and logging of simulation data.
- Environment & Visualization: Contains the road model, lane definitions, and visualization utilities to plot vehicle trajectories and safety barriers.
- Scenarios: Sets up different driving scenarios (e.g., overtaking, lane changes) as described in Table II of the reference paper.
- Plotting Results: Utilities to visualize simulation data (e.g., trajectories, velocities, accelerations).
Project_Root/
├── src/
│ ├── Env.py
│ ├── Fsm.py
│ ├── main.py
│ ├── Mpc_Controller.py
│ ├── Plot_Results.py
│ ├── Scenarios.py
│ ├── Simulation.py
│ ├── Utils.py
│ ├── Vehicle_Dynamics.py
│ ├── simulation_data.npz # generated after simulation run
├── README.md
├── .gitignore
└── requirements.txt
- Python 3.8+
- Recommended package dependencies are listed in the corresponding requirements file.
- NumPy
- Matplotlib
- CasADi
It is recommended to run the project in a Python virtual environment. Follow the steps below:
-
Clone the repository:
git clone <repository_url> cd <repository_directory>
-
Create a virtual environment:
On Windows:
python -m venv venv venv\Scripts\activate
On macOS/Linux:
python3 -m venv venv source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
After setting up the virtual environment and installing dependencies, run the simulation by executing:
python src/main.pyThe simulation will:
- Initialize the environment and scenarios using parameters from
Scenarios.py. - Compute vehicle dynamics and control actions using the MPC in
Mpc_Controller.py. - Log simulation data and update vehicle states in
Simulation.py. - Visualize trajectories and safety barriers using the functions in
Env.py.
To generate graphical plots of the simulation logs, run:
python src/Plot_Results.pyThis will load the simulation data from simulation_data.npz and produce plots such as trajectory charts, velocity profiles, and acceleration profiles.
This simulation framework aims to demonstrate collision avoidance capabilities through:
- MPC-based control: Using CasADi, the optimization problem includes acceleration and jerk constraints, ensuring smooth vehicle maneuvers.
- Dynamic Environment: Realistic vehicle interactions are modeled using a point-mass model, with lane information and road boundaries visualized.
- Scenario-based Testing: The system can switch between multiple driving scenarios (as defined in
Scenarios.py) to evaluate performance under diverse conditions.
Further details, including mathematical formulations and experimental results, can be found in the reference paper provided.
- Improve model fidelity by integrating more complex vehicle dynamics.
- Extend scenario diversity and include multi-agent interactions.
- Experiment with risk-averse formulations and further tuning of control parameters.
This project was developed as part of research in autonomous vehicle collision avoidance. Special thanks to Prof. Pradumn Kumar Pandey.
For any questions or issues, please create an issue in this repository or contact the project maintainer here.