added mesh surface arrows

This commit is contained in:
ykcheungab
2026-06-19 21:22:28 +08:00
parent 2e5c047d1e
commit 258948bcb7
20 changed files with 951 additions and 194 deletions
+34
View File
@@ -23,4 +23,38 @@ class FingerFrameView:
fsheary: float
centroid_found: bool
mask_coverage: float
valid_mask: np.ndarray | None = None
raw_frame: np.ndarray | None = None
@classmethod
def from_tactile(cls, tactile, unrolled, *, timestamp: float) -> FingerFrameView:
"""Build a display snapshot from tactile state (mask + fields assembled here)."""
fps, flow, vnormal, depth_map, centroid, fnormal, fshearx, fsheary = tactile.read_info(
tactile.info.FPS,
tactile.info.VRAW,
tactile.info.VNORMAL,
tactile.info.DEPTH,
tactile.info.CENTROID,
tactile.info.FNORMAL,
tactile.info.FSHEARX,
tactile.info.FSHEARY,
)
mask = tactile.valid_mask
return cls(
timestamp=timestamp,
fps=float(fps),
unrolled=unrolled,
flow=flow,
vnormal=vnormal,
depth_map=depth_map,
img=np.array([]),
contour=np.array([]),
centroid=centroid,
fnormal=float(fnormal),
fshearx=float(fshearx),
fsheary=float(fsheary),
centroid_found=bool(tactile.raw_sensor.centroid_found),
mask_coverage=float(tactile.mask_stats["coverage"]),
valid_mask=mask.copy() if mask is not None else None,
raw_frame=tactile.frame,
)