Clone the repository:
git clone https://github.com/Zengyi-Qin/adacbf.git
Install PyTorch>=1.9. GPU is not required, but recommended for training the ship controller. Then install other dependencies:
pip install numpy matplotlib tqdm
Download data.zip
from this link and unzip in the main folder. It contains the estimated dynamics of the models and the neural network weights for the controllers and control barrier functions.
python scripts/test_drone.py --vis 1
Testing in a random environment:
python scripts/test_ship.py --vis 1 --env ship
Testing in a river:
python scripts/test_ship.py --vis 1 --env river
Since we assume that the system is a black box, we need to first learn the system dynamics from sampled data:
python scripts/sysid_drone.py
Then we train the control barrier function and controller:
python scripts/train_drone.py
First learn the dynamics from sampled data:
python scripts/sysid_ship.py
Then train the control barrier function and controller:
python scripts/train_ship.py
We use random environments in training. The trained controller can be tested in different environments.