Skip to content

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., your practice guide

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 Tool

Tier 1 · Web · No account

Version tested: Compiled and booted by the Wokwi gate (ESP32 Arduino core 3.3.11); captured in the Wokwi web editor on 2026-09-09. Date: 2026-09-09.

Open 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.

diagram.json

381 bytes · Circuit connections

Download

sketch.ino

1,738 bytes · ESP32 program

Download

  1. Use the launch button above to open the ESP32 editor in Wokwi.
  2. Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
  3. Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.

Steps

Screens captured against Wokwi ESP32 Compiled and booted by the Wokwi gate (ESP32 Arduino core 3.3.11); captured in the Wokwi web editor on 2026-09-09 on 2026-09-09; the tool may have moved on — the text steps are the contract.

  1. 1 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: Node stores id, role, battery, linkAge, leader, and routeOk. The ring marks the Node structure.
    Step 1 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  2. 2 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: RUN 1 promotes node 0 to leader and holds node 3 for a stale link. The ring marks the baseline scenario.
    Step 2 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  3. 3 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: RUN 2 shows node 3 linkAge 9 and hold-stale-link. The ring marks the stale-edge scenario.
    Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  4. 4 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: RUN 3 shows node 2 reserve 24 and revise-low-reserve. The ring marks the low-reserve scenario.
    Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  5. 5 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: RUN 4 promotes node 1 to leader; node 3 has a route gap but is held for its stale link. The ring marks the final scenario.
    Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  6. 6 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: With linkAge 2, node 3 now reports reject-route-gap in RUN 4. The ring marks the exposed route-gap decision.
    Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  7. 7 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: With reserve 35, node 2 reports promote in RUN 3. The ring marks the repaired relay reserve decision.
    Step 7 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  8. 8 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: real Wokwi monitor after restoring the supplied sketch shows RUN 4, low relay reserve, and stale edge link; the ring marks the full scenario.
    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.

  1. 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 check
  2. A 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

Caution

This is a serial state-table exercise. It does not simulate aircraft motion, flight safety, radios, battery discharge, or actual leader election. The source baseline is not fully fresh: node 3 starts at linkAge 7, and the final route gap is masked by the earlier stale-link check. Inputs are cumulative across the four runs, so restore the source before comparing independent changes.

Return to UAV Swarm Coordination · Browse Labs