Skip to content

Diagnostic tools: kraken_gaps.py, cube_check.py

Lives on: the follower Pi 5, in ~/capstone/rfdf/. Source in this repo under agentcore/rfdf/. Both are read-only: they watch, they don't change anything.

kraken_gaps.py: find Kraken stalls

python3 ~/capstone/rfdf/kraken_gaps.py 60     # watch for 60 minutes

Watches the Kraken's sample timestamps and prints every gap longer than 1 s, then a summary of how many 436 ms blocks passed between samples:

dt = t - last_t
hist[round(dt / 437)] += 1
if dt > 1000:
    print(f"{time.strftime('%H:%M:%S')}  gap {dt} ms", flush=True)

This is how we found that the Kraken pauses for 2.84 s every ~303 s. A 60-minute run showed 12 identical pauses on a perfect schedule, which pointed to the Kraken's own calibration rather than interference, and the Kraken's config confirmed it (687 + 10 frames × 0.436 s ≈ 304 s).

cube_check.py: is the Cube talking?

~/capstone/rfdf/.venv/bin/python ~/capstone/rfdf/cube_check.py

Listens to the Cube flight controller for 15 s through one of AgentCore's MAVLink pass-through ports, without interfering with AgentCore's own connection, and prints:

  • the Cube's system ID, autopilot type (ArduPilot) and vehicle type
  • armed state and flight mode
  • how fast position messages are arriving (should be 5 Hz)
  • GPS fix and satellite count
  • whether the Cube has GPS time yet

It sends a ground-station heartbeat once a second so AgentCore starts forwarding messages to it:

m = mavutil.mavlink_connection("udpout:127.0.0.1:14601", source_system=255)
...
m.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_GCS, mavutil.mavlink.MAV_AUTOPILOT_INVALID, 0, 0, 0)

Useful as a first check whenever a Cube is plugged in, and for confirming config changes (for example that position really went from 0.5 Hz to 5 Hz).