MATLAB research code accompanying the paper “Koopman Operator Framework for Modeling and Control of Off-Road Vehicle on Deformable Terrain” by Kartik Loya and Phanindra Tallapragada.
The paper is available on arXiv and has been submitted to the ASME Journal of Autonomous Vehicles and Systems (JAVS-26-1012).
This repository contains the MATLAB simulation, data-processing, Koopman-model training, prediction-analysis, and model predictive control code used to study off-road vehicle dynamics on sandy-loam and clay terrain.
Paper conclusion: Terrain-specific Koopman operators provide accurate short-horizon predictions at a computational cost suitable for constrained MPC. The results also show that using an operator learned for the wrong terrain can cause large prediction errors and unsafe closed-loop behavior, motivating terrain-aware model selection or online adaptation.
This repository implements a hybrid physics-informed and data-driven framework for predicting and controlling off-road vehicle motion on deformable terrain. The workflow combines:
- a five-degree-of-freedom vehicle simulation with Bekker–Wong terramechanics;
- simulated trajectories on sandy loam and clay;
- recursive subspace identification with Grassmannian-distance-based data selection;
- a finite-dimensional linear Koopman predictor with Gaussian-process lifting; and
- constrained Koopman model predictive control (KMPC) for trajectory tracking.
The learned models provide stable short-horizon predictions, can account for mild terrain-height variation, and support closed-loop tracking subject to steering and wheel-torque constraints.
The Koopman predictors are evaluated separately on sandy-loam and clay test trajectories. The plots report the predicted body-frame longitudinal velocity
The representative trajectory compares the simulated response (blue) with the K-SSID prediction (red) over 20 seconds.
Prediction error generally increases as the interval between measurement refreshes grows and as the open-loop prediction advances in time.
| Error over the refreshing horizon | Error over prediction time |
|---|---|
![]() |
![]() |
The clay example likewise compares the simulated and Koopman-predicted trajectory and velocity states over 20 seconds.
The clay error plots show the effect of extending the measurement-refresh interval and the growth of prediction error with time.
| Error over the refreshing horizon | Error over prediction time |
|---|---|
![]() |
![]() |
functions/
simulation_model/ Vehicle and deformable-terrain dynamics
utility/ Recursive SSID, Koopman fitting, and prediction
scripts/
simulation/ Flat-terrain data generation
simulation_elev/ Terrain-height-variation data generation
data_handler/ Dataset assembly and train/validation/test splits
koopman_training/ Model training and hyperparameter sweeps
result_analysis/
Clay_prediction/ Clay prediction analysis and figures
Sandyloam_prediction/ Sandy-loam prediction analysis and figures
koopman_MPC/ Koopman MPC scripts and results
Large simulation datasets, trained model workspaces, and generated MATLAB result files are intentionally excluded from Git.
- MATLAB R2023b or a compatible release
- System Identification Toolbox
- Statistics and Machine Learning Toolbox
- Optimization Toolbox
- Parallel Computing Toolbox (for
parfortraining and simulation loops) - CasADi for MATLAB with IPOPT for the KMPC scripts
The MATLAB release shown above matches the supplied SLURM scripts. Other recent releases may work but have not been documented here.
Run MATLAB from the repository root and add the project functions to the path:
addpath(genpath("functions"));The main stages are:
- Generate input signals with
scripts/offroad_Inputsignals.mlx. - Generate terrain-specific trajectories with the scripts in
scripts/simulation/orscripts/simulation_elev/. - Assemble the trajectories into training, validation, and test sets with
scripts/data_handler/gather_plot_data.m. - Train Koopman models with
scripts/koopman_training/Offroad_Koopman_Training_main.m. The example SLURM array scripts inscripts/koopman_training/results/pass the dataset path and the hyperparameters listed inscripts/koopman_training/params.txt. - Reproduce prediction plots with the scripts under
result_analysis/Clay_prediction/andresult_analysis/Sandyloam_prediction/. - Run constrained trajectory-tracking examples from
result_analysis/koopman_MPC/after changing the CasADi and model paths for your machine.
Several scripts contain experiment-specific relative paths and are intended as research artifacts rather than a packaged MATLAB application. Update dataset, output, and CasADi paths before running them.
The full datasets and trained MATLAB workspaces are too large for standard Git hosting. The code expects terrain datasets under datasets/ and model files under:
scripts/koopman_training/results/clay_noelev_models/models_with_error/
scripts/koopman_training/results/sandyloam_noelev_models/models_with_error/
Contact the authors if you need access to the exact data or trained models used in the paper.
If this repository is useful in your research, please cite:
@article{loya2026koopman,
title = {Koopman Operator Framework for Modeling and Control of Off-Road Vehicle on Deformable Terrain},
author = {Loya, Kartik and Tallapragada, Phanindra},
journal = {arXiv preprint arXiv:2603.28965},
year = {2026},
doi = {10.48550/arXiv.2603.28965}
}K. Loya and P. Tallapragada, “Koopman Operator Framework for Modeling and Control of Off-Road Vehicle on Deformable Terrain,” arXiv:2603.28965, 2026. Paper · PDF





