Author: Zengjie Zhang ([email protected]), Maico H.W. Engelaar ([email protected])
A Python library used to perform Model Predictive Control (MPC) for a stochastic linear system with runtime Signal Temporal Logic specifications.
This library is used to facilitate the capability of robotic systems to execute dynamically assigned tasks with strict risk limitations.
This library considers an essential case handling scenario as follows, where a robot is required to:
- Start from
HOME
; - Reach a
TARGET
on request; - Reach the
CHARGER
on request; - Visit
HOME
sufficiently often on request; - Stay inside the workspace.
On request
means that the corresponding tasks are dynamically assigned without prior notice. The robot is required to accomplish these dynamically assigned tasks with a strict safety guarantee in a probabilistic sense.
This library is associated with the Arxiv article in https://arxiv.org/abs/2402.03165 which is to be presented in the 8th IFAC Conference on Analysis and Design of Hybrid Systems, July 1-3, 2024.
The probstlpy
library in this project is modified from the stlpy toolbox.
Operating system
- Windows (compatible in general, succeed on 11)
- Linux (compatible in general, succeed on 20.04)
- MacOS (compatible in general, succeed on 13.4.1)
Python Environment
- Python version: test passed on
python=3.11
- Recommended: IDE (VS code or Pycharm) and Conda
- Required Packages:
numpy
,treelib
,matplotlib
,scipy
.
Required Libraries
gurobipy
solver (license required, see How to Get a Gurobi License)Python control
toolbox (see Documentation)
-
Install conda following this instruction;
-
Open the conda shell, and create an independent project environment;
conda create --name ram-ruts python=3.11
- In the same shell, activate the created environment
conda activate ram-ruts
- In the same shell, within the
ram-ruts
environment, install the dependencies one by one
conda install -c anaconda numpy
conda install -c conda-forge treelib
conda install -c conda-forge matplotlib
conda install -c anaconda scipy
- In the same shell, within the
ram-ruts
environment, install the libraries
python -m pip install gurobipy
pip install control
- Last but not least, activate the
gurobi
license (See How To). Note that this project is compatible withgurobi
Released version11.0.1
. Keep yourgurobi
updated in case of incompatibility.
- Run the main script
main.py
; - Watch the terminal for runtime information;
- The figures will show up at the end of running; They are also automatically saved in the root directory;
- The figures may impede each other; Drag the figures for a better view;
- Check out the logging file
INFO.log
for the runtime information.
Feel free to try out the code with different parameter settings in the commons/configs.py
file.
- Change the coordinates of the regions in the
RG
dictionary to construct a different map; - Change the color map in the
CM
dictionary for preferred layout; - Change the standard deviation variable
Sigma
for different noise levels; - Change the initial position of the robot in
x0
; - Customize the lists of runtime specifications
specs
and their instants intimes
for various tasks.
This project is with a BSD-3 license, refer to LICENSE
for details.