|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged qerra_core at Robotics Stack Exchange
|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged qerra_core at Robotics Stack Exchange
|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged qerra_core at Robotics Stack Exchange
|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged qerra_core at Robotics Stack Exchange
|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged qerra_core at Robotics Stack Exchange
|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged qerra_core at Robotics Stack Exchange
|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged qerra_core at Robotics Stack Exchange
|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged qerra_core at Robotics Stack Exchange
|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged qerra_core at Robotics Stack Exchange
|
qerra_core package from qerra_core repoqerra_core |
ROS Distro
|
Package Summary
| Version | 2.5.0 |
| License | Apache-2.0 |
| Build type | AMENT_PYTHON |
| Use | RECOMMENDED |
Repository Summary
| Description | |
| Checkout URI | https://github.com/marunigno-ship-it/QERRA-v2-classical.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-30 |
| Dev Status | UNKNOWN |
| Released | UNRELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Maintainers
- Marussa Metocharaki
Authors
QERRA-v2 Classical
A fully explainable, classical three-layer pipeline for AI systems and autonomous robots.
Physical safety (Supervisory Gate + QERRA-HSR) → moral filtering (SEMEV-12) → flourishing-ranked choice (QERRA-THRIVE) — 27 named, auditable vectors (3 + 12 + 12), deterministic rule bounds.
The Idea in One Sentence
Values and ethics can screen and rank what a robot wants to do, but only a deterministic gate decides what the wheels do.
The setting this is built for: a transport cobot in a hospital corridor yields and slows near people, and the Gate is intended to command a stop when specified monitored fault conditions are detected. A Gate process or communication failure still requires an independent downstream command timeout or hardware safety function; this prototype does not demonstrate that the robot stops safely by itself after process failure. The system can leave a record a safety officer can audit.
Status in one paragraph. QERRA is a simulation-based research prototype. It is not a certified safety system, it has not been tested on hardware, and a 0.0 wheel command is a software setpoint, not an emergency stop. The deterministic gate (Gate Core v0.5) is demonstrated in Webots and, as a standalone ROS 2 node (
qerra_gate_nodev0.3.2), is built, executed and tested under ROS 2 Jazzy in GitHub Actions (live DDS topic traffic, dual-protocol reflex co-execution, Pattern B topic remapping, Nav2-compatible exterior command-interface tests,/odomingestion tests including a live DDS/odompublisher, and LaserScan metadata validation tests). Package metadata is v2.5.0 (Gate Core v0.5, ROS 2 Node v0.3.2), incorporating the measured-velocity dynamic stopping envelope, standstill-qualified dwell, 10-point LaserScan metadata and REP-117 bounds validation, and empirical ROS 2 Jazzy timing characterization. Current test counts are in Running the Tests, measured timing is in Empirical ROS 2 timing and contention, and the GitHub Actions workflows (tests.ymlandros2_jazzy.yml) are the live source of truth for CI runs. The Pattern B tests exercise a Nav2-compatible external command interface; they do not launch a complete Nav2 stack. The optional standstill-qualified recovery dwell is opt-in, and the archived Webots runs predate it and the measured-velocity stopping envelope. Localhost is an assumed trusted process boundary, and two documented exploit scenarios show what that assumption leaves open. See the frozen Technical Brief and Known limitations.
| Layer | Role | Evidence today |
|---|---|---|
Layer 1A: Supervisory Gate (gate/) |
The component that decides wheel commands. In the Webots controller it is the only process that writes wheel velocities. Pure standard-library integer state machine enforcing a dynamic stopping envelope $d_{stop}(v_{ref})$ with $v_{ref} = \max(v_{cmd}, v_{meas})$, where $v_{meas}$ is the chassis forward speed derived from measured wheel feedback, watchdog liveness (150 ms), and fail-closed latched recovery with operator reset. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required: bool = False, w_standstill_tol_urad_s: int = 50_000 urad/s): when enabled, the 1.0 s calm dwell waits for verified physical standstill from measured wheel speeds, without generating a deceleration trajectory (an open-loop TRIP_BRAKING was intentionally rejected to keep Doer-Checker separation; the Gate commands (0, 0) immediately upon any trip). Both the Webots controller and the ROS 2 node can log every tick to a SHA-256 rolling hash chain, and the node trips fail-closed if a log write fails (requirement R-10). |
Demonstrated in simulation: Demos 7, 8, 9 and 10 (the archived runs predate the standstill-qualified dwell and the measured-velocity envelope). Flight log verifiable offline with verify_log.py --replay. Core invariants (zero actuator authority outside RUN, stopping-envelope lower bound, clock monotonicity, standstill-dwell gating, HSR stream-monitor properties) are checked by stdlib property tests over defined input grids (tests/test_gate_invariants.py). Also packaged as a standalone ROS 2 node (qerra_gate_node v0.3.2) with parameterised timing profiles (96 ms simulation, 160 ms for a 10 Hz scanner), built and tested under ROS 2 Jazzy in CI: live DDS topic traffic, dual-protocol reflex integration, Pattern B topic remapping, Nav2-compatible exterior command-interface integration, /odom ingestion and watchdog tests (isolated stubs plus a live DDS /odom publisher), and LaserScan metadata validation. Software-side timing was measured once inside the ros:jazzy container (see Empirical ROS 2 timing and contention); it is an observation, not a bound. The Nav2 exterior tests use a Nav2-compatible command-source harness, not a running Nav2 stack. Current counts: see Running the Tests. Simulation and CI evidence only. |
Layer 1B: QERRA-HSR (hsr/) |
A 3-vector reflex signal (immediate_physical_distress, human_isolation, environmental_hazard_proximity) under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. The Gate acts on it when it is wired in (CRITICAL trips the gate). In the ROS 2 node a pure-function stream monitor (step_hsr_stream), wrapped by the shared pure-Python receiver gate/hsr_receiver.py (ros2/hsr_receiver.py is a compatibility shim), checks packet sequence order, detects frozen frames, and allows a counter rebase only after both at least 5 qualifying control ticks and at least 160 ms of elapsed observation time. Telemetry arrives over UDP (default, used by Webots) or over a ROS topic (hsr_source="topic", in which case no UDP socket is opened). Pure Python, Apache-2.0. (“HSR” here is this project’s own name and is unrelated to Toyota’s Human Support Robot.) |
Built and unit-tested (see Running the Tests). Evaluated in Webots Demos 6, 9 and 10 with a stabilised 1.0 s dwell and Property HSR-5 recovery directives. The stream monitor has edge-case matrix tests and a 159 ms / 160 ms rebase boundary test in the host suite, and the ROS-topic path is exercised by live multi-node tests in the container (dwell, acute distress, frame freeze, staleness). All HSR input in the demonstrations is injected or synthetic. |
| Layer 2: SEMEV-12 | Advisory screening of text task instructions against 12 moral and coercion vectors. MiniLM embeddings with deterministic scoring gates and negation pre-filtering. Not part of the physical safety function. | Built, unit-tested and benchmarked (15 regression cases, 80-case baseline, active adversarial suite). The adversarial benchmark documents known evasion vectors. |
| Layer 3: QERRA-THRIVE | Advisory values ranking for actions that have passed safety and moral screening (pacing, personal space, clear signalling, flora/animal protection). Native PyTrees integration. | Built and unit-tested across human-centered and ecological suites. Heuristic weights; not yet evaluated with human participants. |
Where to start:
- Safety and robotics engineers:
TECHNICAL_BRIEF_ROS2_GATE.md(frozen executive architecture reference and permalink),SAFETY_CONCEPT.md(v0.12),QERRA-HSR-Design-v0.1.md,LIMITATIONS.md,verify_log.py, the ROS 2 Integration section, and the Demo 7, 8, 9 and 10 sections below. - Ethics, human-robot interaction and standards readers: the SEMEV-12 and QERRA-THRIVE sections below,
SEMEV-12_Whitepaper.md,QERRA-THRIVE_framework_documentation.md, and the two benchmark files.
What QERRA Does
QERRA-v2 Classical is an open-source execution guard for autonomous robots and AI systems.
A mobile robot should never rely on an unpredictable neural network to make safety-relevant physical motion decisions. If a complex model lags or hallucinates, a 70 kg machine can crush someone.
QERRA addresses this by splitting safety into three separate, accountable jobs that run in a strict sequence:
-
The Deterministic Gate & Assistive Reflex (Layer 1A & 1B):
-
Layer 1A — The Supervisory Gate (
gate/): Pure-function, standard-library-only integer state machine that decides velocity commands. It evaluates velocity proposals from untrusted planners against a dynamic kinematic stopping envelope ($d_{stop} = \lceil v_{ref}^2 / (2a_{design}) \rceil + \lceil v_{ref} \cdot t_{react} \rceil + margin$, with $a_{design} = 0.5\ \text{m/s}^2$ (500 mm/s$^2$) and $margin = 300\ \text{mm}$; use $v_{ref}$ in mm/s, $a_{design}$ in mm/s$^2$, and $t_{react}$ in seconds (or $t_{react,us} / 10^6$) to obtain millimetres). The reference speed is $v_{ref} = \max(v_{cmd}, v_{meas})$.gate/gate_core.pyderives $v_{meas}$ (chassis_forward_mmps) from the measured wheel speedsmeas_left_urad_sandmeas_right_urad_sthrough differential-drive kinematics: $\lceil (left + right) \cdot wheel_radius_mm / 2{,}000{,}000 \rceil$ when positive, otherwise 0. Pure in-place yaw rotation ($left + right = 0$) therefore evaluates to 0 mm/s forward translation and does not enlarge the forward stopping distance. When measurements are missing, stale or invalid (None), $v_{meas}$ is 0 and $v_{ref}$ falls back to the commanded speed. Reaction time is parameterised: the Webots controller used a 32 ms lockstep allowance ($d_{stop} = 346\ \text{mm}$ at 196 mm/s cruise, 347 mm at 200 mm/s), while the ROS 2 node exposes a 96 ms simulation profile ($d_{stop} = 358\ \text{mm}$ at 196 mm/s, 360 mm at 200 mm/s) and a 160 ms profile for a 10 Hz scanner ($d_{stop} = 371\ \text{mm}$ at 196 mm/s, 372 mm at 200 mm/s). The 96 ms and 160 ms values are engineering estimates, not measured latencies. The gate trips fail-closed on obstacle breach, clock anomalies, invalid sensor scans, proposer stalls ($\ge 150\ \text{ms}$), or, when a flight log is configured, a failed log write orfsync(requirement R-10), and enforces a 1.0 s continuous-clear dwell and a manual operator reset before recovery. Gate Core v0.5 adds an optional standstill-qualified recovery dwell (standstill_required, defaultFalse;w_standstill_tol_urad_s = 50_000urad/s): when enabled, the calm dwell waits for verified physical standstill from measured wheel speeds. In verified simulation (TIAGo base in Webots R2025a,RUN_1791713619, recorded before the measured-velocity term existed), a commanded cruise was halted with $36\ \text{mm}$ of physical coasting after a trip at 337 mm clearance (standstill at 301 mm). -
Layer 1B — QERRA-HSR Reflex (
hsr/): Pure Python threshold reflex under ISO 13482 as an informative design reference for assistive and healthcare mobile cobots. Evaluates distress telemetry, human isolation, and proximity hazards to issue reflex states (CLEAR,MONITOR,CRITICAL) and Property HSR-5 human-in-the-loop recovery directives. The Gate trips onCRITICAL. In the ROS 2 node, incoming telemetry passes through a pure stream monitor (step_hsr_stream, wrapped by the shared receivergate/hsr_receiver.py;ros2/hsr_receiver.pyis a compatibility shim) that checks packet order, detects frozen frames, and presents no valid status ((None, None)) during a fault or a rebase dwell. Withhsr_required=truethe gate core turns that intoTRIP_HSR_INVALID. InMode.RUN,MONITORimposes no velocity cap: the existing 3.0 rad/s (0.294 m/s) envelope holds. While latched inMode.TRIPPEDorMode.AWAITING_RESET,MONITORblocks clear-dwell completion and causes operator reset rejection.
-
Layer 1A — The Supervisory Gate (
-
The Moral Conscience (SEMEV-12): A 12-dimensional ethical filter that evaluates text instructions before the robot moves. If someone orders the robot to do something abusive, deceptive, or coercive (such as forcing a worker through a break or falsifying safety records), the robot refuses the command, illuminates an amber LED, logs the refusal reason, and physically shakes its head “No” in simulation.
- The Social Manners (QERRA-THRIVE): A 12-vector ranker for tasks that are already physically safe and morally clean. It selects the most considerate way to move, such as quiet “whisper mode” in hospital corridors or keeping off garden lawns unless an emergency overrides etiquette.
The decision logic is deterministic, inspectable, and auditable. Every result outputs the exact vectors that triggered, human-readable reasoning, and a concrete recovery directive.
⚖️ Authorship & License
QERRA-v2 Classical is designed and developed by Marussa Metocharaki.
- Open Source License: The entire repository is licensed under the Apache License 2.0.
- Permissive Robotics Architecture: Permissive for chassis-local ROS 2 integration, academic research, and commercial robotics adoption.
-
Original Work & Archival: The core frameworks, vector logic, and scoring architectures are timestamped and permanently archived on Zenodo.
DOI (Zenodo): https://doi.org/10.5281/zenodo.24625489 ORCID: https://orcid.org/0009-0009-4100-9881
Quickstart
Public example endpoint (no API key required):
curl https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/example
Main endpoint (/analyze) requires the public test key:
x-api-key: TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
Full documentation:
https://qerra-v2-api-classical-qerra-v2-api-classical.hf.space/docs
Try QERRA in a Behavior Tree — 2 minutes, no ROS 2 required
QERRA-v2 includes a standalone PyTrees Condition node that calls the live API directly over HTTP. No ROS 2 installation, no qerra_msgs package, no build step.
pip install py_trees requests
export QERRA_API_KEY=TEST-2026-QERRA-CLASSICAL-PUBLIC-KEY-98765
python test_bt_tick.py --live
This runs a real Behavior Tree against the live two-layer API (SEMEV-12 + QERRA-HSR), showing both a SAFE scenario (ethical check passes, task executes) and a HIGH RISK scenario (ethical check blocks, robot holds and requests human review).
```bash python test_bt_tick.py –live –risk # high risk scenario only python test_bt_tick.py –live –safe # safe scenario only python test_bt_tick.py # offline mock mode, no API call
File truncated at 100 lines see the full file
Changelog — QERRA-v2 Classical
SEMEV-12 vectors are maintained as a stable core across versions. This log records additions, changes, fixes and retired integration paths.
[2.5.0] - 2026-11-28 — Measured-Velocity Stopping Envelope, Sensor Integrity & Empirical ROS 2 Timing Baseline
Added
-
Measured-Velocity Stopping Envelope (
gate/gate_core.py): Hardened dynamic stopping envelope calculation to $d_{\text{stop}}(v) = \lceil v_{\text{ref}}^2 / (2 \cdot a_{\text{design}}) \rceil + \lceil v_{\text{ref}} \cdot t_{\text{react}} / 10^6 \rceil + margin$ with $v_{\text{ref}} = \max(v_{\text{cmd}}, v_{\text{meas}})$. Forward chassis translational speed ($v_{\text{meas}}$) is derived from measured wheel feedback viachassis_forward_mmps(), preventing stopping envelope collapse during uncommanded chassis coasting. Covered byTestMeasuredVelocityStoppingEnvelopeintests/test_gate_core.py. -
Mathematical Invariant Verification (
tests/test_gate_invariants.py): Implemented pure Python standard-library property-based invariant test suite executing >117,000 state transitions across Layer 1A and Layer 1B state machines with zero invariant violations. -
ROS-Native Topic Telemetry & Pattern B Launch (
ros2/,launch/): Added ROS-native topic subscription (/hsr/telemetry) togate/hsr_receiver.py(operating with zero open UDP sockets in topic mode). Added 21-parameter launch filelaunch/qerra_gate.launch.pysupporting Pattern B exterior command interceptor remapping (cmd_vel_in,cmd_vel_out,odom_topic,scan_topic,reset_topic,state_topic). -
10-Point LaserScan Metadata Validation (
ros2/qerra_gate_node.py): Addedvalidate_laserscan_metadata()pure-Python physical invariant checklist verifying headers, beam counts, ordered angle bounds, field-of-view tolerances, center alignment, and non-negative range limits. Discards invalid scans to fail closed (TRIP_SENSOR_INVALID). -
REP-117 Physical Range Bounds (
gate/gate_lidar.py): Implemented strictrange_minandrange_maxbounds enforcement. Forward corridor returns $< \text{range_min}$ convert to NaN (trippingTRIP_SENSOR_INVALID); lateral returns $< \text{range_min}$ mask to $+inf$; returns $> \text{range_max}$ are excluded from raw valid points and masked to $+inf$. Verified by 27 unit & callback tests intests/test_gate_ros2_laserscan_metadata.py. -
Empirical Timing Baseline & Contention Benchmarks (
tools/): Addedtools/bench_gate_core.py(100k CPU microbenchmark) andtools/bench_ros2_executor.py(6-scenario SingleThreadedExecutor benchmark measuring platform noise floor, gate compute jitter, active traffic contention, synchronous SHA-256 flight logos.fsync()overhead, synthetic head-of-line blocking, and separate-process hazard trip software response over 100 seeded randomized trials). Added manual CI workflow.github/workflows/timing.yml. -
Nav2 Coexistence Architecture: Formulated and documented the Simplex-inspired layered command topology (
Nav2 Controller -> Nav2 Collision Monitor -> QERRA Gate -> Base Controller).
Fixed (Post-v2.5.0 Hardening on main)
-
Proportional Wheel Clamping (
gate/gate_core.py): When forward wheel commands exceedw_max_urad_s,clamp_to_envelope()scales both wheels by a curvature-preserving integer ratio instead of independent per-wheel clipping (which distorted turns into straight-line motion).step()emitsEvent.CLAMPEDonReason.PASSticks whenever clamping modifies a valid proposal. AR-2 Option A (symmetric zeroing on any reverse command) remains intact. -
Twist Numeric Overflow Guard (
ros2/qerra_gate_node.py):twist_to_wheel_speeds()and_cmd_vel_callback()catch(ValueError, ArithmeticError)so extreme finite floats (e.g.,1e303) that overflow float-to-integer conversion fail closed throughproposal_invalid=Trueinhibition instead of raisingOverflowErrorand crashingrclpy.spin(). -
Flight-Log Restart Protection (
gate/gate_log.py,ros2/qerra_gate_node.py):GateLoggerrefuses to appendseq=0to an existing non-empty file (FileExistsError). On restart,QerraGateNoderotates to a collision-free sibling path (.1.jsonl,.2.jsonl, …) viaopen_node_flight_logger()/resolve_unique_log_path()so earlier SHA-256 flight logs are never corrupted. -
Lean-Environment Test Skipping (
tests/test_bridge_fail_closed.py,tests/test_vectors.py,tests/test_cases.py): Whensentence_transformersis absent,ImportErrorguards skip NLP tests cleanly instead of failingunittest discoverwithModuleNotFoundError.
Changed
-
Version Metadata Bumps: Bumped package version to
2.5.0inpackage.xmlandsetup.py. Bumped ROS 2 gate node version to0.3.2inros2/qerra_gate_node.py. -
Documentation Alignment: Synchronized
LIMITATIONS.mdwith Phase 4 empirical timing metrics and updated LaserScan metadata validation status. SynchronizedREADME.mdtest counts (319 host / 80 container tests across 8 modules) and release metadata.
Testing & Validation
-
Host Test Suite (Windows 11): 319 tests passed, 16 cleanly skipped on hosts lacking
rclpy(0 failures). -
ROS 2 Jazzy Container Suite (
ros:jazzy): 80 tests passing across 8 modules in GitHub Actions CI. -
Empirical Timing Benchmark Run (Azure VM Ubuntu 24.04,
rmw_fastrtps_cpp, Python 3.12.3):- Nominal compute p99 $\le 1.051\text{ ms}$ under active 682-beam traffic and synchronous SHA-256 flight logging; 0 missed deadlines (>35 ms).
- Monotonic expected-release lateness ($t_0 + k \times 32\text{ ms}$) max $< 0.89\text{ ms}$.
- Head-of-line blocking demonstration (40 ms injected scan pause): 99/99 missed deadlines, 903.199 ms cumulative schedule slip.
- Scenario 6 separate-process obstacle trip latency over 100 seeded trials: $\text{p50} = 16.227\text{ ms}$, $\text{p95} = 31.705\text{ ms}$, $\text{max} = 32.348\text{ ms}$ (software response only; 100/100 verified exact zero Twist and correlated
TRIP_OBSTACLE).
[2.4.2] - 2026-11-22 — Verified Standstill Qualification, Odometry Ingestion & Gate Hardening (Gate Core v0.5)
Added
-
Verified Standstill Qualification (
gate/gate_core.py): Hardened the Supervisory Gate recovery lifecycle to resolve the “Standstill Dwell Trap.” Added immutablestandstill_required: bool = False(default for backward compatibility) andw_standstill_tol_urad_s: int = 50_000(tolerance $\le 0.05\text{ rad/s} \approx 4.9\text{ mm/s} on 98 mm wheels) toGateParams. Addedmeas_left_urad_s: Optional[int]andmeas_right_urad_s: Optional[int]toGateInputs. InMode.TRIPPED, the 1.0 s calm dwell timer strictly requires confirmed physical standstill before arming. -
Mid-Dwell Motion Reset Guard (
gate/gate_core.py): Implemented fail-closed dwell resetting. If physical chassis motion exceeding tolerance is detected while dwelling inMode.TRIPPED(e.g. external collision, rolling on slopes, or caster sliding),clear_since_usresets toNoneimmediately, enforcing continuous standstill before transition toAWAITING_RESET. -
Standstill Core Unit Test Suite (
tests/test_gate_core.py): AddedTestStandstillDwellQualification(4 tests) covering dwell inhibition during physical coasting, dwell activation upon standstill, mid-dwell motion reset, and missing feedback fail-closed handling. All 65 core unit tests pass green. -
ROS 2 Odometry Integration (
ros2/qerra_gate_node.py): Subscribed to/odom(nav_msgs/msg/Odometry), translating body linear/angular twist to integer wheel speeds viatwist_to_wheel_speeds(). AddedDEFAULT_ODOM_STALE_US(100 ms) staleness watchdog and clock-regression protection (odom_age_us < 0 or odom_age_us > DEFAULT_ODOM_STALE_USfails closed toNone). Exposedstandstill_requiredparameter and updated/gate/statediagnostic JSON. -
ROS 2 Odometry Ingestion Test Suite (
tests/test_gate_ros2_odom.py): Added 7 standalone tests running_odom_callbackand_tick_callbackagainst isolated ROS 2 stubs. Verifies exact integer translation across straight, spin, arc, standstill, and reverse twists; 100 ms freshness ceiling; NaN/Inf rejection; malformed message rejection; and recovery after fault. Tests run on Windows without ROS 2 installed. -
Webots Wheel Sensor Telemetry (
controllers/tiago_supervisory_gate/tiago_supervisory_gate.py): Converted PAL Robotics TIAGo wheel position sensor derivatives into integer $\mu\text{rad/s}$ and wired them directly intoGateInputs(meas_left_urad_s=..., meas_right_urad_s=...). AddedQERRA_STANDSTILL_REQUIREDenvironment configuration (defaults to1in live simulation).
Changed
-
Version Metadata Bumps: Bumped
GATE_CORE_VERSIONto0.5ingate/gate_core.py. Synchronizedpackage.xmlandsetup.pyto2.4.2. -
Flight Recorder Input Reconstructor (
gate/gate_log.py): Updatedreconstruct_inputs()to deserializemeas_left_urad_sandmeas_right_urad_swith.get(...)fallbacks, guaranteeing 100% backward compatibility with older flight logs.
Testing & Validation
-
Full Discovery Test Suite: 215 host tests collected under
tests/; 201 passed, 14 cleanly skipped on Windows withoutrclpy(100% pass rate in 0.997s). -
Cryptographic Replay Audit: Historical Demo 10 audit log (
results/DEMO10_FROZEN_FRAME_20261120_125540/gate_audit.jsonl) replayed 439/439 discrete control cycles bit-for-bit with 0 divergence against anchored head seal0250fdcbff64af691dc52f5d60a89305d691ce3ca6b662281e7e9c73ff46437a.
[Unreleased] — Standalone ROS 2 Gate Node: Packaging, Native Jazzy CI, Fault Latch, Perception Stream Monitor, Timing Profiles, Flight Log, Adversarial Verification, Live DDS Traffic, Dual-Protocol Watchdogs, Launch Configuration, Pattern B Remapping, Node Regressions & CI Isolation (2026-10-30 to 2026-11-15)
Current branch baseline — 15 November 2026
The current verified main baseline is commit be45e4c. The standalone ROS 2
package qerra_core is at package version 2.4.1 (ROS package format 3,
ament_python, Apache-2.0). The repository’s Git tag list is currently empty;
2.4.1 is package metadata on main, not a tagged release. Gate Core remains
v0.4, the ROS 2 node qerra_gate_node remains v0.3.1, and the HSR telemetry
contract (gate/hsr_telemetry.py) remains v0.3.1.
qerra_core is built as a standalone package. The experimental
src/qerra_msgs subtree is masked by src/qerra_msgs/COLCON_IGNORE, is not a
qerra_core dependency in the root package.xml, and is excluded from the
current ros2_jazzy.yml build. The earlier qerra_msgs interface-generation
experiment is historical; it is not part of the current package build or
release boundary.
Verified CI and test baseline
Both GitHub Actions workflows passed on commit be45e4c on 15 November 2026.
The run identifiers and durations below identify the current verified runs;
the test output in each workflow is the authority for the reported counts.
| Date | Commit | Test Suite run | ROS 2 Jazzy Validation run | Host suite under tests/
|
ROS 2 Jazzy container suite |
|---|---|---|---|---|---|
| 2026-11-01 | a7a00ba |
#742 | #7 | 192 | not recorded |
| 2026-11-03 | fb03b85 |
#760 | #25 | 197 | 19 (16 + 3) |
| 2026-11-04 | a511d1e |
#766 | #31 | 203 | 25 (17 + 8) |
| 2026-11-05 | docs(sc) |
#773 | #31 | 211 | 25 (17 + 8) |
| 2026-11-07 | test(ros2) |
#781 | #50 | 215 (211 pass, 4 skip) | 29 (17 + 8 + 4) |
| 2026-11-08 | ci(ros2) |
#790 | #56 | 217 (211 pass, 6 skip) | 31 (17 + 8 + 4 + 2) |
| 2026-11-10 | ci(jazzy) |
#802 | #68 | 218 (211 pass, 7 skip) | 32 (17 + 8 + 4 + 2 + 1) |
| 2026-11-11 | ci(nav2) |
#808 | #75 | 222 (211 pass, 11 skip) | 36 (17 + 8 + 4 + 2 + 1 + 4) |
| 2026-11-15 | be45e4c |
#834 — passed (1 min 6 s) | #99 — passed (1 min 4 s) | 230 collected: 217 passed, 13 skipped, 0 failed | 40 passed (19 + 8 + 4 + 4 + 1 + 4) |
The 13 host skips are expected on Windows without rclpy: 4 live-traffic
tests, 4 dual-protocol/node-regression tests, 1 remapping test, and 4
Nav2-compatible exterior tests. The separate hsr/ suite contributes another
20 passing tests in Test Suite run #834; these 20 tests are not included in
the 230-test tests/ host count.
The 40 native Jazzy container tests are distributed as follows:
File truncated at 100 lines see the full file
Package Dependencies
| Deps | Name |
|---|---|
| ament_python | |
| rclpy | |
| geometry_msgs | |
| nav_msgs | |
| sensor_msgs | |
| std_msgs | |
| launch | |
| launch_ros |
System Dependencies
| Name |
|---|
| python3-pytest |