refactor(firmware): centralize configuration and diagnostics

This commit is contained in:
Onur Özkan committed 2026-08-22 18:37:18 +03:00
1 parent 7048ed89d0
commit 387fdaad23
140 files changed
+6891 -4541

No files matched your search

+9 -9
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Small operator client for the local Kaptan host-SITL process."""
"""Small user client for the local Kaptan host-SITL process."""
from __future__ import annotations
@@ -14,11 +14,11 @@ import time
CONTROL = ("127.0.0.1", 14662)
TRUTH = ("127.0.0.1", 14663)
# The simulator lease identifies its one local operator by UDP source address.
# The simulator lease identifies its one local user by UDP source address.
# Keep this source stable across separate CLI invocations so a completed move
# can be followed by the next command without a second, competing operator.
OPERATOR_CONTROL = ("127.0.0.1", 14665)
OPERATOR_CLOCK = ("127.0.0.1", 14664)
# can be followed by the next command without a second, competing user.
USER_CONTROL = ("127.0.0.1", 14665)
USER_CLOCK = ("127.0.0.1", 14664)
VERSION = 1
STATUS_QUERY = struct.Struct("<4sB3x")
STATUS = struct.Struct("<4sB3xQH2x")
@@ -109,7 +109,7 @@ def recv(socket_: socket.socket, deadline: float) -> bytes | None:
def latest_simulation_time(
clock_socket: socket.socket, previous: int | None
) -> int | None:
"""Drains Gazebo's test-operator clock without trusting host elapsed time."""
"""Drains Gazebo's test-user clock without trusting host elapsed time."""
latest = previous
while True:
try:
@@ -514,13 +514,13 @@ def main() -> int:
if tolerances:
raise ValueError("truth tolerances and hold duration must be finite and positive")
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as client:
client.bind(OPERATOR_CONTROL)
client.bind(USER_CONTROL)
if values.command == "ready":
wait_ready(client, values.timeout)
print("ready")
elif values.command == "move":
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as clock:
clock.bind(OPERATOR_CLOCK)
clock.bind(USER_CLOCK)
clock.setblocking(False)
move(
client,
@@ -538,7 +538,7 @@ def main() -> int:
)
else:
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as clock:
clock.bind(OPERATOR_CLOCK)
clock.bind(USER_CLOCK)
clock.setblocking(False)
land(
client,