This project comprises of a server that facilitates the remote control of a drone using Dronekit (MAVLink) commands over a network. It provides an interface to communicate with the drone via HTTP.
-
server.py: This is the main server file. It sets up a Flask server, which listens to HTTP POST requests at the/send-dataendpoint. The data sent in these requests is expected to be in a specific format that can be translated to a MAVLink command. -
drone_control.py: This file defines aDroneControlclass, which is used to interface with the drone itself. TheDroneControlobject maintains a queue of commands to be executed and processes them one by one. It can connect to the drone, execute commands on the drone, and handle the drone's response.
-
Ensure your phone's hotspot is enabled.
-
Start or reboot the Raspberry Pi.
-
SSH into your Pi with
ssh pi@raspberrypi.local. -
Use
hostname -Ito retrieve the IP address of the Pi. -
Run the server using
python server.py. -
Use the companion app, connect to the server using the IP from step 4, and start sending commands. It's recommended to use testing mode first, which can be enabled in the config file (
config.yaml).
-
Start the Raspberry Pi with a monitor, keyboard, and mouse connected.
-
Enable your phone's hotspot and connect to it on the Pi's monitor.
-
Edit the
wpa_supplicant.conffile (this is the configuration file for the Wi-Fi) located at/etc/wpa_supplicant/wpa_supplicant.conf. Addpriority=1to the configuration block for your hotspot. This will make the Pi connect to your hotspot by default upon startup.
network={
ssid="Your_Hotspot_Name"
psk="Your_Hotspot_Password"
priority=1
}-
Change the mDNS (Multicast DNS) hostname of your Raspberry Pi to
raspberrypi.local. You can do this by editing thehostnamefile (sudo nano /etc/hostname) andhostsfile (sudo nano /etc/hosts), replacing the existing name withraspberrypi.local. -
Connect your serial cable from the Raspberry Pi to the Pixhawk. A detailed tutorial on this will be provided in the future.
-
Continue to the usage instructions above.
If the record_video configuration is set to True in config.yaml, the server will start recording a video from the Pi Camera as soon as the drone is connected. The recording will be saved as output.h264. This feature requires a Pi Camera module to be connected to the Raspberry Pi.