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

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

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
    Paste the supplied diagram.json and sketch.ino into Wokwi ESP32. Inspect the Node structure before starting.
    You will see
    The diagram contains one ESP32 and serial connections; each virtual node has id, role, battery, linkAge, leader, and routeOk fields.
    Why it matters
    The host treats coordination as explicit state and role ownership. This program models records, not flying aircraft or a radio network.
    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
    Start the simulation at 115200 baud and read RUN 1 SCENARIO normal-mesh.
    You will see
    Node 0 reports promote-leader; node 3 reports 3 edge 42 7 no ok hold-stale-link.
    Why it matters
    The supplied baseline already has a stale edge link because 7 exceeds the rule’s limit of 5. A scenario name cannot establish readiness.
    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
    Read the node 3 row under RUN 2 SCENARIO stale-edge-link.
    You will see
    3 edge 42 9 no ok hold-stale-link shows linkAge changing from 7 to 9 while the decision remains hold-stale-link.
    Why it matters
    Freshness can block promotion even when the route field says ok. The host requires neighbor state to be current enough for its decision.
    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
    Read node 2 under RUN 3 SCENARIO low-relay-reserve.
    You will see
    2 relay 24 3 no ok revise-low-reserve shows reserve below the gate of 30.
    Why it matters
    Relay ownership needs an energy constraint as well as connectivity. The host’s task-allocation record should explain why a relay must be replaced.
    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
    Read RUN 4 SCENARIO leader-change-route-gap and compare nodes 1 and 3.
    You will see
    Node 1 reports promote-leader. Node 3 has route gap but still reports hold-stale-link because freshness is checked before route continuity.
    Why it matters
    The order of policy checks determines the reported reason. A leader flag change alone does not repair stale or disconnected state.
    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
    Stop. Change node 3’s initial linkAge from 7 to 2 and the later swarm[3].linkAge assignment from 9 to 2. Restart.
    You will see
    Node 3 is promote in the baseline, then reject-route-gap in RUN 4.
    Why it matters
    Changing only freshness exposes the independent route gate. This separates causes before trying combined failure scenarios.
    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
    Stop. Change swarm[2].battery = 24 to swarm[2].battery = 35 and restart.
    You will see
    Node 2 now reports promote in RUN 3 because its reserve, link age, and route all pass.
    Why it matters
    The host’s reassignment decision should cite the state that changed. This controlled revision tests a reserve threshold without claiming measured aircraft endurance.
    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
    Restore the supplied sketch and restart to preserve a reproducible reference run.
    You will see
    The original stale-edge and low-reserve decisions return; RUN 4 again shows a route gap masked by the stale-link reason.
    Why it matters
    The final coordination record should preserve the scenario, changed field, evidence, and next revision. The model omits payload queues and acknowledgements that the host requires for an actual mission.
    Step 8: Restoring the original sketch restores the low-reserve and stale-link decisions. The ring marks the original RUN 4 state.
    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