update sensor bench

This commit is contained in:
ykcheungab
2026-09-01 11:14:56 +08:00
parent ef3ee84a68
commit 8cacb12abc
55 changed files with 4032 additions and 323 deletions
+20
View File
@@ -0,0 +1,20 @@
"""Force calibration coefficients and plot defaults from Orisys viewer2d."""
from __future__ import annotations
# Linear FN → Newtons (y = mx + c), from orisys examples/gui/sensors/adapter.py.
NORMAL_FORCE_CAL_SLOPE = 3.92685554668795e-05
NORMAL_FORCE_CAL_OFFSET = 0.0217596967278535
# PyQtGraph force-curve tuning from examples/gui/viewer2d/backend.py.
FORCE_SAMPLE_RATE_HZ = 30.0
PLOT_BUFFER_POINTS = 120
PLOT_WINDOW_SEC = PLOT_BUFFER_POINTS / FORCE_SAMPLE_RATE_HZ
Y_AXIS_MIN_SPAN = 20000.0
Y_RANGE_ALPHA = 0.5
LOWPASS_CUTOFF_HZ = 10.0
def calibrate_normal_force(raw_value: float) -> float:
"""Convert raw normal-force reading to Newtons using y = mx + c."""
return NORMAL_FORCE_CAL_SLOPE * float(raw_value) + NORMAL_FORCE_CAL_OFFSET