-
Notifications
You must be signed in to change notification settings - Fork 15
Updates to floco recovery and more #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Shekar V (vshekar)
wants to merge
12
commits into
NSLS2:master
Choose a base branch
from
vshekar:updates-to-floco-recovery
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d0f6f93
Fixes to floco recovery processes
vshekar ec4a675
Added more commands to update server rather than database from gui
vshekar dc0cdea
imported json and fixed function names
vshekar 513fa83
Changed how check boxes are first intialized
vshekar 116b5a3
Added unmountCold on-off functions
vshekar 37693b5
Using cam url and attaching resolution
vshekar bc5cc99
Apply suggestion from @Copilot
vshekar 18e0b29
Apply suggestion from @Copilot
vshekar d565f23
Apply suggestion from @Copilot
vshekar a13efbe
Apply suggestions from code review
vshekar 2dcd643
Added message to gui when unmount cold is toggled
vshekar 8ccbf86
Made recoverRobot and dryGripper compact
vshekar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -160,6 +160,8 @@ class ControlMain(QtWidgets.QMainWindow): | |
| lowMagCursorChangeSignal = QtCore.Signal(int, str) | ||
| cryostreamTempSignal = QtCore.Signal(object) | ||
| sampleZoomChangeSignal = QtCore.Signal(object) | ||
| gov_state_change_signal = QtCore.Signal(str) | ||
| dewar_plate_change_signal = QtCore.Signal(int) | ||
|
|
||
| def __init__(self): | ||
| super(ControlMain, self).__init__() | ||
|
|
@@ -183,6 +185,8 @@ def __init__(self): | |
| if daq_utils.beamline != "nyx": | ||
| self.albulaInterface = AlbulaInterface(ip=os.environ["EIGER_DCU_IP"], | ||
| gov_message_pv_name=daq_utils.pvLookupDict["governorMessage"],) | ||
|
|
||
| self.dewar_plate_pos_pv = PV(daq_utils.pvLookupDict["dewarPlatePos"]) | ||
| self.initUI() | ||
| self.initOphyd() | ||
| self.govStateMessagePV = PV(daq_utils.pvLookupDict["governorMessage"]) | ||
|
|
@@ -1572,15 +1576,15 @@ def createSampleTab(self): | |
|
|
||
|
|
||
| self.hutchCornerCamThread = VideoThread( | ||
| parent=self, delay=HUTCH_TIMER_DELAY, url=getBlConfig("hutchCornerCamURL") | ||
| parent=self, delay=HUTCH_TIMER_DELAY, url=getBlConfig("hutchCornerCamURL") + "?resolution=320x180" | ||
| ) | ||
| self.hutchCornerCamThread.frame_ready.connect( | ||
| lambda frame: self.updateCam(self.pixmap_item_HutchCorner, frame) | ||
| ) | ||
| self.hutchCornerCamThread.start() | ||
|
|
||
| self.hutchTopCamThread = VideoThread( | ||
| parent=self, delay=HUTCH_TIMER_DELAY, url=getBlConfig("hutchTopCamURL") | ||
| parent=self, delay=HUTCH_TIMER_DELAY, url=getBlConfig("hutchTopCamURL") + "?resolution=320x180" | ||
|
vshekar marked this conversation as resolved.
|
||
| ) | ||
| self.hutchTopCamThread.frame_ready.connect( | ||
| lambda frame: self.updateCam(self.pixmap_item_HutchTop, frame) | ||
|
|
@@ -1609,6 +1613,27 @@ def annealButtonCB(self): | |
| except: | ||
| pass | ||
|
|
||
| def manage_gov_state_change(self, state: str): | ||
| # This function reacts to changes in governor state | ||
| # Currently changes what camera angle is shown in the center | ||
| if state in ("state SE", "transition SA to SE"): | ||
| logger.info("Govstate: %s", state) | ||
| self.sampleCameraThread.updateCam("http://xf17id1b-webcam1.nsls2.bnl.local/axis-cgi/mjpg/video.cgi?resolution=640x360") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this only for AMX? |
||
| elif state in ("transition SE to TA"): | ||
| logger.info("Govstate: %s", state) | ||
| self.sampleCameraThread.updateCam("http://xf17id1b-webcam4.nsls2.bnl.local/axis-cgi/mjpg/video.cgi?resolution=640x360") | ||
| elif state in ("state TA"): | ||
| logger.info("Govstate: %s", state) | ||
| self.sampleCameraThread.updateCam(self.capture) | ||
| elif state in ("state SA"): | ||
| logger.info("Govstate: %s", state) | ||
| self.sampleCameraThread.updateCam(self.capture) | ||
|
|
||
|
|
||
| def update_dewar_plate_position(self, state: int): | ||
| position = int(state) if state else "Rotating" | ||
|
vshekar marked this conversation as resolved.
|
||
| self.dewar_plate_position_status_widget.setText(f"Plate Position: {position}") | ||
|
|
||
| def hideRastersCB(self, state): | ||
| if state == QtCore.Qt.Checked: | ||
| self.eraseRastersCB() | ||
|
|
@@ -5131,6 +5156,12 @@ def pauseButtonStateCB(self, value=None, char_value=None, **kw): | |
| pauseButtonStateVar = value | ||
| self.pauseButtonStateSignal.emit(pauseButtonStateVar) | ||
|
|
||
| def manage_gov_state_change_cb(self, value=None, char_value=None, **kw): | ||
| self.gov_state_change_signal.emit(char_value) | ||
|
|
||
| def dewar_plate_position_cb(self, value=None, char_value=None, **kw): | ||
| self.dewar_plate_change_signal.emit(value) | ||
|
|
||
| def initOphyd(self): | ||
| if daq_utils.beamline == "nyx": | ||
| # initialize devices | ||
|
|
@@ -5200,8 +5231,18 @@ def initUI(self): | |
| exitAction.setStatusTip("Exit application") | ||
| exitAction.triggered.connect(self.closeAll) | ||
| self.statusBar() | ||
| self.queue_collect_status_widget = QtWidgets.QLabel("Queue Collect: ON") | ||
| self.statusBar().setStyleSheet("QStatusBar { font-size: 14pt; }") | ||
| queue_collect_status = "ON" if getBlConfig("queueCollect") else "OFF" | ||
| self.queue_collect_status_widget = QtWidgets.QLabel(f"Queue Collect: {queue_collect_status}") | ||
| self.dewar_plate_position_status_widget = QtWidgets.QLabel(f"Plate Position: {int(self.dewar_plate_pos_pv.get())}") | ||
|
vshekar marked this conversation as resolved.
|
||
| sep = QtWidgets.QFrame() | ||
| sep.setFrameShape(QtWidgets.QFrame.VLine) | ||
| sep.setFrameShadow(QtWidgets.QFrame.Sunken) | ||
| sep.setLineWidth(1) | ||
| self.statusBar().addPermanentWidget(self.queue_collect_status_widget) | ||
| self.statusBar().addPermanentWidget(sep) | ||
| self.statusBar().addPermanentWidget(self.dewar_plate_position_status_widget) | ||
|
|
||
|
|
||
| menubar = self.menuBar() | ||
| fileMenu = menubar.addMenu("&File") | ||
|
|
@@ -5446,6 +5487,12 @@ def initCallbacks(self): | |
| self.lowMagCursorChangeSignal.connect(self.processLowMagCursorChange) | ||
| self.lowMagCursorX_pv.add_callback(self.processLowMagCursorChangeCB, ID="x") | ||
| self.lowMagCursorY_pv.add_callback(self.processLowMagCursorChangeCB, ID="y") | ||
|
|
||
| self.gov_state_change_signal.connect(self.manage_gov_state_change) | ||
| self.govStateMessagePV.add_callback(self.manage_gov_state_change_cb) | ||
|
|
||
| self.dewar_plate_change_signal.connect(self.update_dewar_plate_position) | ||
| self.dewar_plate_pos_pv.add_callback(self.dewar_plate_position_cb) | ||
|
|
||
| def popupServerMessage(self, message_s): | ||
| if self.popUpMessageInit: | ||
|
|
@@ -5455,7 +5502,38 @@ def popupServerMessage(self, message_s): | |
| if message_s == "killMessage": | ||
| return | ||
| else: | ||
| self.popupMessage.showMessage(message_s) | ||
| try: | ||
| broadcast_command = json.loads(message_s) | ||
| self.processServerCommand(broadcast_command) | ||
| except json.JSONDecodeError: | ||
| self.popupMessage.showMessage(message_s) | ||
| except Exception as e: | ||
| logger.error(f"Could not process command: {e}") | ||
|
|
||
| def processServerCommand(self, command: "dict[str, Any]"): | ||
| """ | ||
| Process a command broadcasted from the server | ||
| """ | ||
| if "highlight_cells" in command: | ||
| if self.rasterList: | ||
| raster_item: RasterGroup = self.rasterList[-1]["graphicsItem"] | ||
| raster_item.set_highlighted_cells(command["highlight_cells"]) | ||
| if "robot_online" in command: | ||
| self.staffScreenDialog.robotOnCheckBox.setChecked(command["robot_online"]) | ||
| if "enable_mount" in command: | ||
| self.staffScreenDialog.enableMountCheckBox.setChecked(command["enable_mount"]) | ||
| if "beam_check" in command: | ||
| self.staffScreenDialog.beamCheckOnCheckBox.setChecked(command["beam_check"]) | ||
| if "queue_collect" in command: | ||
| self.staffScreenDialog.queueCollectOnCheckBox.setChecked(command["queue_collect"]) | ||
| self.userScreenDialog.queueCollectOnCheckBox.setChecked(command["queue_collect"]) | ||
|
vshekar marked this conversation as resolved.
|
||
| # Update status widget and unmount-cold control based on queue_collect state | ||
| self.queue_collect_status_widget.setText( | ||
| f"Queue Collect: {'ON' if command['queue_collect'] else 'OFF'}" | ||
| ) | ||
| self.staffScreenDialog.gripperUnmountColdCheckBox.setEnabled(command["queue_collect"]) | ||
| if "unmount_cold" in command: | ||
| self.staffScreenDialog.gripperUnmountColdCheckBox.setChecked(command["unmount_cold"]) | ||
|
|
||
| def printServerMessage(self, message_s): | ||
| if self.textWindowMessageInit: | ||
|
|
||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.