Evaluate swarm readiness records
Compare freshness, battery reserve, route continuity, and leader changes in four virtual UAV records.

Blueprint Bina: I want you to justify each readiness decision from the record instead of trusting the scenario name.
Predict the reading, then compare it with the measurement.
Wokwi ESP32
Third party ToolOpen the ESP32 editor, paste diagram.json, then paste sketch.ino.
Open Wokwi to paste in the files (new tab)Get the files
Use both prepared files. This is a paste-in setup; saving a project requires a Wokwi account.
sketch.ino
- Use the launch button above to open the ESP32 editor in Wokwi.
- Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
- Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.
Steps
Step 1
- Do
- In Wokwi's project editor, paste the supplied diagram.json and sketch.ino into Wokwi ESP32. Inspect the Node structure before starting.
- You will see
- Define a node record:
struct Node {(sketch.ino line 3). Store its identifier:uint8_t id;(sketch.ino line 4). Store its role:const char* role;(sketch.ino line 5). Store battery level:int battery;(sketch.ino line 6). Store link age:int linkAge;(sketch.ino line 7). Mark leader state:bool leader;(sketch.ino line 8). Mark route health:bool routeOk;(sketch.ino line 9). - Why it matters
- The virtual node fields provide the later readiness checks with an identity, role, battery, link age, leader flag, and route flag. The screenshot shows the data model before any scenario output.

Step 1 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 2
- Do
- In the Serial Monitor panel, read RUN 1 SCENARIO normal-mesh.
- You will see
- Input: run the supplied normal mesh. Observed: "RUN 1 SCENARIO normal-mesh". Observed: "0 gateway 84 1 yes ok promote-leader". Observed: "3 edge 42 7 no ok hold-stale-link".
- Why it matters
- The gateway is promoted as leader. The edge reserve is 42. Its link age is seven. That age causes the stale-link hold in this run.

Step 2 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 3
- Do
- In the Serial Monitor panel, compare the edge row in RUN 2.
- You will see
- Input: supplied stale-edge-link scenario. Observed: "RUN 2 SCENARIO stale-edge-link". Observed: "3 edge 42 9 no ok hold-stale-link". Expected: a still older link remains held.
- Why it matters
- The edge link age increased from seven to nine. The reserve remains 42. The route remains marked ok. The decision remains hold-stale-link.

Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 4
- Do
- In the Serial Monitor panel, read the relay row in RUN 3.
- You will see
- Input: supplied low-relay-reserve scenario. Observed: "RUN 3 SCENARIO low-relay-reserve". Observed: "2 relay 24 3 no ok revise-low-reserve". Expected: reserve below 30 blocks promotion.
- Why it matters
- The relay reserve is 24. Its link age is three. The route is marked ok. The low reserve controls this decision.

Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 5
- Do
- In the Serial Monitor panel, compare survey and edge rows in RUN 4.
- You will see
- Input: supplied leader-change-route-gap scenario. Observed: "1 survey 76 2 yes ok promote-leader". Observed: "3 edge 42 9 no gap hold-stale-link". Expected: stale-link priority masks the edge route gap.
- Why it matters
- The survey node is the new leader. The edge route is marked gap. Its link age is still nine. The stale-link rule is evaluated before the gap rule.

Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 6
- Do
- In the sketch.ino editor tab, change both edge link ages to 2; restart and read RUN 4 in Serial Monitor.
- You will see
- Input: initial edge link age 7 to 2, later assignment 9 to 2. Observed: "3 edge 42 2 no ok promote" in RUN 1. Observed: "3 edge 42 2 no gap reject-route-gap" in RUN 4. Expected: fresh-link baseline promotes and route gap is exposed.
- Why it matters
- The link age is below the stale threshold. The baseline edge has a valid route. The later edge has a route gap. The decision now names that gap directly.

Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 7
- Do
- In the sketch.ino editor tab, also set the RUN 3 relay reserve to 35; restart and read Serial Monitor.
- You will see
- Input: keep fresh edge changes and set relay battery to 35. Observed: "RUN 3 SCENARIO low-relay-reserve". Observed: "2 relay 35 3 no ok promote". Expected: the relay passes the reserve gate.
- Why it matters
- The relay reserve rose from 24 to 35. The age and route stayed eligible. The decision changed to promote. This second scenario change isolates the reserve rule.

Step 7 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 8
- Do
- In Wokwi's sketch editor, restore the supplied sketch and restart to preserve a reproducible reference run.
- You will see
- Input: restore the supplied sketch in the Wokwi editor after the changed-scenario run, then restart. Observed: "RUN 4 SCENARIO leader-change-route-gap". Observed: "2 relay 24 3 no ok revise-low-reserve". Observed: "3 edge 42 9 no gap hold-stale-link".
- Why it matters
- The supplied run restores the relay reserve to 24. The edge link age returns to 9 and the route remains a gap. The decision is hold-stale-link in the restored RUN 4. The repository sketch stays the reproducible reference; browser edits were temporary.

Step 8 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
Chapter checks
These questions refer to the chapter’s examples. Use the return links to review their answers.
A standby UAV can reach an uncovered search lane, but its image queue is nearly full and gateway freshness is weak. Urgent status from the lane is still required. Which coordination record is most defensible?
Return to the chapter’s knowledge checkA four-UAV search sweep loses one lane owner, the remaining UAVs still hear each other, the ground link is weak, and bulk imagery can wait. Which first record keeps the coordination decision traceable?
Return to the chapter’s knowledge check