We provide two separate Docker containers for the drone and the rover, each designed to install the necessary dependencies and autopilot software.
The Docker containers are designed to mount the environments, drone, and rover directories. This setup allows users to create and modify configuration files or environment settings outside the containers while seamlessly using them inside the containers.
- NVIDIA Container Toolkit: Install Docker and NVIDIA Container Toolkit. Installation instructions are here.
- Environment Binaries: Ensure that the environment binaries are in the
environmentsdirectory. This allows the binaries to be shared across multiple container instances. - Configuration: Place all configuration files, including custom AirSim
settings.jsonfiles, in the appropriate directories -droneorroverdirectories.
To build for each RAV type, use the following scripts:
./build_drone.sh
./build_car.sh
To customize the Docker image, edit DroneDockerfile or RoverDockerfile. Note that the modified autopilot firmware is pulled from the modified_ardupilot and modified_px4 directories within this repository.
To run the drone, use the following script. You can optionally specify the GPU device for running the container.
./run_drone.sh <gpu_device>
./run_rover.sh <gpu_device>
To modify the directories or files that are mounted, update the run_rover.sh or run_drone.sh scripts.
To run the Deep-RL policy set the docker flag, -d, and specify a configuration file.
cd drone
python ppo_drone.py -d -c /path/to/config
Additional steps for rover: Before running the policy, build ArduPilot in the container:
cd ardupilot/
./waf configure --board sitl
./waf build --target bin/ardurover
cd rover
python ppo_rover.py -d -c /path/to/config
Make sure the configuration file includes the correct paths to your environment binaries.
-c/--config path/to/configthe path to your configuration file.-n/--name agent_namethe name of the trained policy.-lr/--load-recoveryto load a trained policy.-la/--load-attackerto load a trained anomaly agent.-v/--verboseprint verbose output to console for debugging.-e/--evaluate num_evaluation_episodesnumber of evaluation episodes.
python ppo_drone.py -d -c configs/NH/nh_gps.yaml
python ppo_rover.py -d -c configs/nh_gps.yaml
The docker console will print the results:
ATTACKS: 100 | RECOVERIES: 94 | COLLISIONS: 0
ATTACKS: number of attacks launchedRECOVERIES: successful recoveriesCOLLISIONS: collisions with obstacle or ground
The videos of the simulation runs with and without SpecGuard are available here https://tinyurl.com/specguard