UAV

All things that go into a UAV: Cameras, Software, Telemetry etc

documentation is available at UAV docs

Guide to developing with UAV

Install

  1. Python 3.10 venv for Ubuntu 21.04, Ubuntu 20.04 LTS https://www.python.org/downloads/
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.10

Note For Ubuntu 18.04 Deadsnakes/ppa is not hold distribution for Ubuntu 18.04 LTS, so you need to install it manually. Download Python 3.10.0 from https://github.com/conda-forge/miniforge

There are 2 or 3 options for Linux architectures:

Give the script execution permission and run it to install into ~/miniforge3

chmod +x Miniforge3-Linux-x86_64.sh
./Miniforge3-Linux-x86_64.sh

Follow the prompts to install

  1. Download UAV from github and create a virtual environment
mkdir repos
cd repos
git clone https://github.com/johnnewto/UAV.git
cd UAV
~/miniforge3/bin/python -m venv 'venv'
source ./venv/bin/activate
pip install --upgrade pip
pip install -e .
  1. Install gstreamer
sudo apt-get install libcairo2 libcairo2-dev libgirepository1.0-dev
sudo apt install libgirepository1.0-dev
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
  1. Install gstreamer-python
pip install git+https://github.com/johnnewto/gstreamer-python.git

Airsim ( optional for dev )

AirSim is a simulator for drones, cars and more, built on Unreal Engine (we now also have an experimental Unity release). It is open-source, cross platform, and supports software-in-the-loop simulation with popular flight controllers such as PX4 & ArduPilot and hardware-in-loop with PX4 for physically and visually realistic simulations. It is developed as an Unreal plugin that can simply be dropped into any Unreal environment. Similarly, we have an experimental release for a Unity plugin.

Their goal was to develop AirSim as a platform for AI research to experiment with deep learning, computer vision and reinforcement learning algorithms for autonomous vehicles. For this purpose, AirSim also exposes APIs to retrieve data and control vehicles in a platform independent way. AirSim Drone Demo Video

Install Airsim

For the binary releases of Airsim see https://github.com/microsoft/AirSim/releases/tag/v1.8.1 We recommend the linux version as this repo is developed on linux.

Developing with nbdev - Initial setup

if you want to develop with nbdev, you’ll need to install it first. For a step-by-step guide to using nbdev guide to using nbdev You’ll need the following software to develope using nbdev:

  1. Python venv
  2. A Python package manager: ie pip
  3. Jupyter Notebook
pip install jupyter
  1. nbdev
pip install nbdev
  1. Quarto
nbdev_install_quarto
  1. Install Quarto JupyterLab extension
pip install jupyterlab-quarto
  1. Install nbdev pre-commit hooks to catch and fix uncleaned and unexported notebooks
pip install pre-commit

see nbdev Pre-Commit Hooks for more details

Install msgpack-rpc-python with tornado 4.5.3

To run airsim in or beside jupyter notebook you need msgpack-rpc-python to have an old version of tornado. The latest version of msgpack-rpc-python is 0.4.1, which requires tornado 4.5.3. The latest version of tornado is 6.1, which is not compatible with msgpack-rpc-python.

The repo https://github.com/xaedes/msgpack-rpc-python/tree/with_tornado_453 is a fork of msgpack-rpc-python which includes tornado 4.5.3 directly in the repo.

Install msgpack-rpc-python with integrated tornado, pip install from this repo https://github.com/johnnewto/msgpack-rpc-python/tree/with_tornado_453

pip uninstall msgpack-rpc-python
pip install git+https://github.com/johnnewto/msgpack-rpc-python.git@with_tornado_453

Preview Docs

Start the preview by entering this into your terminal:

nbdev_preview

Prepare your changes

Before commiting your changes to GitHub we recommend running nbdev_prepare in the terminal,

which bundles the following commands:

  • nbdev_export: Builds the .py modules from Jupyter notebooks
  • nbdev_test: Tests your notebooks
  • nbdev_clean: Cleans your notebooks to get rid of extreanous output for git
  • nbdev_readme: Updates your repo’s README.md file from your index notebook.

Update Static site docs

Generate the static docs by entering nbdev_docs into your terminal:

Push to GitHub

You can now commit and push your changes to GitHub. As we mentioned before, always remember to run nbdev_prepare before you commit to ensure your modules are exported and your tests pass. You can use git status to check which files have been generated or changed. Then:

git add .
git commit -m 'Add `say_hello`; update index' # Update this text with your own message
git push

This will kick-off your GitHub Actions. Wait a minute or two for those to complete, then check your updated repo and documentation.

Other

Set up autoreload

Since you’ll be often updating your modules from one notebook, and using them in another, it’s helpful if your notebook automatically reads in the new modules as soon as the Python file changes. To make this happen, just add these lines to the top of your notebook:

%load_ext autoreload
%autoreload 2