This repository contains code for the paper "Towards safe and tractable Gaussian process-based MPC: Efficient sampling within a sequential quadratic programming framework", accepted for publication at the 63rd IEEE Conference on Decision and Control (CDC 2024).
The code is licensed under the MIT license.
workspace
folder. This is used as a base directory for the following steps. git clone https://github.com/manish-pra/sampling-gpmpc.git
git clone https://github.com/manish-pra/safe-exploration-koller.git
git clone https://github.com/befelix/plotting_utilities.git
workspace
). cd sampling-gpmpc
pip install -r requirements.txt
To run the code, run the following Python script from your base directory:
python sampling-gpmpc/main.py -i $i -param $param_file
where,
$param_file: Name of the param file, either "params_pendulum" or "params_car"
$i : Experiment number, e.g. "1"
For visualizations/videos use the following script once the experiment is completed:
python sampling-gpmpc/visu_main.py -i $i -param $param_file
This will generate a video of the simulation in the folder corresponding to the $param_file
and the instance $i
.
To simulate different reachable set approximations, run the following scripts (here we choose $i=1
):
Set experiment index and params file:
param_file=params_pendulum
i=1
Generate control input sequence and sampling-based predictions (data.pkl
) by running main script:
python sampling-gpmpc/main.py -i $i -param $param_file
Generate linearization-based predictions (cautious_ellipse_data.pkl
, cautious_ellipse_center_data.pkl
), robust tube-based predictions (koller_ellipse_data.pkl
, koller_ellipse_center_data.pkl
) and true reachable set (X_traj_list_0.pkl
, ..., X_traj_list_<num_files>.pkl
):
python sampling-gpmpc/benchmarking/linearization_based_predictions.py -i $i -param $param_file
python sampling-gpmpc/benchmarking/robust_tube_based_GPMPC_koller.py -i $i -param $param_file
python sampling-gpmpc/benchmarking/simulate_true_reachable_set.py -i $i -param $param_file
Important script parameters:
simulate_true_reachable_set.py
:
num_samples
in params_pendulum.yaml
num_repeat
in script fileRun plotting script:
python sampling-gpmpc/extra/cdc_plt.py -i $i -param $param_file
The final result should look similar to this:
param_file=params_car
i=1
python sampling-gpmpc/main.py -i $i -param $param_file
python sampling-gpmpc/visu_main.py -i $i -param $param_file
The final result should look similar to this:
If you use results from the paper or the code, please cite the following paper: