接入力标定 schema 3 与多点空间增益模型
保留旧格式和 cal_path,校验 SN、特征身份及坐标附件,按帧返回逐轴状态。相关测试 263 项通过,已核对存量预测并实测 180 帧录像。
This commit is contained in:
@@ -105,6 +105,17 @@ class TactileProcessor:
|
||||
def force_units(self) -> tuple[str, str, str]:
|
||||
return self._sensor.force_units
|
||||
|
||||
@property
|
||||
def calibration_status(self):
|
||||
return self._sensor.calibration_status
|
||||
|
||||
@property
|
||||
def calibration_result(self):
|
||||
return self._sensor.calibration_result
|
||||
|
||||
def set_calibration_reference(self, raw, *, reference_id):
|
||||
return self._sensor.set_calibration_reference(raw, reference_id=reference_id)
|
||||
|
||||
def push_frame(self, frame, *, already_gray=False, valid_mask=None):
|
||||
"""Feed one processed tactile frame into the analysis pipeline."""
|
||||
mask = self._default_valid_mask if valid_mask is None else valid_mask
|
||||
@@ -305,6 +316,26 @@ class FingerRuntime:
|
||||
calibration_dir=calibration_dir, device_id=device_id,
|
||||
verbose=verbose, mirror=mirror,
|
||||
)
|
||||
if getattr(getattr(sensor, "calibration", None), "schema_version", None) == 3:
|
||||
from ..calibration_context import (
|
||||
build_context,
|
||||
domain_fingerprint,
|
||||
sha256_file,
|
||||
)
|
||||
|
||||
model = sensor.calibration
|
||||
uv_map = getattr(model, "coordinate_map", None)
|
||||
if model.input_profile == "fn_delta_autocal_uv/1":
|
||||
if uv_map is None or uv_map.shape[:2] != (geometry.out_height, geometry.out_width):
|
||||
raise ValueError("calibration coordinate map does not match finger output shape")
|
||||
sensor.bind_calibration_context(build_context(
|
||||
sensor._config, sensor.filters_state(),
|
||||
geometry_sha256=sha256_file(mesh_path), source_scale=geometry.source_scale,
|
||||
coordinates=model.pipeline.get("coordinates"),
|
||||
output_domain_sha256=domain_fingerprint(domain),
|
||||
processing_backend="uv_unroll",
|
||||
preprocessing={"flip_source_vertical": flip_source_vertical, "mirror": mirror},
|
||||
))
|
||||
|
||||
capture_config = CaptureConfig.from_camera_dict(
|
||||
video,
|
||||
@@ -351,6 +382,15 @@ class FingerRuntime:
|
||||
def valid_mask(self):
|
||||
return self.frame_processor.valid_mask
|
||||
|
||||
def set_calibration_reference(self, raw, *, reference_id):
|
||||
"""Set an explicitly measured unloaded reference for this finger stream."""
|
||||
self.tactile.raw_sensor.set_calibration_reference(raw, reference_id=reference_id)
|
||||
|
||||
@property
|
||||
def calibration_status(self):
|
||||
"""Copy the current per-axis calibration validity state."""
|
||||
return dict(self.tactile.raw_sensor.calibration_status)
|
||||
|
||||
def read_source(self):
|
||||
if self.capture_source is not None and self.capture_source.running:
|
||||
return self.capture_source.read(copy=True, wait_s=1.0)
|
||||
|
||||
Reference in New Issue
Block a user