Record each ZED camera's read-back exposure, gain and white balance per episode - #741
Record each ZED camera's read-back exposure, gain and white balance per episode#741v-positronic wants to merge 1 commit into
Conversation
…er episode The frames of an episode are kept, so any pixel statistic can be computed later. The exposure time, the gain and the white-balance temperature that the camera's automatic control chose are lost when the episode ends. This change records them. `SLCamera` reads the values back from the SDK once per `state_period_sec` (default 1 s) and emits them on a new `state` signal. The values come from `get_camera_settings`, so they are what the camera runs at, not the configured set points. The two `auto_*` flags say whether the values beside them are the camera's own choice. `Embodiment` gains `recorded`: signals the recorder writes and the policy never reads. The DROID embodiment lists each camera's state there, so an episode carries `camera_state.<camera>.exposure`, `.gain`, `.white_balance_temperature`, `.auto_exposure` and `.auto_white_balance` as scalar signals. The recorder's opening turn writes the value each camera holds at episode start; the samples during the episode follow at the period. Ticket: Positronic-Robotics/internal#1298 #refs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 963978071c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| 'exposure': 'EXPOSURE', | ||
| 'gain': 'GAIN', | ||
| 'white_balance_temperature': 'WHITEBALANCE_TEMPERATURE', | ||
| 'auto_exposure': 'AEC_AGC', |
There was a problem hiding this comment.
Name the combined exposure/gain flag accurately
Rule misleading-name violated:
auto_exposure records the SDK's combined AEC_AGC setting, so datasets hide that this flag also determines whether the recorded gain is automatic; name the signal auto_exposure_gain (or otherwise include both concepts) and update the expected dataset key.
AGENTS.md reference: AGENTS.md:L7-L8
Useful? React with 👍 / 👎.
| CAMERA_STATE_SETTINGS = { | ||
| 'exposure': 'EXPOSURE', | ||
| 'gain': 'GAIN', | ||
| 'white_balance_temperature': 'WHITEBALANCE_TEMPERATURE', | ||
| 'auto_exposure': 'AEC_AGC', | ||
| 'auto_white_balance': 'WHITEBALANCE_AUTO', |
There was a problem hiding this comment.
Store the SDK settings as enum members
Rule primitive-type violated:
CAMERA_STATE_SETTINGS represents the closed sl.VIDEO_SETTINGS domain as strings and converts every value with getattr; store the enum members directly in the mapping and pass them to get_camera_settings, updating the fake-backed tests accordingly.
AGENTS.md reference: AGENTS.md:L7-L8
Useful? React with 👍 / 👎.
| if clock.now() >= next_state_read: | ||
| self.state.emit(read_camera_state(zed)) | ||
| next_state_read = clock.now() + self._state_period_sec |
There was a problem hiding this comment.
Remove the complexity suppression from the touched loop
Rule grandfathered-violation violated:
The new state-read conditional adds another branch inside SLCamera.run, which is already hidden by the enclosing # noqa: C901; extract the state polling and enough camera-loop work into focused helpers so run passes the complexity check and the suppression can be removed.
AGENTS.md reference: AGENTS.md:L7-L8
Useful? React with 👍 / 👎.
Implements Positronic-Robotics/internal#1298.
The frames of an episode are kept, so any pixel statistic can be computed later. The exposure time, the gain and the white-balance temperature that the camera's automatic control chose are lost when the episode ends. This change records them.
What changes
SLCamera(drivers/camera/zed.py) reads the values back from the SDK withget_camera_settingsonce perstate_period_sec(default 1 s) and emits them on a newstatesignal. The values are what the camera runs at, not the configured set points. The twoauto_*flags record whether the values beside them are the camera's own choice. A setting the SDK refuses is left out.Embodimentgains arecordedfield: signals the recorder writes and the policy never reads.wire._recorderrecords them.cfg/embodiment.py) lists each camera's state there. An episode carries five scalar signals per camera:camera_state.<camera>.exposure,.gain,.white_balance_temperature,.auto_exposure,.auto_white_balance(keys.camera_state,Serializers.camera_state).How the three readings of the ask land
state_period_sec.Left out on purpose
recordedentry. The ZED X One is opened assl.CameraOne, and I did not verify itsget_camera_settingson a rig.rollouts/console) needs only the positronic pin moved; the report reads nothing from these signals yet.Tests
drivers/camera/tests/test_zed.pyreads the state against a fake camera, with apyzedstand-in installed by the newconftest.pywhere the SDK is absent.policy/tests/test_harness.py: arecordedsignal reaches the recorder under its own name and no harness observation.positronic/policy/tests/test_harness.py,test_golden_pipeline.py,dataset/tests/test_ds_writer_agent.py,drivers/camera/tests— 115 passed.The rules check was skipped for this first pass; it is due before merge.