Skip to content

sequencerd: pick the next target when the last readout starts - #499

Closed
cfremling wants to merge 1 commit into
feat/auto-ontargetfrom
feat/sequencer-pick-at-readout
Closed

cfremling wants to merge 1 commit into
feat/auto-ontargetfrom
feat/sequencer-pick-at-readout

Conversation

@cfremling

@cfremling cfremling commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

When the last sub-exposure of a science target starts reading out, the target is completed and the next one is picked through the normal path (get_next, activate, publish, slew, acquire) while camerad reads out, so the slew and acquisition overlap the ~21 s readout. A readout gate holds every camerad command for the new target (camera settings, expose) until camerad reports READY.

  • No early pick in single-step or single-target mode, after a cancel, with a thread error set, or when the current row is a calibration; calibration blocks run as before.
  • Readouts are counted from camerad's PIXELCOUNT messages, so the count cannot run ahead of the shutter; a PIXELCOUNT from the tail of the previous readout cannot end the next target's EXPOSE wait.
  • camera_set runs in parallel with the slew and acquisition, behind the readout gate, and is joined just before the exposure; a target is never exposed unless its own camera settings were applied.
  • The flexure compensator is set just before each exposure, re-applied during the readout between sub-exposures, and before a REPEAT exposes.

Stacked on #483 (base branch feat/auto-ontarget); merges cleanly with #485.

Jira: PAL-181, PAL-152. Tested on sky 2026-10-28/29 UT using branch cf/summit-20261020: every target change in the 10:27–12:34 UT sequencerd log (17) was picked at the start of the last readout, and the compensator was set before each of the 18 exposures. All were NEXP=1, so the re-apply between sub-exposures and the REPEAT path have not run on sky.

🤖 Generated with Claude Code

When the last sub-exposure of a science target starts reading out, the
target is completed and the next one is picked through the normal path
(get_next, activate, publish, slew, acquire) while camerad reads out.
A readout gate holds every camerad command for the new target (camera
settings, expose) until camerad reports READY. There is no early pick in
single-step or single-target mode, after a cancel, with a thread error
set, or when the current row is a calibration.

Readouts are counted from camerad's PIXELCOUNT messages, so the count
cannot run ahead of the shutter; a PIXELCOUNT from the tail of the
previous readout cannot end the next target's EXPOSE wait. camera_set
runs in parallel with the slew and acquisition behind the readout gate
and is joined just before the exposure; a target is never exposed unless
its own camera settings were applied.

The flexure compensator is set just before each exposure, re-applied
during the readout between sub-exposures, and before a REPEAT exposes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T14:18:53.560637Z 124c6f7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 124c6f77ce

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sequencerd/sequence.cpp
Comment on lines +557 to +560
if ( seq.arm_readout_flag && !( readout_fraction >= 0.5 ) ) {
seq.arm_readout_flag = false;
seq.wait_state_manager.set_and_clear( {Sequencer::SEQ_WAIT_READOUT}, // set READOUT
{Sequencer::SEQ_WAIT_EXPOSE} ); // clear EXPOSE

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Let completed readouts release the exposure wait

If every received PIXELCOUNT for an exposure is at least 50%, this condition leaves SEQ_WAIT_EXPOSE set indefinitely. This can happen with a short, heavily binned readout: CArcDevice::readout() throttles intermediate callbacks to every ten 25 ms iterations and always emits a final callback at completion, so a first-half callback is not guaranteed. Losing the early UDP packets produces the same result. Although camerad subsequently publishes READY, handletopic_camerad() does not clear EXPOSE, and sequence_start() remains in its unbounded exposure wait without reaching the readout wait. Preserve the stale-message protection, but also provide a completion fallback that releases EXPOSE when the current exposure command has finished.

Useful? React with 👍 / 👎.

@cfremling

Copy link
Copy Markdown
Collaborator Author

Combined into #503 with the changes it depends on, so that every open PR applies to main on its own; its change is one commit of #503. Closing.

@cfremling cfremling closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants