Repository navigation
Retry gain and exposure until the left image sensor answers - #51
Merged
adujardin merged 1 commit intoNov 18, 2026
Merged
Conversation
tristanleduc
marked this pull request as ready for review
November 17, 2026 17:36
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
On the ZED 2 and ZED 2i, while the sensors module (
SensorCapture) streams, the left image sensor stops answering for 0.5 s to several seconds at a time. Register reads then return0xffor0x00and writes are lost, while the library reports success: gain and exposure can be silently not applied, andgetGain()/getExposure()return values such as0or95325. The right sensor is not affected.Change
Gain and exposure are accessed through one helper that only accepts the access when the sensor provably answered:
setGain()/setExposure()keep their signature and log an error if the value could not be applied.getGain()/getExposure()return a negative value instead of a wrong one. The public API is unchanged.The logic is taken from #49 (commit 1cd8f6c by @Myzhar), applied alone on top of master.
Tests
ZED 2i (camera firmware 1523), Ubuntu 22.04, kernel 6.8, USB 3. Cycle: brightness, gain and exposure on both sensors, each read back (up to 5 tries), with a thread reading the IMU and a thread timing every frame. Overnight soak, both columns run the same night, alternating.
The PR column is 13,800 cycles at HD720@30, 700 at HD1080@30 and 700 at HD2K@15; the v0.6.0 column is HD720@30. Master has the same gain and exposure code as v0.6.0 (#48 only changed the open). Separately, 100 opens with gain and exposure written right after
initializeVideo()gave 0 wrong values, and 200 cycles without the sensors module gave 0 failures.Cost: when the left sensor stays unreachable, the setting call waits for it, up to 6 s per call. Frames keep arriving while it waits. One of the seven HD2K@15 runs had frame gaps of up to 1.9 s, both during and outside these waits; the cause is not known.
Not fixed by this PR: 7 times during the night, the left sensor stopped answering for good (about once per hour of streaming). The calls then returned an error after 6 s. Closing the camera, calling
SensorCapture::resetSensorModule()and opening it again recovered it each time (7 out of 7, 10 to 15 s).Not tested: ZED 2; Ubuntu 24.04.