# SkyLok

Pi Zero W 2 captures frames, runs a motion shader, sends diffs over LoRa.

- `camera_example/`    — libcamera + libjpeg-turbo, streams MJPEG over TCP. Works.
- `shader_example/`    — offscreen GL motion diff between two frames. Works on desktop.
- `math_example/`      — pixel → 3D vertex projection (depth map to OBJ mesh).
- `chip_test_example/` — LR1121 LoRa + ICM-20948 IMU + u-blox GPS drivers/tests.
- `main.cpp`           — prototype that wires camera + shader + TCP together.

## Goal

Automatic, real-time detection of fast high-flying objects (planes, drones) using
multiple Pi cameras and a GLES motion shader. Objects moving in straight lines or
smooth curves are kept; everything else is filtered out.

Each node scans the sky, detects motion, extracts a vertex line from the diff frame,
timestamps it via GPS, and transmits the minimal payload over LoRa.
The central device is also a Pi camera node running the same base pipeline, with
additional functionality for receiving LoRa packets from other nodes, fusing
sightlines, and saving combined results locally.

## Status

The examples are all individually working. Final integration (camera → shader → math →
LoRa) is the next step.

## Build main.cpp

```sh
g++ main.cpp -o main \
  $(pkg-config --cflags --libs libcamera libevent) \
  -levent -levent_pthreads -lpthread \
  -lturbojpeg -lglfw -lGLEW -lGL -lEGL -lGLESv2
```

## References

- https://www.youtube.com/watch?v=zFiubdrJqqI
- https://github.com/ConsistentlyInconsistentYT/Pixeltovoxelprojector/
