Debug and Visualize
Retriever debugging should start before a robot backend is involved. Use one source graph and move through four views: render the graph, step it locally, visualize events, then record and replay the same run.
Fast Path
Section titled “Fast Path”Run these in order when a graph feels wrong:
| Stage | Question it answers | Artifact to inspect |
|---|---|---|
| Render | Did I wire the graph I intended? | artifacts/tutorial_perception.html |
| Step | Does Flow logic work in ordinary Python? | stdout step trace |
| Mock perception | Does perception work without camera or GUI risk? | stdout detection events |
| Record | Can I preserve the run as evidence? | logs/perception.rrd, logs/perception.mcap |
| Replay | Can I debug the same events again? | replay stdout and recorded events |
The Debug Loop
Section titled “The Debug Loop”Flow.step(...) without backend scheduling noise.1. Render The Graph First
Section titled “1. Render The Graph First”Typical output:
Open the generated HTML and check these before debugging backend behavior:
- Flow nodes: is every module present?
- Ports: do input and output names match what the code expects?
- Clocks: which Flow wakes itself, and which Flow wakes on upstream events?
- Sync policies: how is upstream history sampled before
step(...)runs? - Feedback edges: where can closed-loop state re-enter the graph?
If this graph is wrong, fix wiring first. Do not start by debugging multiprocessing, Rerun, or camera setup.
Live graph
The perception pipeline, rendered by the runtimeThe same interactive HTML pipe.visualize() writes — pan, zoom, and inspect nodes, ports, clocks, and sync policies inline.
2. Step Locally
Section titled “2. Step Locally”Typical output:
Use local stepping when you want to set breakpoints inside Flow.step(...), inspect local state, or reduce a backend issue to a small deterministic case. The mental model is ordinary Python:
For perception-specific stepping without camera permissions or GUI windows:
Set a breakpoint in Flow.step() (VS Code)
Section titled “Set a breakpoint in Flow.step() (VS Code)”This is the payoff of stepping: pipe.step() runs the whole graph in your
own Python process, so a normal debugger stops inside your Flow with full
locals. No backend process to attach to, no remote debugger.
-
Put a breakpoint in the Flow you want to inspect:
-
Run the stepper script under the debugger — VS Code Run and Debug (F5) on the file that calls
pipe.step(), or attach topixi run demo-stepper. -
Execution stops on that line. In the Variables pane you can read
input._signals(which ports fired),selfstate carried between steps, and every intermediate — then step throughmatch()line by line.
Because the stepper is single-process and synchronous, pipe.step(dt=0.1)
advances one tick and returns; the debugger treats your Flow like any other
function. Get the logic right here first — then run it on multiprocessing or
dora, where each Flow is a separate process and breakpoints are far harder.
3. Visualize Perception Safely
Section titled “3. Visualize Perception Safely”Start with mock frames and stdout. This is the reliable path for laptops, CI, remote machines, and AI-agent verification.
Typical output includes:
Then switch to a live webcam path:
That command uses real camera input with --visualize auto: Rerun when a viewer is available, stdout otherwise. Use Rerun when you need to inspect image frames, detections, and timing visually. Use stdout when the question is simply whether the graph runs and emits events.
Useful variants:
4. Record And Replay
Section titled “4. Record And Replay”The record command writes replayable artifacts:
Replay consumes recorded events instead of relying on live camera timing. Use this when behavior changes between runs, when you need to share evidence, or when downstream logic should be debugged without a sensor attached.
Practical Triage
Section titled “Practical Triage”| Symptom | First action | Why |
|---|---|---|
| Graph shape is surprising | Render artifacts/tutorial_perception.html |
Wiring, clocks, ports, and sync policies are visible there. |
| Flow output is wrong | Run demo-stepper or demo-perception-stepper |
Keeps debugging in ordinary Python before backend scheduling enters. |
| Rerun does not open | Force stdout visualization with the command below | Separates runtime correctness from viewer setup. |
| Webcam is unreliable | Use pixi run demo-webcam-detection-mock |
Proves the graph without hardware or permissions. |
| Run is hard to reproduce | Run pixi run demo-webcam-record, then pixi run demo-webcam-replay-rrd |
Turns timing-sensitive input into a stable artifact. |
| Backend differs from local stepping | Compare stepper output, rendered graph, and backend output | Clock/sync choices are often the real difference. |
Exact stdout fallback when viewer setup is the suspected issue:
What To Save When Asking For Help
Section titled “What To Save When Asking For Help”If you need another person or an AI agent to debug the run, include these instead of a screenshot alone:
- the command you ran, including
--backend,--camera-mode, and--visualize; artifacts/tutorial_perception.htmlwhen graph shape is relevant;- the first 20-40 lines of stdout around the failure;
logs/perception.rrdorlogs/perception.mcapwhen the issue depends on live sensor timing;- whether the failing path used mock frames, live webcam, Rerun, multiprocessing, or Dora.
That bundle lets the next reader distinguish graph wiring, Flow logic, viewer setup, sensor timing, and backend scheduling.
Continue
Section titled “Continue”- Use Examples and Results for notebook-style expected outputs.
- Use Time and Sync if the issue is event timing or edge sampling.
- Use the first GoldenRetriever proof after the core visual debugging path works.
