This repository contains the source code for the Direction Finding Module in our Wi-Fi Drone System. Our paper is under review in accepted by Mobicom 2026.
.
βββ data/ # Beam pattern datasets (different cases)
β βββ case5-3d/ # Example case with 3D antenna layout
β β βββ sheet.tsv # Reference beam pattern RSSI data
β β βββ test.tsv # Test RSSI measurements
β β βββ layout.yaml # Antenna array layout configuration
βββ module/ # Core algorithm modules
β βββ basic_classes.py # Basic data structures
β βββ data_processing.py # Data processing for direction finding
β βββ evaluation.py # Performance evaluation
β βββ plot.py # Visualization utilities
β βββ rssi_update.py # Real-time RSSI updates
βββ tests/ # Pytest test suite
β βββ conftest.py # Test fixtures
β βββ test_case5_3d.tsv # Test measurement data
β βββ test_direction_finding.py # Algorithm tests
βββ rt-scripts/ # Raspberry Pi runtime scripts
β βββ df_start.sh # Start direction finding
β βββ df_stop.sh # Stop direction finding
βββ main.py # Main direction finding script
βββ main_get_rssi.py # Real-time RSSI collection script
βββ quick-start.ipynb # Interactive tutorial notebook
βββ pyproject.toml # Project configuration
βββ requirements.txt # Package dependencies
βββ README.md # This file
If you want to use the direction finding system for your own measurements:
Using uv (recommended, faster):
pip install uv
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e .Using pip:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e .Process pre-collected RSSI data:
python main.py --log INFO --data-dir ./data/case5-3d --pos-elevation --calibrationParameters:
--data-dir: Path to beam pattern case folder (e.g.,./data/case5-3d)--pos-elevation: Enable elevation angle estimation--calibration: Enable RSSI calibration--log: Logging level (DEBUG, INFO, WARNING, ERROR)
Example Output:
2024-09-21 08:20:09 - Reading measured RSSI from ./data/case5-3d/test.tsv
True angle: (180, 30) for test
...
a_BcRxB Score: 0.9999999998/1 (1.00)
direction_finding took: 0.169 sec
For real-time RSSI collection and direction finding:
bash ./rt-scripts/df_start.shThis runs:
python main.py --log DEBUG --data-dir ./data/case5-3d --realtime --calibration --pos-elevation --no-plotExplore the Jupyter notebook for an interactive walkthrough:
jupyter notebook quick-start.ipynbIf you're developing new features or contributing to the project:
Install the package with development tools (pytest, black, flake8):
Using uv:
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"Using pip:
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"The project uses pytest for testing. Tests use the existing beam pattern cases in data/.
Run all tests:
pytest tests/ -vRun specific test class:
pytest tests/test_direction_finding.py::TestLayoutLoading -vRun with coverage:
pytest tests/ --cov=module --cov-report=htmlTest structure:
- Beam pattern data from
data/case5-3d/(layout.yaml, sheet.tsv) - Test measurements stored in
tests/test_case5_3d.tsv - Fixtures in
tests/conftest.pyprovide reusable test components
Format code with black:
black module/ tests/ main.pyCheck code style:
flake8 module/ tests/ main.pyTo add a new test case:
-
Create a new folder:
data/your-case-name/ -
Add required files:
layout.yaml- Antenna configurationsheet.tsv- Reference beam pattern measurementstest.tsv- Test measurements
-
Use it in tests or scripts:
python main.py --data-dir ./data/your-case-name --pos-elevation --calibration
- Website: https://aiot-lab.github.io/Wi2SAR
- Documentation: https://aiot-lab.github.io/Wi2SAR
- Repository: https://github.com/aiot-lab/Wi2SAR
- Organization: https://aiot.hku.hk
If you use this code in your research, please cite our paper (under review):
@inproceedings{wi2sar2026,
title={"Take Me Home, Wi-Fi Drone": A Drone-based Wireless System for Wilderness Search and Rescue},
author={Hou, Weiying and Yu, Luca Jiang-Tao and Wu, Chenshu},
booktitle={ACM MobiCom},
year={2026}
}Apache License 2.0 - See LICENSE for details.