Repository navigation
Drop RealSense warm-up frames before serving the first frame - #1
Merged
Merged
Conversation
After a cold pipeline start the first frames come out before auto exposure and white balance settle: a D435i's first snapshot after idle averaged luma 26 with a green cast, against 87 a few seconds later. The capture loop now publishes nothing until at least warmup_frames (default 30) and warmup_seconds (default 2) have passed, as the diagnostics path already does. latest() waits through the warm-up, describe() reports warming_up, and 0/0 restores serving the first frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkFaeNK2BNBMCEx4AWJx6t
On Windows the monotonic clock ticks about every 16 ms, so several 2 ms fake frames can share a timestamp and the fps estimate is still None right after the first frames; the two tests failed 3 of 5 runs on the camera PC before any code change. Poll until it is measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KkFaeNK2BNBMCEx4AWJx6t
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The first RealSense snapshot after the pipeline starts on demand came back dark with a green cast. Auto-exposure and white balance had not settled yet. On the UR5e D435i (serial 050222072123, 1280x720@15), the cold snapshot had mean luma 26, while frames taken a few seconds later had mean luma 87.
Change
warmup_framesframes (default 30) and at leastwarmup_secondsseconds (default 2). This is the same rule the diagnostics path already used. Both values can be set per camera, are clamped to 0-300 frames and 0-10 s, and setting both to 0 disables the warm-up.latest()waits through the warm-up on top offrame_timeout_ms, so the first request after idle gets a settled frame instead of a 503 or a dark image. It is about 2 s slower. If the pipeline stops during the wait, it raisesRealSenseNotStreaming.describe()reportswarming_up.fps_measuredinstead of reading it straight after the first frames. The Windows monotonic clock ticks about every 16 ms, so several 2 ms fake frames can share a timestamp; these tests failed 3 of 5 runs on the camera PC before this change.Testing
pytest: 172 tests pass locally, three times on the Windows camera PC, and on both CI runners. NewTestWarmupcases cover the defaults, clamping, skipped frame count, waiting longer than the frame timeout, warming up again after a restart, and stopping during warm-up.🤖 Generated with Claude Code
https://claude.ai/code/session_01KkFaeNK2BNBMCEx4AWJx6t