The developer problem
A replayed packet can make an idle sensor appear healthy if every arrival resets its last-seen timer. ROS 2 distinguishes delivery and deadline policies. Heron lets an application choose a freshness deadline and updates that timer only when it accepts a new sample.
Run the project locally
Replay sequence and local receipt-time pairs. The bundled trace contains a duplicate, a two-ID gap and one out-of-order delivery. You can feed your own two-column headerless trace into the same program. Install Blyx 0.2.1, Rust and a host linker, then run these commands.
git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-heron.git
cd blyx-heron
blyxc native-run project.blyxUse the API
Maintain one state per sensor. Use a monotonically increasing integer sequence and a monotonic local receipt clock in milliseconds, both at most 2^53−1. Reset the state when the sensor restarts or its sequence wraps. The gap counter records skipped IDs at acceptance time. Late arrivals do not reduce it. This release monitors application data and exposes its state to the host.
| Function | Behavior |
|---|---|
| he_start(), he_observe(state, sequence, receipt_ms) | Initialize or update [last sequence, last receipt, accepted, duplicates, out of order, skipped IDs]. |
| he_age(state, now) | Return milliseconds since the latest accepted observation, or −1 when unavailable. |
| he_status(state, now, deadline) | Return unseen, current, late or invalid. A reading remains current exactly at its deadline. |
Verify a change
Run the package checks from its release directory. Compare the browser example with its expected output, then change the input in the exercise below.
blyxc native-run tests.blyxTry the program
Expected output
2 1 late
Practice
Check the feed exactly 30 ms after its last accepted receipt.
Hint
Change only the worked example’s input. The API table describes the output.
Worked solution
Age equals the deadline, so the feed is current. It becomes late one millisecond later.
Find
151.0, 30.0Replace with
150.0, 30.0Output after the change
2 1 current
