# CalibrateAnchors.srv — UWB anchor auto-calibration service (Issue #602)
#
# Request: list of anchor IDs to calibrate (minimum 4).
#          If anchor_ids is empty, the node uses all discovered anchors.
#
# Each anchor is commanded via AT+PEER_RANGE=<peer_id> to range against every
# other anchor.  The resulting N×N distance matrix is passed through classical
# MDS to recover 2-D positions.  Results are written to anchor_positions_json.
#
# Response: success flag, per-anchor [x, y, z] positions, residual RMS error,
#           and JSON string suitable for dropping into fusion_params.yaml.

# ── Request ────────────────────────────────────────────────────────────────
uint8[] anchor_ids          # IDs of anchors to calibrate (empty = auto-discover)
uint8   n_samples           # range measurements to average per pair (default 5)

---

# ── Response ───────────────────────────────────────────────────────────────
bool    success
string  message             # human-readable status / error description

uint8[]  anchor_ids         # same order as positions below
float64[] positions_x       # metres, MDS-recovered X (2-D plane)
float64[] positions_y       # metres, MDS-recovered Y
float64[] positions_z       # metres, always 0.0 (flat-floor assumption)

float64 residual_rms_m      # RMS of |D_measured - D_recovered| across all pairs
string  anchor_positions_json  # JSON: {"0": [x,y,z], "1": [x,y,z], ...}
