Quadcopter flight control software
- Raspberry Pi 3 B+, running Raspian Stretch Lite, housed in a Pibow 3 Coupé
- MPU-9250 Accelerometer/Gyroscope/Compass
- HC-SR04 Ultrasonic Sensor
- Turnigy 2200mAh 3S 20C Battery
- OCDAY 3A Power Distribution Board
- LDPower D-250 ESC/Motor set
- A quadcopter-shaped cutout of polycarbonate with standoffs and velcro.
- USB Wireless Adapter for connecting to the Pi over its own wifi network
- 8BitDo SN30 Pro
From a fresh install of Raspian Stretch Lite:
Connect it to the local network with a cable (the wireless card will be used to manage it's own network)
- note the IP
- set a root password
- run the following
raspi-config
- Under
Localisation Options
, set the proper keyboard layout. - Under
Advanced
, expand the filesystem if it didn't automatically do this at first boot. - Under
Interfacing Options
, enableSSH
andI2C
.
- Under
sed -i -E "s/^#?(PermitRootLogin)/\1 yes/" /etc/ssh/sshd_config
to change 'PermitRootLogin' for a moment. Ansible will later change thatyes
toprohibit-password
.systemctl restart ssh
For /etc/hosts
:
192.168.1.XXX currant
Create and sync an SSH key (the keys I generated from macOS with OpenSSH didn't play with paramiko nicely, I had to generate the keys on the Pi and move them locally):
ssh-keygen -t ecdsa -f ~/.ssh/currant_ecdsa -b 521 -N ''
ssh-copy-id -i ~/.ssh/currant_ecdsa root@currant
For ~/.ssh/config
:
Host currant
User root
IdentityFile ~/.ssh/currant_ecdsa
Assuming git
, pipenv
, and ansible
are installed locally; clone this repo.
The ansible playbooks will configure the rest of the vehicle; cd
into ./ansible/
and run them
ansible-playbook python3.yml
installs the python version set in that file (takes like half an hour)ansible-playbook setup.yml
configures the wireless network, interfaces, house-cleaning, etc
(these are the instructions I used to originally configure the wireless setup)
The USB wireless card can now be used to connect to the vehicle's wireless network.
By default, the network is currant
, as is the username. Password is currantpw
.
Once connected via wifi, change the line in your /etc/hosts/
to:
172.24.1.1 currant
I open three terminal instances with itermocil --here
:
- One for git/local work (pictured left)
- One for running
ssh currant
, and once inside the vehicle, runningpreflight
and then./fly.py
. (top right) - One for running
pipenv shell ./tower.py
, which will watch and sync./currant/*
to/opt/currant
on the vehicle. (bottom right)
preflight
is ./ansible/files/preflight
Use ./fly.py --setup-bt
to set up a bluetooth controller.