Clone the repository:
git clone https://github.com/Zengyi-Qin/adacbf.gitInstall PyTorch>=1.9. GPU is not required, but recommended for training the ship controller. Then install other dependencies:
pip install numpy matplotlib tqdmDownload 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 1Testing in a random environment:
python scripts/test_ship.py --vis 1 --env shipTesting in a river:
python scripts/test_ship.py --vis 1 --env riverSince we assume that the system is a black box, we need to first learn the system dynamics from sampled data:
python scripts/sysid_drone.pyThen we train the control barrier function and controller:
python scripts/train_drone.pyFirst learn the dynamics from sampled data:
python scripts/sysid_ship.pyThen train the control barrier function and controller:
python scripts/train_ship.pyWe use random environments in training. The trained controller can be tested in different environments.