stepinfo-3d
Compute 3D step-response metrics exactly as a reference spec and verify time-grid/indexing so saved metrics match the hidden evaluator.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- stepinfo-3d
- description
- Compute 3D step-response metrics exactly as a reference spec and verify time-grid/indexing so saved metrics match the hidden evaluator.
03 SKILL.md 正文
3D Step-Response Metrics (stepinfo_3d)
Workflow: spec-first metric compliance (not “reasonable engineering”)
- Treat
metrics_3d.jsonas spec compliance: do not invent alternative definitions for rise/settle/overshoot. - Use one canonical implementation for metric definitions; avoid “tuning with one definition, writing with another”.
- Build
time_vecfromsample_rateandmax_iter, and verify array/time alignment before computing metrics. - Compute metrics from reloaded on-disk artifacts (what the grader reads), not in-memory arrays.
- Fail fast on any mismatch between the metrics you write and the metrics recomputed from the saved artifacts.
Read references/metric_spec_reload_crosscheck.md when you must write metrics_3d.json or when local gates pass but the benchmark fails.
Skip when metrics are computed by an imported reference evaluator you can call directly (and you store its outputs unchanged).
When to Use
| Scenario | Metric to use |
|---|---|
| Pure z-step (hover, takeoff, land) | 1D stepinfo on z |
| Point-to-point flight with coupled axes | stepinfo_3d on Euclidean distance |
| Continuous path tracking (circle, figure-eight) | Neither — prefer RMS / integrated error |
1D metrics often mischaracterize diagonal flight because x/y/z corrections are coupled through tilt and thrust.
Metrics Defined
| Metric | Definition (reference) |
|---|---|
| Rise time | First time distance to target ≤ 10% of initial distance |
| Settling time | Last time distance exceeds settling_threshold × initial_distance |
| Overshoot % | Max distance from target after first entering the settling band, as % of initial distance |
| Steady-state error | Final distance from target [m] |
Implementation Logic
Given pos_actual (3, n), pos_target (3,), and time_vec (n,):
- Compute
dist[k] = ||pos_actual[:, k] − pos_target||₂. - If
dist[0]is ~0 (already at target), return zeros. - Rise time: first
time_vec[k]withdist[k] ≤ 0.1 * dist[0]. - Settling time: scan backward for last
time_vec[k]withdist[k] > settling_threshold * dist[0](defaultsettling_threshold=0.02). - Overshoot: after first entering the settling band, record
max(dist[k])for the remaining samples and normalize bydist[0]. - Steady-state error:
dist[-1].
import numpy as np
def stepinfo_3d(pos_actual: np.ndarray,
pos_target: np.ndarray,
time_vec: np.ndarray,
settling_threshold: float = 0.02) -> dict:
dist = np.linalg.norm(pos_actual - pos_target.reshape(3, 1), axis=0)
d0 = float(dist[0])
if d0 < 1e-6:
return {"RiseTime": 0.0, "SettlingTime": 0.0, "Overshoot_pct": 0.0, "SteadyStateError": 0.0}
rise_time = 0.0
for k in range(dist.size):
if dist[k] <= 0.1 * d0:
rise_time = float(time_vec[k])
break
band = settling_threshold * d0
settling_time = float(time_vec[-1])
for k in range(dist.size - 1, -1, -1):
if dist[k] > band:
settling_time = float(time_vec[k])
break
entered = np.where(dist <= band)[0]
if entered.size == 0:
overshoot = 0.0
else:
overshoot = float(np.max(dist[entered[0]:]) / d0 * 100.0)
return {
"RiseTime": rise_time,
"SettlingTime": settling_time,
"Overshoot_pct": overshoot,
"SteadyStateError": float(dist[-1]),
}
Common Pitfalls
- Validator trap: a gate script that recomputes metrics using the same non-reference logic that wrote the JSON can never detect mismatch versus the grader.
- Time-grid mismatch:
time_vecand trajectory arrays must agree on length and indexing; an off-by-one atmax_itercan silently change metrics. - Definition drift: “rise time” and “settling time” conventions vary; do not assume textbook 10–90% or “first entry and stay” unless explicitly specified.
- Schema drift: ensure JSON keys and numeric types match what the grader expects; do not rename fields or omit required ones.
04 同仓库更多 Skills
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms