新增统一力读数会话 ForceSession
把同帧测量、空载归零、模型推断与共用后处理收进一个 SDK 会话,Studio 显示与记录使用同一样本;旧 Sensor 读数接口保持兼容。以 force session 与受影响 SDK 套件、lint 与文档门禁验证,硬件与真实载荷精度未验证。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CpCfJF6SvonMKmPZhzKZHb
This commit is contained in:
@@ -454,6 +454,60 @@ class FingerRuntime:
|
||||
self.tactile.push_frame(unrolled, already_gray=True)
|
||||
return unrolled
|
||||
|
||||
# ------------------------------------------- session measurement seam
|
||||
def enable_measurement_session(self) -> None:
|
||||
"""Hand force readout to a ``ForceSession`` (the explicit new entry)."""
|
||||
self.tactile.raw_sensor.enable_measurement_session()
|
||||
|
||||
def disable_measurement_session(self) -> None:
|
||||
"""Return to the historical automatic model/readout path."""
|
||||
self.tactile.raw_sensor.disable_measurement_session()
|
||||
|
||||
def reset_tracker(self) -> None:
|
||||
"""Reset the tactile tracker at a frame boundary (session zeroing half)."""
|
||||
self.tactile.raw_sensor.reset_tracker()
|
||||
|
||||
def read_measurement_frame(
|
||||
self,
|
||||
source_frame,
|
||||
*,
|
||||
frame_id: int,
|
||||
timestamp_s: float | None = None,
|
||||
want_field: bool = False,
|
||||
want_contact: bool = False,
|
||||
):
|
||||
"""Unroll one source frame and measure it once, without calibration."""
|
||||
del timestamp_s # signal time is carried by the caller's FrameStamp
|
||||
self.process_frame(source_frame)
|
||||
return self.tactile.raw_sensor.measure_current_frame(
|
||||
frame_id=frame_id,
|
||||
want_field=want_field,
|
||||
want_contact=want_contact,
|
||||
)
|
||||
|
||||
def current_measurement(
|
||||
self, *, want_field: bool = False, want_contact: bool = False
|
||||
):
|
||||
"""Same-frame measurement features already produced by the pipeline (no recompute).
|
||||
|
||||
Additive: forwards to the tactile sensor's session seam so a pipeline
|
||||
consumer can hand the frame to ``ForceSession`` without a second
|
||||
unroll/flow/HHD pass.
|
||||
"""
|
||||
return self.tactile.raw_sensor.current_measurement(
|
||||
want_field=want_field, want_contact=want_contact
|
||||
)
|
||||
|
||||
@property
|
||||
def calibration_context(self):
|
||||
"""The pipeline context the open model was validated against, if any."""
|
||||
return self.tactile.raw_sensor.calibration_context
|
||||
|
||||
@property
|
||||
def calibration(self):
|
||||
"""The force calibration the open runtime holds (additive read-only accessor)."""
|
||||
return getattr(self.tactile.raw_sensor, "calibration", None)
|
||||
|
||||
def grab_and_process(self, *, color=False):
|
||||
ok, frame = self.read_source()
|
||||
if not ok:
|
||||
|
||||
Reference in New Issue
Block a user