Skip to content

sequencerd, camerad: slew to the next target during the readout; stop and abort an NEXP>1 series - #508

Open
cfremling wants to merge 3 commits into
mainfrom
feat/sequencer-slew-during-readout
Open

cfremling wants to merge 3 commits into
mainfrom
feat/sequencer-slew-during-readout

Conversation

@cfremling

@cfremling cfremling commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Merge after #507. This PR includes #507's commit underneath, because both change the same readout code. When #507 has been merged with "Create a merge commit", this PR shows only its own two commits and merges normally. If #507 was squash-merged instead, this PR shows a conflict; ask Christoffer to update it.

  1. sequencerd: pick the next target when the last readout starts. 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. 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. camera_set runs in parallel with the slew and acquisition behind the gate and is joined just before the exposure; a target is never exposed unless its own camera settings were applied. camerad: READY comes a few ms before the last frame's FITS write ends, so a binning change or DMA remap now waits up to 2 s for a finishing write before refusing.
  2. camerad, sequencerd: stop and abort an NEXP>1 series. stop is accepted for the whole series of the current target (not for the previous target's last readout after a pick) and no longer clears a cancel; camerad ends the series after the frame in progress, cut short if it is integrating with 5 s or more left. abort no longer starts the next sub-exposure.

Both change the readout wait and stop_exposure, which #507 also changes; that is why this PR is built on it.

Rebuild, restart sequencerd and camerad. Check: "last readout of under way: completing it and picking the next target" at each target change; seq stop during an NEXP>1 series ends it after the current frame.

Tested on sky using branch cf/summit-20261030 on 2026-11-03: 22 target changes were picked at the start of the previous target's last readout, the slew overlapping the ~21 s readout. The NEXP>1 stop/abort path was not needed that night.

Jira: PAL-181, PAL-142.

🤖 Generated with Claude Code

cfremling and others added 3 commits November 5, 2026 10:33
flexure_set ran in parallel with the slew, so flexured computed the
compensation from telescope telemetry read mid-slew, for the previous
pointing, and it was never refreshed during an NEXP>1 series or before
a REPEAT.

For a target the telescope slews to, the compensator is now set after
acquisition and the target offset, in parallel with the slit move, and
joined before the exposure. When the telescope stays where it is (a
calibration, or a repeat of the same pointing) it is set with the other
workers, as before. During an NEXP>1 series it is re-applied in the
readout between sub-exposures, only while that readout is running and
the next shutter has not opened, with fresh, finite TCS telemetry and no
thread error; a failure is reported and otherwise ignored. A REPEAT sets
it once camera_set has seen camerad ready.

Readouts are counted from camerad's shutter reports and PIXELCOUNT
messages, so the count cannot run ahead of the shutter. abort waits up
to 20 s (was 5 s) for the sequence to exit, since the readout wait may
be inside a flexured call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

camerad: READY is published when the last frame has arrived, a few ms
before its FITS write ends, so a camera setting sent right after READY
was refused (write in progress). A binning change or DMA remap now
waits up to 2 s for a finishing write before refusing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
stop: the sequencer accepts it for the whole series of the current
target (the EXPOSE wait covers only the first sub-exposure; camerad not
READY covers the rest, except the previous target's last readout after
a pick) and no longer clears a cancel. camerad ends the series after
the frame in progress, cut short if it is integrating with 5 s or more
left, instead of starting the next sub-exposure. abort no longer starts
the next sub-exposure either. A cancelled exposure's remaining
PIXELCOUNT messages cannot set the READOUT wait later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

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 ⚠️ Failed 2026-11-05T19:22:31.316636Z
We couldn’t complete this review. Comment @codex review to try again.
f51c3b5 Draft marked ready
ℹ️ 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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

This branch has not been deployed

No deployments
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