Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

rkm/bluebird

 
 

Repository files navigation

Build Status Python Version License Code Style pre-commit

BlueBird

BlueBird provides a common Flask-based API to multiple air traffic simulators. In addition to basic communication, it also includes features such as state caching, performance metrics (via Aviary), and logging of scenario data. The main purpose of BlueBird is to provide a common interface to ease the research & development of AI for air traffic control.

The currently supported open-source simulator is BlueSky.

Usage

Running locally

To run locally, first start a supported simulation server, then:

$ ./install.sh [--dev] [<venv_name>]
$ source <venv_name>/bin/activate
(venv) > python ./run.py [--sim-host=<address>] [--sim-mode=<mode>] [--reset-sim] [--log-rate=<rate>]

Notes:

  • the --dev option will also install dependencies needed for developing BlueBird
  • If you need to connect to BlueSky on another host (i.e. on a VM), you may pass the --sim-host option to run.py.
  • If passed, --reset-sim will reset the simulation on connection
  • If passed, --sim-mode will start the simulation in a specific mode.

Running with Docker

BlueBird can also be run through Docker. Easiest way is to run with docker-compose:

$ docker-compose up -d

This will also pull and start a BlueSky simulator container.

You can also use the pre-built turinginst/bluebird image, or build it yourself. This uses localhost for the BlueSky host. This can be overridden with environment variable:

$ docker run --rm -e BS_HOST="1.2.3.4" turinginst/bluebird:latest

API Endpoints

See here.

Logging

By default, BlueBird creates two log files:

  • logs/<timestamp>-<instance_id>/debug.log Contains general application logging and Flask request info. One file per instance of BlueBird. The instance_id is a unique identifier based on the ID of the host machine and the current time.
  • logs/<timestamp>-<instance_id>/<timestamp>-<episode_id>.log Contains a log of aircraft and simulation data. A new file is created for each scenario that is loaded, and the file is closed if the simulation is reset. The episode_id is a random unique identifier.
    • Entries prefixed with 'A' contain info on the aircraft in the simulation
    • Entries prefixed with 'E' contain info on episode events (start/end, file loaded)
    • Entries prefixed with 'C' contain info on commands sent to the simulator

The episode file is only recorded for Agent mode.

The timestamps of the logs/* directories are the start times of the BlueBird app, whereas the timestamps in the episode file names are the start of each episode.

Development

Installation

To install development packages, pass the --dev option to the install script. Or if you have already created a virtual environment:

$ pip install -r requirements-dev.txt
$ pre-commit install

Testing

The unit test suite can be run with:

$ pytest [<optional-arguments>] tests

You can also pass paths to individual modules or tests:

$ pytest [<optional-arguments>] <test-file>::<test-name>

Integration tests can run with each supported simulator, however they will only be run in a CI environment unless forced with the --run-integration flag.

Integration tests require Docker to run. To specify a different docker daemon host than localhost, you can pass --docker-host=<host address>:<port>. This can be useful when testing if you don't have Docker locally installed, or if the images required for testing are only available on a remote host.

The default integration simulator is BlueSky. To test against a different simulator, specify it with the --integration-sim=<sim name> option.

Code Quality

BlueBird uses pre-commit to help ensure code quality and correctness. Once installed, this automatically runs as part of the git commit process.


About

Server to communicate with NATS air traffic simulator and Bluesky

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 96.8%
  • Shell 2.8%
  • Dockerfile 0.4%