Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,22 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
python-version-file: .python-version

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
run: uv sync --frozen --no-default-groups --group build

- name: Build with PyInstaller
run: pyinstaller --onefile --name Topside --add-data "static${{ matrix.data_sep }}static" app.py
run: uv run --frozen --no-default-groups --group build pyinstaller --onefile --name Topside --add-data "static${{ matrix.data_sep }}static" app.py

- name: Stage release contents
shell: bash
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,4 @@ fabric.properties
.idea/caches/build_file_checksums.ser

# Other files to ignore
.python-version
pyproject.toml
uv.lock
.DS_Store
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
> **Just want to run it?** See [docs/SETUP.md](docs/SETUP.md) for the installer and network setup instructions.

**Install dependencies to run (not tested)**
**Run from source**
```bash
pip install -r requirements.txt
uv sync --frozen
uv run python app.py
```

**Run tests**
```bash
uv run --frozen --group dev pytest
```

How to use git:
Expand Down Expand Up @@ -64,4 +70,3 @@ If you want to checkout another branch whith uncommited changes
git stash
```
NB: This will discard your local changes

28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[project]
name = "topside"
version = "0.1.0"
description = "Topside dashboard for telemetry, controls, and camera streams."
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"flask>=3.0.3,<4",
"numpy>=2.1.3,<3",
"opencv-contrib-python>=4.12.0.88,<5",
"pygame>=2.5,<3",
"requests>=2.33.0,<3",
]

[dependency-groups]
dev = [
"pytest>=9.0.2,<10",
]
build = [
"pyinstaller>=6.11,<7",
]

[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["."]

[tool.uv]
package = false
20 changes: 0 additions & 20 deletions requirements.txt

This file was deleted.

32 changes: 0 additions & 32 deletions tests/test_control_telemetry.py

This file was deleted.

40 changes: 40 additions & 0 deletions tools/send_control_telemetry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import binascii
import socket
import struct

AXES = ["surge", "sway", "heave", "roll", "pitch", "yaw"]
PORT = 5005


def build_packet() -> bytes:
"""Build a packet matching the firmware control telemetry format."""
sequence = 1
setpoints = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
outputs = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
errors = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

body = struct.pack(">I", sequence)
body += struct.pack("<6f", *setpoints)
body += struct.pack("<6f", *outputs)
body += struct.pack("<6f", *errors)

crc = binascii.crc32(body) & 0xFFFFFFFF
packet = body + struct.pack(">I", crc)

print(f"Packet size: {len(packet)} bytes (expected 80)")
print(f"CRC: 0x{crc:08X}")
return packet


def main() -> None:
packet = build_packet()
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
sock.sendto(packet, ("127.0.0.1", PORT))
print(f"Sent to 127.0.0.1:{PORT}")
finally:
sock.close()


if __name__ == "__main__":
main()
Loading