test/bench: UAV control+safety, overhead benchmark, 5-NEST driver, drone loop#13
Merged
Conversation
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.
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.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
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)
ReflexControllerclamps velocity per-axis, so vector speed can reach √3·max_speed;SafetyGovernormagnitude-clamps. Naming/semantics mismatch.SafetyGovernor.govern()does not zero channels of a command arriving inmode=estop/hold— de-energizing relies on the plant. Defense-in-depth candidate.