fix: 按复位请求目标确认参考版本并隔离复位状态

防止在途旧帧提前触发归零,并保留旧 reset 用法。SDK 101 项针对性回归与 lint 通过。
This commit is contained in:
ykcheungab
2026-10-20 20:33:23 +08:00
parent ee830d8505
commit c256870ee2
8 changed files with 477 additions and 60 deletions
+10
View File
@@ -65,6 +65,16 @@ session = ForceSession(
基线未完成、无效帧、窗口不足或已取消时 N 为 `NaN`、状态显式;窗口不足不越界补帧。
录像重算用 `replay_window=(start, end)` 在声明区间执行同一操作。
三级流水线已有同帧测量时,用 `process_measurement(row, stamp, tracker_reset_seq=...)`
传入快照自带的参考版本,不读流水线的实时计数。外部归零先调用
`target = pipeline.request_reset()`,再调用
`request_zero_external_reset(reference_id=..., declared_unloaded=True, target_reference_version=target)`。
`target` 为正整数,帧版本达到它才开始采样;较早复位后已在途的帧不能确认本次请求。
未被 flow 领取的请求合并为同一目标,领取后的新请求另分配目标;共用目标的复位与归零只确认一次。
该接缝尚未发布,本轮将原 `tracker_reset_seq` 请求参数改为明确的目标版本参数;
逐帧输入仍用 `tracker_reset_seq`。已发布 `Sensor.reset()` / `StreamPipeline.reset()` 用法不变。
实现见 `pipeline.py`、`force_session.py`,回归见 `tests/test_pipeline.py`、`tests/test_force_session.py`。
## 后处理与有效设置
`OutputSettings(sample_rate_hz, median_window=1, lowpass_hz=0.0, lowpass_order=2,
+13 -3
View File
@@ -165,6 +165,16 @@ compute the same numbers.
## Resetting the reference
Both backends process externally supplied frames through the same profile. After a gap in the
input - a pause, a seek, a scene change - call `session.reset()`. It is queued to the stage that
owns the tracker, so the reference frame is rebased on the frame about to be computed rather than
on a buffer the pipeline is still reading.
input - a pause, a seek, a scene change - call `session.reset()`. It is queued to the stages that
own the sensor state, so the reference frame is rebased on the frame about to be computed rather
than on a buffer the pipeline is still reading: the flow stage resets the image/tracker state and
bumps the reference version, and the HHD stage resets the force/readout state (filters, contact
flags, calibration session) on the first frame carrying the new version, before decomposing it.
`FrameSnapshot.tracker_reset_seq` is the version that frame was measured with.
When driving `StreamPipeline` directly, call `target = pipeline.request_reset()` to obtain the
future reference version reserved by that request. Confirm it only when a snapshot carries
`tracker_reset_seq >= target`; the current output frame can trail an earlier reset and cannot
identify a new request. Requests share a target until flow claims it; a later request gets a new
target even while the earlier reset is still being applied. The existing `reset()` returns `None`.
Regression coverage lives in `tests/test_pipeline.py` (request coalescing and reset-in-progress).