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
36 changes: 18 additions & 18 deletions data/data.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"imu": {
"yaw": 0.0,
"pitch": 0.0,
"roll": 0.0,
"yr": 0.0,
"pr": 0.0,
"rr": 0.0,
"ax": 0.0,
"ay": 0.0,
"az": 0.0
"yaw": 35.51,
"pitch": 4.75,
"roll": -179.7,
"yr": 0.05,
"pr": 0.01,
"rr": 0.12,
"ax": 0.002,
"ay": 0.001,
"az": -0.001
},
"9dof": {
"acceleration": {
Expand Down Expand Up @@ -74,14 +74,14 @@
"dptSet": 0.0
},
"resources": {
"sequence": 0,
"uptime_ms": 0,
"cpu_percent": 0,
"heap_used_percent": 0,
"heap_free_kb": 0,
"heap_total_kb": 0,
"thread_count": 0,
"udp_rx_count": 0,
"sequence": 137,
"uptime_ms": 139172,
"cpu_percent": 4,
"heap_used_percent": 2,
"heap_free_kb": 502,
"heap_total_kb": 512,
"thread_count": 20,
"udp_rx_count": 2695,
"udp_rx_errors": 0
},
"control_telemetry": {
Expand Down Expand Up @@ -123,4 +123,4 @@
"Buttons": {
"button_surface": 0
}
}
}
13 changes: 10 additions & 3 deletions tools/send_control_telemetry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import binascii
import socket
import struct
import sys
from pathlib import Path

PROJECT_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(PROJECT_ROOT))

from lib.crc import crc32_ieee

AXES = ["surge", "sway", "heave", "roll", "pitch", "yaw"]
PORT = 5005
Expand All @@ -17,11 +23,12 @@ def build_packet() -> bytes:
body += struct.pack("<6f", *setpoints)
body += struct.pack("<6f", *outputs)
body += struct.pack("<6f", *errors)
body += struct.pack("<fH", 0.0, 1500)

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

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

Expand Down
Loading