This repository contains the implementation of the paper "Scalable Multi-modal Model Predictive Control via Duality-based Interaction Predictions" accepted at 2024 IEEE Intelligent Vehicles Symposium
Hansung Kim ([email protected]) Siddharth Nair ([email protected]) Francesco Borrelli
>12x Improvement in computation time of the motion planner!
git clone https://github.com/MPC-Berkeley/hmpc_raidnet.git
cd hmpc_raidnet
conda env create -n raidnet -f environment.yml
conda activate raidnet
pip install -e .
Running the simulator requires Gurobi and IPOPT. For installing Gurobi, find the link here. For installing IPOPT (keep in mind that it comes pre-installed with Casadi),
wget -N -q "https://github.com/thomasfork/ipopt_linux/raw/main/ipopt-linux64.zip"
unzip -o -q ipopt-linux64
We provide a shell script 'grbpath.sh' which you can run in your terminal to export appropriate GUROBI related envrionment variables. Modify 'grbpath.sh' file to the paths in your machine.
source grbpath.sh
The default configuration file is data/configs/params_N14.yaml. Change the root directory in the configuration files to appropriate paths in your local machine manually.
python scripts/data_collect.py -config_dir <path_to_parameter_config_yaml>
python scripts/data_collect.py -config_dir ./data/configs/params_N14.yaml
Alternatively, you can download a training dataset using the default simulation environment parameters and data collection configurations (data/configs/params_N14.yaml). Modify the configuration file to change the parameters as needed.
If you choose to download and use the provided dataset, move the dataset .pkl files as shown below
├── assets
│ ├── ...
├── data
│ ├── configs
│ │ ├── ...
│ ├── expert_data
│ │ ├── <move data here>
│ ├── logs
│ │ ├── ...
│ ├── models
│ │ ├── ...
├── infrastructure
│ ├── ...
├── scripts
│ ├── ...
├── ...
Before training, modify the expert_trajectory_data path in ./data/configs/*yaml file that you are using. For training a RAID-Net Policy, run
python scripts/run_bc.py -config_dir <path_to_parameter_config_yaml>
python scripts/run_bc.py -config_dir ./data/configs/params_N14.yaml
For training a Simple MLP Policy for comparison,
python scripts/run_bc_mlp.py -config_dir <path_to_parameter_config_yaml>
python scripts/run_bc_mlp.py -config_dir ./data/configs/params_N14.yaml
(WIP) For running DAgger,
python scripts/run_dagger.py -config_dir <path_to_parameter_config_yaml>
python scripts/run_dagger.py -config_dir ./data/configs/params_N14.yaml
Alternatively, you can download the pre-trained RAID-Net for N=14 and Num TV = 3 in our custom traffic intersection simulation environment here. After downloading the model, move the model files .pt as shown below
├── assets
│ ├── ...
├── data
│ ├── configs
│ │ ├── ...
│ ├── expert_data
│ │ ├── ...
│ ├── logs
│ │ ├── ...
│ ├── models
│ │ ├── <move models here>
├── infrastructure
│ ├── ...
├── scripts
│ ├── ...
├── ...
Evaluation parameters can be modified in the ./data/configs/*.yaml files. Specifically, you must change the root_dir variable in the config files to an appropriate path in your machine. Also, you can set the planner horizon length N, model names, and other training and environmental parameters as needed.
python scripts/closedloop_eval.py -config_dir <path_to_parameter_config_yaml>
python scripts/closedloop_eval.py -config_dir ./data/configs/params_N14.yaml
The evaluation results will be recorded in ./data/models/evaluation/ including mp4 files of the closed-loop simulation results. After running closedloop_eval, the statistics of the evaluation results can be obtained by running
python scripts/eval_stats.py -config_dir <path_to_parameter_config_yaml> -model_dir <path_to_model: optional>
python scripts/eval_stats.py -config_dir ./data/configs/params_N14.yaml -model_dir ./data/models/RAIDNET_BC_Jan_21_09_13_20_CA.pt
Furthermore, the RAID-Net model (as a classifier) itself can be evaluated on a test dataset to obtain the confusion matrix and normalized classification loss of the model by running
python scripts/model_eval.py -config_dir <path_to_parameter_config_yaml> -model_dir <path_to_model: optional>
python scripts/model_eval.py -config_dir ./data/configs/model_eval.yaml -model_dir ./data/models/RAIDNET_BC_Jan_21_09_13_20_CA.pt
If you need to combine two datasets, you can use combine_dataset.py
python scripts/combine_dataset.py -data1_dir <path_to_dataset1> -data2_dir <path_to_dataset2>