Repository navigation
feat(panel-lock): the panel lock also locks the joystick of a Prior stage - #832
Draft
hongquanli wants to merge 2 commits into
Draft
hongquanli wants to merge 2 commits into
hongquanli wants to merge 2 commits into
Conversation
AbstractStage.has_own_joystick() says if the stage controller has a joystick that moves the stage without Squid, and set_joystick_lock(locked) turns it off or on. A stage with no joystick of its own does nothing (the Cephla stage, whose joystick is on the control panel, and the PI focus stage). CombinedStage passes both calls to its XY and Z stages. The Prior stage has its own joystick: "H" turns it off and "J" turns it on, and the controller answers "0" to each. Any other answer, or no answer, raises SquidError. enable_joystick() and disable_joystick() (not called anywhere) now use it. The start-up "H 0" is not changed: it keeps the joystick on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0152Tv36aY3Whyz7ATrKcZX3
…tage A Prior stage controller has a joystick of its own, and nothing locked it: a hand on it moved the stage while an agent drove, during homing and at the loading position. The lock of the control panel now turns that joystick off too, for each of the three reasons, and the unlock turns it on again. _set_control_panel_lock is the one place that locks and unlocks both. For homing, the loading position and every unlock, a failure is logged and the other one is still sent. The agent session locks through the same place and waits for each confirmation: when the Prior controller does not confirm, the session is refused with "could not lock the joystick of the stage", and the joystick is turned on again (the reason is held from before the send). With agent_session_allow_unlocked_panel on and a control panel that cannot lock, the joystick of a Prior stage is still locked, and the banner says so: "The control panel is not locked: do not touch it. The joystick of the stage is locked." On a microscope with no Prior stage nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0152Tv36aY3Whyz7ATrKcZX3
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
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.
What this adds
The lock of the control panel also turns off the joystick of a stage controller that has a joystick of its own (a Prior ProScan controller), and turns it on again at the unlock.
Why
The panel lock is a command of the Cephla controller. A Prior stage controller has its own joystick, and nothing locked it. So on a microscope with a Prior XY stage, a person could move the stage with the joystick while an agent drives (#823), during homing, and at the loading position.
How it works
AbstractStage.has_own_joystick()(False by default) andAbstractStage.set_joystick_lock(locked)(does nothing by default). The Prior stage sendsH(joystick off) orJ(joystick on) and raises when the controller does not answer0. A combined stage passes the call to its XY stage and its Z stage. The window does not ask which kind of stage it has._set_control_panel_lockingui_hcs.py. It sends the Cephla panel lock as before, then the lock of the stage's joystick. The lock is counted by reason (agent session, homing, loading position), as in feat(agent-session): an agent session for the control server, with take over and hand back #823, so the end of one does not unlock under another.could not lock the joystick of the stage, and Squid turns the joystick on again. For homing and the loading position a failure is logged, as for the panel today.agent_session_allow_unlocked_panelstays about the Cephla panel only. With it on, the joystick of a Prior stage is still locked, and the banner says so.The Prior commands are from the ProScan III manual (stage commands):
Hturns the joystick off after a joystick move in progress,Jturns it on, each answers0in the standard mode, and the joystick is on at power-up.Behaviour change
Tests
tests/squid/test_prior_stage.py,tests/squid/test_stage.py: the lock and the unlock on a fake controller, an answer that is not0, no answer, a stage with no joystick, a combined stage.tests/control/test_stage_joystick_lock.py(new),tests/control/test_agent_session_protection.py: the lock for each reason, a failure of one device does not stop the command to the other, a session that is refused unlocks again, the banner texts, the refusal text.tests/control/test_HighContentScreeningGui.py, whole, in one process: 59 passed.For the bench (a Prior stage), before this merges
HandJby hand: each answers0. Check thatH 0at the start of Squid leaves the joystick on (an older firmware can take it asH). Note the firmware version.move_toover the control server, and homing (homing now locks the joystick).Hwhile the joystick is held to one side, and while a move of Squid runs: the answer must still come at once. A late answer refuses a session.Not in this pull request
squid/stage/prior.py; a merge can need a small fix there.🤖 Generated with Claude Code
https://claude.ai/code/session_0152Tv36aY3Whyz7ATrKcZX3