This repository contains a modular MATLAB/Simulink testbed for longitudinal speed tracking and lateral path tracking. A mid-fidelity vehicle model is used as the plant, while a lower-order dynamic bicycle model is used for MPC prediction.
Phase 0 currently supports two controller backends:
- acados nonlinear MPC
- MATLAB Adaptive MPC
The fixed linear MATLAB MPC backend is reserved but is not yet implemented.
The project was developed with MATLAB R2026a on Windows. The following MATLAB products are required:
- MATLAB
- Simulink
- Control System Toolbox
- Model Predictive Control Toolbox
The acados backend additionally requires:
- Git
- CMake
- MATLAB MinGW-w64 C compiler support
The automated acados installation currently supports Windows only.
Clone the repository and open MATLAB in the repository root:
openProject("computation-aware-sdv.prj");The project paths can also be initialized manually:
startup_project;Open:
common/configuration/controller_parameters.m
Select one backend:
controller.controller_backend = controller.BACKEND_ACADOS;or:
controller.controller_backend = controller.BACKEND_ADAPTIVE;The backend identifiers are:
BACKEND_ACADOS = 1
BACKEND_MATLAB = 2 (not implemented)
BACKEND_ADAPTIVE = 3
From the repository root, run:
run("phase0/main.m");The script checks the required MATLAB products and then runs:
- Urban profile
- Aggressive maneuver
- Highway cruise
If Adaptive MPC is selected, no acados installation is required.
If acados is selected and either acados or the generated S-function is missing, MATLAB asks:
Install acados and generate the S-function now? [y/N]:
Enter y to continue. The first installation may take longer than an
ordinary simulation run.
The same setup can be performed explicitly:
startup_project;
setup_acados_dependency;
s_fun_generation_acados;The project installs the pinned acados v0.5.4 dependency outside the repository:
%LOCALAPPDATA%/SDV/dependencies/acados/v0.5.4
The generated solver is placed under:
build/acados/sdv_dynamic_bicycle/
Regenerate the S-function after changing the prediction dynamics, horizon, cost structure, constraints, solver options, or generated interface ports. Changing only the scenario reference or road profile does not require regeneration.
After running startup_project, use one of:
run_urban_profile;
run_aggressive_maneuver;
run_highway_cruise;Scenario results and figures are saved by controller backend:
phase0/results/<controller>/<scenario>/
phase0/figures/<controller>/<scenario>/
Each run stores simulation results, tracking-error metrics, and figures. acados runs additionally store solve-time statistics and telemetry.
Install or activate the product reported by
check_runtime_requirements.
Install the MATLAB MinGW-w64 support package, then select it:
mex -setup Csetup_acados_dependency;s_fun_generation_acados;Close the Simulink models and unload generated MEX files before rebuilding:
bdclose("all");
clear mex;
s_fun_generation_acados;The Phase 0 regeneration time assumes MATLAB and the required MathWorks products are already installed. First-time acados installation and S-function compilation are dependency-provisioning steps and are not included in the ordinary baseline simulation time.