Work record: , 6 minute read

The engine room

Separate deadlines, decode only what a consumer needs, and check the instrument before trusting its verdict. Reading an earlier perception report against the later code and retractions.

The Mongla note is the tour. This is a closer reading of an earlier perception report: what its counters actually establish, what the audit tool measures, and which conclusions the later record no longer supports.

The report is useful partly because its language is too confident. “Nothing holds the lock” and “the sensor is the limit” sound like the end of an investigation. The implementation and later measurements leave more specific, more useful boundaries.

1 · Give control its own deadline

Rakibul Islam’s board and firmware run the low-level 500 Hz sensor/control/motor loop on an ESP32 core. The Pi hosts perception and mission-level software. Separating those tasks keeps a Python inference call out of the board’s control task; it does not mean perception costs nothing or that the vehicle has no other communication and scheduling delays.

Documented ESP32 task split: sensors, control and DShot at 500 Hz on core 1, with MAVLink, display, radio and SD tasks on core 0
The board's documented task budgets. Separate cores still share a chip and resources; this diagram alone does not prove a worst-case deadline or unchanged jitter under every load. Board and firmware: Rakibul Islam.Open image to inspect at full size.

There are two different questions: did the board’s loop meet its deadline, and how old was the observation used to generate a request? A controller can tick regularly while acting on stale vision. Keeping one clock regular does not establish the age or correctness of the other input.

2 · Choose what to decode

The camera pump copies compressed bytes into an owned latest-frame slot and returns driver storage promptly. JPEG decoding happens on demand. This avoids decoding every captured frame merely because a camera can produce it, while preserving the payload, timestamp and sequence as one observation.

The archived instrument report prints the following window:

778
inferences in the window
11.5 ms
mean frame age at inference start
19.2 ms
worst frame age
0
frames decoded and never inferred

Zero decoded-but-never-inferred frames is a useful counter for that window. It does not mean every captured frame was processed, every detection was correct, or an inference result can never be superseded while the accelerator is working. An age measured at inference start also excludes the inference and downstream delivery that have not happened yet.

3 · A long call is not necessarily a long lock hold

In a GIL-enabled CPython process, a C extension that keeps the interpreter lock can delay other Python threads in that process. An extension that releases it can spend a long time working while those threads proceed. Neither case freezes every process on the Pi or the separate ESP32.

The audit ranks call duration × configured rate. For a call taking 10 ms at 77 calls/s, the product is 0.77 s/s, or 77%. That is a call-time demand proxy. It is only an interpreter-blocking fraction if the call actually holds the lock for that duration; a releasing call does not freeze Python for 77% of the second.

archived call-duration × configured-rate proxyhailo run_async78.3 % report: releases GILcv2.imdecode32 % report: releasesletterbox2 % report: releasespyserial0.1 % report: releasescv_bridge0.1 % archived viewer row
Values transcribed from the archived report. These are neither current throughput measurements nor percentages of time every other thread is blocked; do not sum overlapping call-time proxies into a CPU budget.

The pinned tool estimates call duration from the requested run duration divided by completed calls. It supplies configured rates—77 Hz for inference, decode and letterbox, 10 Hz for the viewer conversion and 200 Hz for serial. Those are assumptions for ranking calls, not measurements that all of those rates occur together in a current ROS graph.

The sampler has to pass its own test

The first probe used a spinning observer, which competed for the lock it was trying to investigate. It reported zero median delay for a known lock holder. That instrument could not distinguish its own controls.

The preserved replacement uses a sleeping sampler and prints two controls first: a sleep that releases the lock and a Python spin that holds it. If those do not separate, the tool says the run is void. For the tested calls it reports the other thread’s lateness distribution, then classifies the median against a threshold.

That is a scheduling probe, not a direct trace of every acquire/release event. Machine load, the interpreter build and the binding implementation matter. The archived summary is not a substitute for its raw control output, and a verdict for one call does not certify the wrapper, callbacks and later code around it.

A synthetic scheduler win was taken back

The camera report also preserves a useful reversal. Reducing sys.setswitchinterval from CPython’s 5 ms default to 0.1 ms helped a synthetic Python-thread workload. With the real board and JPEG workload, the extra switching was overhead; the change was reverted.

That distinction keeps the experiment from becoming a tuning superstition. A benchmark can be correct about the artificial workload it ran and still recommend the wrong setting for the application. No hardware or serial-port test has been rerun for this article.

A parameter that’s read, logged and then ignored is worse than one that’s unsupported. Every log says it worked.

4 · A verdict is not a latency boundary

The earlier report below prints full configured authority at p99 and concludes “sensor is the limit.” Full authority is the output of a policy with particular thresholds. It does not mean the software takes zero time, the frame is physically the freshest possible exposure, or the vehicle navigates accurately.

Archived report with camera rates, pipeline ages and full configured authority, ending in a sensor-limit verdict
Preserved report, not a current performance guarantee. Its non-zero ages and configured authority describe different quantities; later entries change capture-rate advice and correct timestamp propagation.Open image to inspect at full size.

The older page also chained roughly 28-to-18 ms pipeline timing, a removed poll wait and changed detector rates into a session-wide improvement. That is not retained as a current photon-to-command claim. The frame-age investigation names the clock and observation boundaries; the Mongla article explains why the B-61 headline needs remeasurement and why unmatched configurations cannot establish a ROS overhead percentage.

The later accelerator-sharing record is more specific than “software vanished.” Its 19 November stage probe measures increased chip-stage and total-call time when detector workers share the device. Its initial requested 30/60 Hz workload fails, while a separate 30/30 Hz detector workload with 3 Hz XFeat holds its revised rates in a short, repeated-frame bench. That is contention evidence under stated conditions—not an exposure-to-thrust measurement.

What survives the reread

The mechanisms are still useful: isolate deadlines, return capture buffers promptly, decode for a consumer, preserve observation identity and audit expensive extension calls. Their value does not depend on declaring the system finished.

The stronger habit is to keep the failed controls, the reversed tuning decision and the workload that missed its bar beside the result that passed. Otherwise a report’s last sentence becomes more durable than the experiment it was supposed to describe.