Skip to main content

Raspberry Pi Software Package (RPi-Package)

📌 What is this for? (Quick Summary)​

In Simple Words:
This package contains all the software that runs physically inside the pod on a Raspberry Pi 5.

Its job is to be the bridge between the pod's physical hardware and the cloud:

  1. It listens to the vehicle's internal sensor wires (the CAN bus).
  2. It packages up those sensor readings and sends them to AWS.
  3. It streams the camera video out to our cloud video server.
  4. If you are developing on a laptop without a physical pod, it has an emulator that generates realistic simulated sensor data for you.

1. Directory Structure (What Files Live Where?)​

RPi-Package/
├── go_server/ # The Go program listening on port 20006
│ └── main.go # Decodes CAN bytes and sends to InfluxDB & AWS IoT
├── emulator/ # The Python simulator
│ ├── src/
│ │ ├── run_trajectory.py # Replays a 600m / 60 km/h test run
│ │ └── web_server.py # Simple web UI on port 5001 to start test runs
│ └── telemetry.csv # Real recorded flight numbers (speed, volts, temps)
├── stream_service/ # The camera forwarder
│ └── app.py # Checks cameras & streams video to MediaMTX
├── tests/ # 23 automated tests (run with `pytest tests/`)
├── installer.sh # Sets up a brand new Raspberry Pi from scratch
└── updater.sh # Automatically pulls git updates every minute

2. The 4 Background Services on the Pi​

On Linux, background programs are managed by systemd. We have 4 services that start automatically when the Raspberry Pi boots up:

Service NameWhat It RunsWhat It Does
pod-gateway.servicego_serverListens on port 20006 for sensor packets and uploads them to InfluxDB.
pod-stream.servicestream_service/app.pySends the camera video to cam.tutr.tech:8554.
pod-emulator.servicerun_trajectory.pyGenerates simulated sensor numbers if no real pod is attached.
pod-web.serviceweb_server.pyWeb control page on port 5001 so engineers can trigger test runs.

Helpful Linux Commands:​

# Check if services are running:
sudo systemctl status pod-gateway pod-stream

# Restart the camera stream:
sudo systemctl restart pod-stream

# Read live logs from the camera service:
sudo journalctl -u pod-stream -f

3. How to Set Up a Fresh Raspberry Pi​

If you ever need to set up a replacement Raspberry Pi:

git clone https://github.com/TutrTech/RPi-Package.git ~/RPi-Package
cd ~/RPi-Package
chmod +x installer.sh updater.sh
./installer.sh

The installer compiles the Go server, sets up Python virtual environments, runs the 23-test test suite, and installs the systemd services automatically.