Skip to content

test/bench: UAV control+safety, overhead benchmark, 5-NEST driver, drone loop#13

Merged
sepahead merged 3 commits into
mainfrom
examples/uav-drone-loop
Jun 29, 2026
Merged

test/bench: UAV control+safety, overhead benchmark, 5-NEST driver, drone loop#13
sepahead merged 3 commits into
mainfrom
examples/uav-drone-loop

Conversation

@sepahead

@sepahead sepahead commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

Additive test / benchmark / example harnesses for NCP. No protocol or library code is changed — these only use the public API (NCP is a shared dependency).

  • ncp-zenoh/examples/uav_drone_loop.rs — UAV drone-in-the-loop over the Zenoh action plane (CommandFrame{velocity_setpoint,mode,ttl} → quad plant; mode + ttl watchdog gates).
  • ncp-core/examples/uav_control_safety.rs — closed-loop PD flight + every SafetyGovernor gate (speed clamp, geofence→latched ESTOP, stale-sensor HOLD, ESTOP-mode, non-finite-clock fail-safe, horizon clamp), ActionBuffer replay, CommandWatchdog. All assertions pass.
  • ncp-core/examples/overhead.rs — overhead benchmark (the repo had none).
  • e2e/nest_five_networks.py — drives 5 distinct real NEST spiking models through the NCP RPC contract.

Measured overhead (release)

op ns/op bytes
CommandFrame serialize / deserialize 248 / 446 215 B
SensorFrame serialize / deserialize 223 / 474 195 B
SafetyGovernor.govern 140
ReflexController.step 134
BulkBlock encode/decode (1000 f64) 1160 / 477 8033 B
JSON encode same 1000 f64 12946 13012 B

Full control tick ≈ 1 µs; BulkBlock is 11× faster + 1.6× smaller than JSON for bulk data. NCP is low-overhead for 20–1000 Hz control.

Two design notes surfaced (NOT fixed here — shared lib, needs maintainer decision)

  1. ReflexController clamps velocity per-axis, so vector speed can reach √3·max_speed; SafetyGovernor magnitude-clamps. Naming/semantics mismatch.
  2. SafetyGovernor.govern() does not zero channels of a command arriving in mode=estop/hold — de-energizing relies on the plant. Defense-in-depth candidate.

sepahead added 2 commits June 29, 2026 07:51
Adds ncp-zenoh/examples/uav_drone_loop.rs: a controller publishes wire-v0.5 CommandFrames (velocity_setpoint, mode, ttl_ms, seq) and a minimal quad 'plant' subscribes, integrates velocity into a trajectory, and enforces both protocol safety gates — mode in {hold,estop}->de-energize and the ttl_ms watchdog->fail-safe HOLD. Single in-process Zenoh session (scouting off, no router). Writes the trajectory as JSONL for external replay.
ncp-core/examples/uav_control_safety.rs: closed-loop PD flight + every SafetyGovernor gate (speed/geofence/stale/estop/non-finite/horizon), ActionBuffer replay, CommandWatchdog. All pass; surfaces two design notes (ReflexController per-axis clamp -> speed can reach sqrt(3)*max_speed; govern does not zero channels on incoming estop/hold mode).

ncp-core/examples/overhead.rs: measures JSON (de)serialize of CommandFrame/SensorFrame, govern, ReflexController.step, and BulkBlock vs JSON. Result: ~1us full control tick, 215 B action frame; BulkBlock 11x faster + 1.6x smaller than JSON for bulk floats.

e2e/nest_five_networks.py: drives 5 distinct NEST spiking models (iaf_psc_alpha/iaf_psc_exp/izhikevich/hh_psc_alpha/aeif_cond_alpha) through the NCP RPC contract against bridge_server --backend nest.

Additive only: NO changes to NCP protocol/library code.
@sepahead sepahead changed the title examples(zenoh): UAV drone-in-the-loop over the action plane test/bench: UAV control+safety, overhead benchmark, 5-NEST driver, drone loop Jun 29, 2026
Format overhead.rs/uav_control_safety.rs/uav_drone_loop.rs to rustfmt 1.88 and clear clippy -D warnings (inline format arg, array copy via assignment, struct-literal init, doc prose). No library/src changes. (Pre-existing main CI failures in fmt/cargo-deny/ts-dist are unrelated.)
@sepahead sepahead merged commit c9d2602 into main Jun 29, 2026
6 of 12 checks passed
@sepahead sepahead deleted the examples/uav-drone-loop branch June 29, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant