传感器位置校准

This commit is contained in:
2026-10-14 19:48:36 +08:00
parent 1ca1bb739a
commit dc5a6f8b5a
2 changed files with 15 additions and 1 deletions
@@ -77,6 +77,7 @@ FORCES_HEADER = (
"FN_output_N",
"FX_output_N",
"FY_output_N",
"Fmag_raw",
)
FRAMES_HEADER = (
"frame_id",
@@ -109,6 +110,14 @@ ROW_BACKLOG = 8192
VIDEO_PACING_TOLERANCE = 0.5
def raw_magnitude(fn: float, fx: float, fy: float) -> float:
"""Magnitude of the three raw force components. Missing any one leaves it blank."""
values = (fn, fx, fy)
if not all(np.isfinite(value) for value in values):
return float("nan")
return float(np.sqrt(sum(value * value for value in values)))
def format_value(value: float) -> str:
"""Full-precision CSV cell. ``NaN`` means "not available" and is left empty.
@@ -1142,6 +1151,7 @@ class _SessionWriter:
format_value(sample.fn_n_processed),
format_value(sample.fx_n_processed),
format_value(sample.fy_n_processed),
format_value(raw_magnitude(sample.fn_raw, sample.fx_raw, sample.fy_raw)),
)
)