Skip to main content

armdoctor

armdoctor runs a short, safety-checked self-test on a robot arm and compares the reported joint positions and loads with a nominal MuJoCo model of the arm. It reports whether the arm is healthy, which joint is affected, which of five fault types is most likely, and how large the fault is.

Status: simulation only; not validated on hardware. Every number in this repository comes from a synthetic plant (a perturbed MuJoCo model with sensor limits) checked against the nominal model. No real arm has been diagnosed with it yet. Treat the results as a statement about the method under stated assumptions, not about any real robot.

Full method, results and limitations: TECH_REPORT.md.

armdoctor works with any MuJoCo arm that has position servos. mjguard checks motions before they run; armdoctor looks at what happened after a known motion ran. It reuses mjguard's robot configs and presets, and every self-test it generates must pass mjguard's checks.

Results in simulation

Held-out test runs on two arms, the RoArm-M3 (5 joints, hobby servos) and the UR5e from MuJoCo Menagerie (6 joints). The alarm threshold is set for 5% false alarms on 1000 healthy runs that were not used for fitting.

RoArm-M3 UR5e
false alarms (2000 held-out healthy runs) 4.7% (95% CI 3.9–5.7%) 5.1% (4.2–6.1%)
fault type right / joint right (detected single faults) 96.5% / 98.2% 92.0% / 97.8%
payload, smallest reliably detected ≤ 0.02 kg 0.25 kg
zero offset 1° on the shoulder; not seen on wrists or vertical axes 1° on shoulder_lift; same limits
friction ×2 to ×3 on 4 of 5 joints; not the shoulder ×2 on all joints (assumed nominal friction)
weak gain ×0.8 to ×0.9 ×0.9
backlash 0.1° to 0.5° 0.1° to 0.25°
magnitude error midway between training values, median (payload / backlash) 0.003 kg / 0.05° 0.02 kg / 0.03°
two simultaneous faults always detected, one of the two named always detected, one named in 98.8%

Detection vs false alarms

Install

From a checkout (Python ≥ 3.12, uv):

uv sync

Quickstart: a simulated demo on the UR5e

uv run armdoctor robots                                    # bundled robots + mjguard presets
uv run armdoctor selftest --robot ur5e -o selftest.json    # refuses to write a test mjguard rejects
uv run armdoctor baseline --robot ur5e --selftest selftest.json --simulate 60 --classifier -o baseline.json
uv run armdoctor simulate --robot ur5e --selftest selftest.json --seed 7 --fault friction:elbow_joint:2.5 -o ep.json
uv run armdoctor check ep.json --robot ur5e --baseline baseline.json -o report   # report.json + report.html

The simulate step stands in for a real arm. It draws a synthetic episode from the perturbed plant. Repeat --fault to inject several faults at once. bash scripts/demo.sh runs the whole chain on the RoArm-M3 and the UR5e: one healthy and five faulty episodes each. Reports are written to out/demo/<robot>/report_*.html.

With recorded episodes of a real arm, fit the baseline from two disjoint sets of healthy runs. Use hundreds of threshold runs if you can: with tens, the realised false-alarm rate varies by several points.

uv run armdoctor baseline --robot ur5e --selftest selftest.json \
    --healthy fit/*.json --threshold-runs thr/*.json -o baseline.json

What it does

  1. Self-test (armdoctor selftest) generates a joint trajectory for your robot in two parts:

    • Eight dwell poses. They are chosen so that gravity loads separate a zero offset on each joint from link-mass and payload errors.
    • Then a slow sweep of each joint with two reversals, so that friction shows as a load step between the two directions.

    Every waypoint passes mjguard and stays within its step and speed limits. armdoctor verify re-checks a stored test.

  2. Baseline (armdoctor baseline) learns what healthy looks like:

    • Healthy runs fix the normal spread of every residual feature.
    • A disjoint set of healthy runs sets the alarm threshold. It uses the ⌈(n+1)(1−α)⌉-th smallest score, a split-conformal rule.
    • Optionally, a k-nearest-neighbour classifier and continuous magnitude maps are trained on simulated faults.
  3. Check (armdoctor check) takes one episode and writes a health report (JSON and a self-contained HTML page). The report contains:

    • an anomaly score and the status of each joint;
    • the features that moved;
    • physical estimates of zero offset (deg), sweep friction (N·m) and payload (kg);
    • the most likely fault, with its magnitude and the feature that magnitude was read from;
    • the nearest labelled examples, so the answer can be checked.

Fault types modelled: payload at the tool, encoder zero offset, joint friction, weak position gain, backlash.

Robots. --robot takes any of these:

  • a bundled robot (roarm_m3);
  • an mjguard preset (ur5e, panda, fr3, ...). Menagerie models are downloaded by robot_descriptions on first use;
  • an mjguard TOML config;
  • a bare MJCF file. In that case the arm joints are the hinge joints with position actuators, and the floor is the first plane geom.

An optional [armdoctor.plant] table in the TOML sets simulation-only plant options.

Episode format (armdoctor-episode/1, JSON):

  • planned waypoints, period_s, start;
  • measured rows [t, q...];
  • optional loads rows [t, l...], in any consistent unit.

roarm-mcp episode files are accepted as well. An episode must come from the same self-test as the baseline; armdoctor checks this by fingerprint and waypoints. Without loads, only position features are used, and the report says so.

Limitations (short version)

  • Simulation only. Plant and twin share the MJCF geometry. The sensor, friction, backlash and gain-loss models are assumptions, not measurements of real servos.
  • Some faults cannot be seen with this test. A zero offset on a vertical-axis joint changes no gravity load. Wrist offsets are below the load noise.
  • The classifier is trained on simulated single faults. With two faults it names only one.
  • The false-alarm rate depends on the healthy population. On a real arm it must be re-measured on that arm's own healthy runs.

See TECH_REPORT.md, Section 5.

Development

uv run pytest                 # fast tests (~1 min); `-m slow` for long sweeps
uv run ruff check . && uv run ruff format --check .
uv run pyright                # strict mode on src/
uv run python scripts/run_study.py --robot roarm_m3   # the study behind TECH_REPORT.md (see its Section 6)

src/armdoctor/robots/roarm_m3.xml is generated from roarm-mcp's primitive RoArm-M3 model (Apache-2.0).

License

Apache-2.0. See LICENSE.

Metadata

Release files for armdoctor 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for armdoctor 0.1.0
File Size Uploaded Provenance Actions
armdoctor-0.1.0.tar.gz 39.7 kB With provenance Details for armdoctor-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for armdoctor 0.1.0
File Interpreter ABI Platform Actions
armdoctor-0.1.0-py3-none-any.whl Python 3 none any Details for armdoctor-0.1.0-py3-none-any.whl

Total release size: 84.8 kB

Release files / armdoctor-0.1.0.tar.gz

Download URL armdoctor-0.1.0.tar.gz
Size 39.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5b2ba41141f86d79d9ea03d1b5267cb3540ace477fb99ff362b36caaf1a0ae3c
BLAKE2b-256 checksum
How to use checksums
a680dafdfc105c594786af8b9ccee41f688493bb597da35b3d0f5dd0515cc73d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / armdoctor-0.1.0-py3-none-any.whl

Download URL armdoctor-0.1.0-py3-none-any.whl
Size 45.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fc395f0499fc64299c9cdea75575d2f027565055aabdedd9cf6d22b39aa862b
BLAKE2b-256 checksum
How to use checksums
2f091093036143d2e21c53cb9063da3b3e3d62ece9016a6197d50bf7c60b5cfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for armdoctor 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for armdoctor-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page