Running Airside on the Raspberry Pi 5 - Comp 2025
- 1 Hardware Connections
- 2 Ground Testing
- 2.1 Setup repository
- 2.1.1 Clone Repo
- 2.1.2 Setting the right configs in config.yaml
- 2.1.2.1 video_input
- 2.1.2.2 detect_target
- 2.1.2.3 flight_interface
- 2.1.2.4 data_merge
- 2.1.2.5 geolocation
- 2.1.2.6 cluster_estimation
- 2.1.2.7 communications
- 2.2 Run integration tests
- 2.3 Run Airside
- 2.3.1 Bad signs
- 2.3.2 Good signs
- 2.1 Setup repository
- 3 Real Flight Tests:
Hardware Connections
#TODO: Get pictures and better explanations for these. idk how to explain this well
The RPi is connected to the RPi Interface Rev B Comp 2025 Variant End User Manual (I linked the user manual), by sticking all of the pins together. It should be already connected.
The RPi gets powered by the 3S LiPo battery (thin/small one). Plug the battery into the main drone plug, and there’s another one that goes from the main plug to the RPi Interface.
Connect the UART cable from the RPi Interface onto the TELEM2 or TELEM3 port (depending on what’s setup for that specific drone/Pixhawk). On Houston, it is TELEM2.
Connect the killswitch line from the RPi Interface to the Pixhawk’s side GPIO pins (This is the 3 pin connector - J10). There are 8 GPIO ports on the Pixhawk, so it depends on which drone and how those are setup. On Houston, plug it into 8.
Ground Testing
Setup repository
We will clone the Airside System Repository onto the RPi.
These steps will clone the latest main branch of the remote’s Ariside repository and the latest main branch of the remote’s common repository. Advanced tuning is at your own discretionary
Clone Repo
You should know how to clone the repo, see Airside System Repository or Autonomy Workflow Software if you’re confused.
cd ~
git clone https://github.com/UWARG/computer-vision-python.git
cd computer-vision-python
pyhton -m venv ./venv
source ./setup_project.sh
source ./venv/bin/activate
Setting the right configs in config.yaml
The rest of this guide assumes you’re in the computer-vision-python
folder and activated the virtual environment unless stated otherwise. Also, this section may be outdated by the time you read this, follow what the lead says rather than these suggestions.
Example config file: #TODO: Upload config file to OneDrive
video_input
You may need to change this section on the fly during the flight test, so make sure you know how to edit files using the linux command line!
Choose which camera you are going to use, and what camera settings. See appendix C of Picamera2 Library documentation and common’s
camera
module to know what configs are available, and what the values should be. A lead should usually tell you ahead of time what settings we want to test during the flight test.
detect_target
Download the latest model from Landing Pad Models to
tests/model_example/
or anywhere you likeChange
model-path
to the new model’s path (relative to the repository’s root).
flight_interface
Change
address
to/dev/ttyAMA0
for the serial port (this is how RPi is connected to Pixhawk)baud_rate
should be57600
Increase
timeout
if you see a lot ofworker died ...
messages in the logs during ground tests (60.0 or 120.0 is usually more than enough)
data_merge
Increase
timeout
if you see a lot ofworker died ...
messages in the logs during ground tests (60.0 or 120.0 is usually more than enough)
geolocation
Make sure
resolution_x
andresolution_y
are the same aswidth
andheight
from video_inputSet
fov_x
andfov_y
according to the installed camera’s field of view in degreesSet
camera_position_[x,y,z]
to the camera’s distance from GPS on the drone (in meters). This is in NED, so positivex
is drone’s front, positivey
is drone’s right, positivez
is drone’s bottom.Set
camera_orientation_[yaw,pitch,roll]
to the camera’s yaw, pitch, roll relative to the upright drone, in degrees. If it’s pointing straight down, then it should beyaw = 0, pitch = -1.57079632679 (-pi/2), roll = 0
.
cluster_estimation
Currently,
min_activation_threshold
must be greater than or equal to 10. For now, set it to 10Set
min_new_points_to_run
to 2 or 3, as long as it doesn’t make the RPi too slow.
communications
Increase
timeout
if you see a lot ofworker died ...
messages in the logs during ground tests (60.0 or 120.0 is usually more than enough)
Run integration tests
Assuming you’ve already tested this on your laptop using the Mission Planner simulator like a good developer, these steps should all go smoothly.
First, run common’s connection_test.py
to make sure you’ve set up the hardware properly (modify the CONNECTION_ADDRESS
to /dev/ttyAMA0
as instructed by the comment).
python -m modules.common.test_connection
The output should be CONNECTED, ...
and not DISCONNECTED, ...
.
Next, run all the integration tests and make sure they pass (i.e. doesn’t throw an error and you see the Done!
printed at the end).
python -m tests.integration.*
Run Airside
Assuming you’ve already tested this on your laptop using the Mission Planner simulator like a good developer, these steps should all go smoothly. Please be patient, as it takes a while to start up and get some data (if you’ve run it on the simulator before, you would know. And the RPi is probably slower than your laptop).
Bad signs
Seeing a lot of
worker died ...
messages in the console andmain.log
.There are a lot of
[ERROR] ...
messages in the worker logs (logs/[worker]_[pid].log
).
Good signs
A new folder for the current time appears in the
logs
folder, and you can see all the pictures the camera took and the pictures with bounding boxes for detections (if you pointed the camera at either landing pad images on your phone or an IR beacon if using IR camera).There is a
logs/[worker]_[pid].log
file for all the workers, and they do not just have 1 line sayinglogger initialized
. Note that you will need at leastmin_activation_threshold
number of detections before cluster estimation even starts, so it may take a while. You can lower this in the config, but remember it must be larger than 10.
Example: a good geolocation_worker_1234.log
This is an example of what a good log looks like after we detect something in detect target, and geolocation worked properly.
Real Flight Tests:
We want the program to start automatically as soon as the drone is powered on, so we do it by using rc.local
.
Setting camera focus
CV Camera (OpenCV option)
Google webcam tester, and make sure you can find the camera.
Set the focus by turning screwing the lens in/out, and focus on something really far away (just hold the drone and point it far)
PiCamera (Picam2 option)
If on auto-focus, then no need to do anything
If on manual focus, set the config to place focus at 25m. (
lens_position
is in units of1/m
!)
Setup hotspot
A hotspot is needed for SSH, which you need to code the RPi, see logs, and debug.
Switch on the pi, connect it to a monitor, and connect a mouse and keyboard. See Raspberry Pi 5 for help.
Switch on your phone hotspot and connect to it on the RPi
Note the IP address notification that pops up at the top right (just in case you need it later). Sometimes you can see it on your phone, but other times, you cannot.
In the network settings of the RPi (top right), set your hotspot Wifi to Priority 1 (or just any big number, make sure it’s high enough to prioritize over the other networks) to auto-connect it to your hotspot on bootup.
Connect to your hotspot on the warg laptop (or your laptop, whichever one you plan on using during flight tests)
SSH
In the powershell of the laptop, connect to the RPi:
ssh warg@raspberrypi.local
.If it doesn’t work, then you can use the IP address that you noted down earlier instead of
raspberrypi.local
.
Setting up rc.local
Edit rc.local
using
Paste or type the following lines in (after you have already setup the airside repo in the above steps from the Ground Testing section):
Ensure that rc.local
is enabled
You should see that it says “enabled” or “active” in green, you may have to scroll down or right using the arrow keys. If it is still currently running, it may say active or running somewhere. You can check the status (if it’s enabled, stopped, running, or disabled) using the following:
Stopping the script, which was started by rc.local
This should stop the program, but still leave the rc-local.service
enabled. You can check again to make sure if you want. So, the next time you power on the drone, it will automatically start the program again.