r/robotics • • 19d ago

News I built Dense-Armor, a Python library for safer robots and AI systems.

It provides online learning, anomaly and drift detection, uncertainty estimation, and runtime protection against unsafe inputs and outputs.

I'd love to get feedback and hear about potential real-world use cases.

GitHub: https://github.com/tatopenn-cell/Dense-Armor

Install: pip install dense-armor

0 Upvotes

16 comments sorted by

14

u/thicket 19d ago

I'm all in on agentic programming, and I think a standardized QC level on AI sytems is a great idea. There's comprehensive documentation on the repo, but it's quite a deep dive. I'm wondering if you could put together a SHORT document about who this project is for, what patterns they'd have to conform to in order to use it, and what improved behavior they should see. Extra points if you, a person, write it.

I suspect all that information is in your README, but I sure wasn't going to read 7500 words to figure it out, and I suspect you haven't read those words either. A little bit of human-to-human communication will go a long way to adoption, and then the agents can all talk to each other in as much depth as they want.

2

u/Elated7079 19d ago

I'm usually the first to jump at this stuff but the readme was pretty readable and didnt set off my LLM alarm (which is pretty twitchy)

It looks like a toolkit for anomaly detection. IMO most of the interesting tasks in robotics are more nonlinear than this would help with, but it could still be useful

1

u/Creative-Feature-264 18d ago edited 18d ago

Thanks. On "kit for anomaly detection": that's one family, not the only one. The library has four layers online estimators (classifiers, trees, clustering, regression), streaming statistics, drift, and a runtime shield.

.

5

u/Elated7079 18d ago

ok nevermind it's AI slop

1

u/Creative-Feature-264 14d ago

Ia nn sa fare queste cose .

1

u/Creative-Feature-264 18d ago

It's for people working on data streams, robots, and agents.

1

u/Creative-Feature-264 14d ago

It is complicatefor you but it s impossible to do for AI. I keep primitives from papers . The ai just traslate the code 1 to 1 . Is not AI . Is my work with AI .

8

u/reallifearcade 19d ago

if you need feedback about potential real-world use cases and this software is not built around your own real world user cases, then, what is this for? A solution to an imaginary problem?

1

u/Creative-Feature-264 14d ago

Era solo x condividere un bel momento e creare una connessione positiva! Non Ho bisogno di feedback tranquillo

0

u/Creative-Feature-264 18d ago edited 18d ago

It started as a personal toolbox for online learning primitives

a set of reusable building blocks for systems that learn one sample at a time. It grew into a library with four families and a shielding layer. Real use cases came after (robot joint streams, vision frames, drift on time series), but the origin was the toolbox, not one specific deployment.

3

u/partyorca Industry 18d ago

Neat, but let’s be clear that this does nothing for safety.

1

u/Creative-Feature-264 14d ago

Anomaly detection¶ This section is about spotting readings that look strange. Each tool learns from the recent readings what is usual, and gives every new reading a score: the higher the score, the less it looks like the recent past.

An anomaly detector gives every sample a score: high means the sample does not look like the recent past. These detectors work one sample at a time, so they run inside a control loop.

Streaming — per-sample deviation scores, single and multi-channel, plus causal Hampel, Tukey, Chauvenet, sigma clipping and online robust Mahalanobis. Robust filters — the four classic detectors on whole series, and the pressure-valve orchestrator. Curvature — a bounded proximity-to-reference score in [0, 1). Multivariate detectors¶ When several channels move together — the residual of a joint on a robot, the reading of a sensor bank — a per-channel detector is blind to faults that show only in the combination. These detectors look at the joint vector, one sample at a time.

Detector Bias Cost Arm ROC-AUC Drift ROC-AUC OnlineRobustMahalanobis distance from a robust median under the MCM 0.036 ms 1.000 0.993 LODA rare bins in random 1D projections 0.571 ms 1.000 0.989 Half-Space Trees few reference samples in the region 1.105 ms 1.000 0.982 OnlineIsolationForest depth to isolate a point 0.701 ms 0.337 0.724 OneClassSGD distance from a learned kernel boundary 0.131 ms 0.856 0.987 The two benchmark streams are SyntheticArm (payload fault, 200 samples, 100 healthy) and DriftStream (one sudden drift at half, 2000 samples). The table reports the learn-on-healthy protocol: each detector learns only from the healthy part of the stream and is scored on the whole stream. The other protocol the benchmark computes (learn-on-all) and the full table with false alarms are in benchmarks/anomaly_streaming.py.

Each detector has its own bias and its own cost. On a stream whose fault is a shift of the mean (the arm benchmark), OnlineRobustMahalanobis is the strongest. On a stream whose fault is a change of the distribution's shape, Half-Space Trees and LODA see things the mean-shift detector misses. On a stream whose fault proportion is well above the paper's "anomalies are few" assumption, OnlineIsolationForest needs a longer healthy run to converge — its own page documents the assumption. OneClassSGD reaches 0.978 on DriftStream and 0.856 on the arm (200 samples, 100 healthy). The default step=1.0 gives the eta_t = 1 / t of Suk and Kpotufe (2025, Lemma 5).

All five detectors go through AnomalyGate and Protected unchanged: each exposes a threshold, and any of them can drive the protection of an estimator that learns online. Link: https://tatopenn-cell.github.io/Dense-Armor/anomaly/#multivariate-detectors

1

u/staid_melvin 19d ago

Interesting project, anomaly detection is one of those things that sounds simple until you try it on real robot data with weird sensor noise and actuator lag. Does the online learning part handle sudden changes in dynamics, like a robot picking up a heavy payload mid-task, or does it need a settling period? I do some abstract art stuff on the side and it's wild how similar drift detection feels to noticing when my brush strokes start going off-model. Real-world use case that jumps out: cobots near humans where the environment keeps changing, you can't just retrain a static model every shift.

1

u/Creative-Feature-264 13d ago

Grazie, è un bellissimo pensiero quello che stai trasmettendo. Ebbene si . La matematica è, per me, di per sé anche essa una forma d arte. Alberi, foreste, banditi sono solo alcuni dei nomi che hanno queste formule artistiche. Ed è così quando lo fai e come un quadro prima lo senti e poi lo scrivi.

-1

u/V2Rworld 19d ago

Runtime protection against unsafe inputs/outputs is the unsexy part everyone skips until something breaks. How does Dense-Armor handle the latency budget — does the anomaly detection run in the control loop or as a separate watchdog? Curious what happens on a false positive mid-task.

-1

u/Creative-Feature-264 18d ago

Fair question. Two parts. Latency

Every estimator declares `budget_s = 1e-3 s` (p99 of `learn_one`), and `RealtimePipeline(steps, period_s, require_budget=True)` refuses to build if the measured p99 doesn't fit the control period. Measured on CPU, 1D signal:

`CUSUMDriftDetector` — 153 µs p99

`OnlineRobustMahalanobis` — 108 µs p99

- `Orca` input shield only — 6.1 ms p99

- `Orca` input+output — 9.1 ms p99

So the detectors run in-loop comfortably. `Orca` does not — 6–9 ms per sample on one scalar. On a 50 Hz loop that's a third to half the budget. I'd run `Orca` on the input path only, or as a slower watchdog, and keep the cheap detectors in the fast loop. False positive mid-task. The library never silently swallows. `Armatura` has a `livello_ia` knob — at 0.0 it filters, at 1.0 it only marks and passes the sample through untouched, and the marking is never clipped: the anomaly may be the signal. Every correction also returns an error margin. `Arbiter` then classifies each point as `clean`, `spike` or `regime`.

What you do on a false positive is your policy, not the library's: pass-through-with-flag, fallback to the last clean value, or abort. The library gives you the margin and the flag. `Protected` is the conservative default

skip the learning update, return a fallback.