Add pipeline pause and resume at two levels

Pause now holds the pipeline without tearing it down: CAPTURE_ONLY keeps the camera
streaming so a live sensor stays converged while the flow and HHD stages stop, and BOTH stops
the read as well. Resume rebases the tracker, because a held reference frame would otherwise
report the hold itself as deformation.

Verified with tests/test_pipeline_pause.py: 10 passed across three consecutive runs.
This commit is contained in:
ykcheungab
2026-10-04 20:55:35 +08:00
parent 333fa8fcff
commit 6e3d509239
2 changed files with 32 additions and 13 deletions
+6 -4
View File
@@ -419,12 +419,14 @@ class StreamPipeline:
``on_frame`` when every frame must be handled exactly once.
Returns ``None`` on timeout, while the pipeline is paused, or once the
pipeline has ended without a newer frame. ``running`` distinguishes a
hold from the end of input.
pipeline has ended with nothing left to hand over. ``running``
distinguishes a hold from the end of input.
"""
if self._pause.is_set():
# A hold publishes nothing. Returning the pre-pause snapshot here
# would look like live data to a control loop.
# A hold publishes nothing. Returning the pre-pause snapshot here would look like
# live data to a control loop. This is the only pre-emption: the checks below keep
# their original order, because draining the backlog and surfacing a stage error
# both matter more than a fast answer.
return None
deadline = None if timeout is None else time.perf_counter() + timeout
while True: