This commit is contained in:
+52
-27
@@ -1,37 +1,62 @@
|
||||
#Tue Jan 26 15:55:46 CET 2021
|
||||
#Thu Aug 15 14:00:07 CEST 2024
|
||||
autoSaveScanData=true
|
||||
simulation=false
|
||||
commandExecutionEvents=false
|
||||
logDaysToLive=30
|
||||
createSessionFiles=true
|
||||
dataLayout=table
|
||||
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
|
||||
dataProvider=txt
|
||||
dataScanFlushRecords=true
|
||||
dataScanLazyTableCreation=false
|
||||
dataScanPreserveTypes=false
|
||||
dataScanReleaseRecords=false
|
||||
dataScanSaveOutput=false
|
||||
userAuthenticator=
|
||||
logLevelConsole=Off
|
||||
scanStreamerPort=-1
|
||||
dataScanSaveScript=false
|
||||
dataScanSaveSetpoints=false
|
||||
parallelInitialization=false
|
||||
versionTrackingManual=true
|
||||
hostName=null
|
||||
userManagement=false
|
||||
instanceName=X06DA
|
||||
dataScanSaveTimestamps=false
|
||||
dataServerPort=-1
|
||||
hideServerMessages=true
|
||||
serverPort=8080
|
||||
versionTrackingEnabled=true
|
||||
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
|
||||
serverEnabled=true
|
||||
dataScanReleaseRecords=false
|
||||
dataTransferMode=Off
|
||||
dataTransferPath=
|
||||
dataTransferUser=
|
||||
depthDimension=0
|
||||
dataScanPreserveTypes=false
|
||||
disableDataFileLogs=false
|
||||
disableEmbeddedAttributes=false
|
||||
fdaSerialization=false
|
||||
filePermissionsConfig=Default
|
||||
filePermissionsData=Default
|
||||
filePermissionsLogs=Default
|
||||
filePermissionsScripts=Default
|
||||
hideServerMessages=true
|
||||
hostName=null
|
||||
instanceName=X06DA
|
||||
logDaysToLive=30
|
||||
logLevel=Fine
|
||||
dataScanFlushRecords=true
|
||||
logLevelConsole=Off
|
||||
logPath={logs}/{date}_{time}
|
||||
dataLayout=table
|
||||
terminalEnabled=false
|
||||
notificationLevel=null
|
||||
terminalPort=3579
|
||||
createSessionFiles=true
|
||||
versionTrackingLogin={context}/svcusr-hlapp_robot
|
||||
versionTrackingRemote=git@git.psi.ch\:tell/x06da.git
|
||||
dataProvider=txt
|
||||
noBytecodeFiles=false
|
||||
notificationLevel=Off
|
||||
notifiedTasks=
|
||||
parallelInitialization=false
|
||||
pythonHome=
|
||||
saveCommandStatistics=true
|
||||
saveConsoleSessionFiles=false
|
||||
scanStreamerPort=-1
|
||||
serverEnabled=true
|
||||
serverPort=8080
|
||||
sessionHandling=Off
|
||||
simulation=false
|
||||
terminalEnabled=false
|
||||
terminalPort=3579
|
||||
userAuthenticator=
|
||||
userManagement=false
|
||||
versionTrackingEnabled=true
|
||||
versionTrackingLogin={context}/svcusr-hlapp_robot
|
||||
versionTrackingManual=true
|
||||
versionTrackingRemote=git@git.psi.ch\:tell/x06da.git
|
||||
xscanAppendSuffix=true
|
||||
xscanContinuousUpdate=false
|
||||
xscanCrlogicAbortable=true
|
||||
xscanCrlogicChannel=null
|
||||
xscanCrlogicIoc=null
|
||||
xscanCrlogicPrefix=null
|
||||
xscanCrlogicSimulated=false
|
||||
xscanMoveTimeout=600
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
cryostage=ch.psi.pshell.epics.Motor|X06DA-ES-CJ:TRX1|||true
|
||||
img=ch.psi.pshell.prosilica.Prosilica|204464 "PacketSize=1504;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=290;RegionY=130;Width=1000;Height=1000;MulticastEnable=Off"||-200|false
|
||||
#img=ch.psi.pshell.prosilica.Prosilica|25001|||true
|
||||
#gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8ea5e463.psi.ch/axis-cgi/mjpg/video.cgi?camera=1 reopen||-200|false
|
||||
#monitoring_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8ea5e463.psi.ch/axis-cgi/mjpg/video.cgi?camera=2 reopen||-200|
|
||||
#top_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8ea5e463.psi.ch/axis-cgi/mjpg/video.cgi?camera=3 true||-200|
|
||||
@@ -25,7 +25,7 @@ smc_magnet_status=ch.psi.pshell.modbus.DigitalInput|wago 10||1000|
|
||||
smc_mounted_1=ch.psi.pshell.modbus.DigitalInput|wago 11||1000|
|
||||
smc_mounted_2=ch.psi.pshell.modbus.DigitalInput|wago 12||1000|
|
||||
magnet_release=ch.psi.pshell.modbus.DigitalInput|wago 13||500|
|
||||
detector_cleared=ch.psi.pshell.modbus.DigitalInput|wago 14||1000|
|
||||
#detector_cleared=ch.psi.pshell.modbus.DigitalInput|wago 14||1000|
|
||||
guiding_tool_park=ch.psi.pshell.modbus.DigitalInput|wago 15||1000|
|
||||
#spare_di_4=ch.psi.pshell.modbus.DigitalInput|wago 16||1000|
|
||||
relays=ch.psi.pshell.modbus.DigitalOutputArray|wago 0 16||1000|
|
||||
@@ -57,6 +57,6 @@ led_ctrl_2=ch.psi.pshell.modbus.ProcessVariable|wago 1|||
|
||||
led_ctrl_3=ch.psi.pshell.modbus.ProcessVariable|wago 2|||
|
||||
smc_current=ch.psi.pshell.modbus.ProcessVariable|wago 3|||
|
||||
#th2e=ch.psi.pshell.modbus.ModbusTCP|129.129.110.200|||
|
||||
#temperature=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 1||10000|
|
||||
#humidity=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 5||10000|
|
||||
#temperature=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 1||10000|false
|
||||
#humidity=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 5||10000|false
|
||||
#dew_point=ch.psi.pshell.modbus.ReadonlyProcessVariable|th2e 9||10000|
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
MXSC-1.10.0\ -\ Back.jar=disabled
|
||||
MXSC-1.14.0.jar=disabled
|
||||
MXSC-1.15.0.jar=disabled
|
||||
Commands.java=disabled
|
||||
Recovery.java=disabled
|
||||
MXSC-1.10.0.jar=disabled
|
||||
WagoPanel.java=enabled
|
||||
LaserUEPanel.java=enabled
|
||||
BarcodeReaderPanel.java=enabled
|
||||
@@ -10,7 +10,7 @@ HexiposiPanel.java=enabled
|
||||
MjpegSource2.java=enabled
|
||||
LN2.java=disabled
|
||||
Hexiposi.java=disabled
|
||||
RobotPanel.java=enabled
|
||||
RobotPanel.java=disabled
|
||||
SmartMagnetConfig.java=disabled
|
||||
SmartMagnetPanel.java=enabled
|
||||
LaserUE.java=enabled
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
{
|
||||
"fontShellPanel" : {
|
||||
"name" : "Lucida Console",
|
||||
"style" : 0,
|
||||
"size" : 11
|
||||
},
|
||||
"fontShellCommand" : {
|
||||
"name" : "SansSerif",
|
||||
"style" : 0,
|
||||
"size" : 13
|
||||
},
|
||||
"fontOutput" : {
|
||||
"name" : "Lucida Console",
|
||||
"style" : 0,
|
||||
"size" : 11
|
||||
},
|
||||
"fontEditor" : {
|
||||
"name" : "Lucida Console",
|
||||
"style" : 0,
|
||||
"size" : 11
|
||||
},
|
||||
"fontPlotLabel" : {
|
||||
"name" : "SansSerif",
|
||||
"style" : 0,
|
||||
"size" : 11
|
||||
},
|
||||
"fontPlotTick" : {
|
||||
"name" : "SansSerif",
|
||||
"style" : 0,
|
||||
"size" : 10
|
||||
},
|
||||
"fontPlotTitle" : {
|
||||
"name" : "SansSerif",
|
||||
"style" : 1,
|
||||
"size" : 13
|
||||
},
|
||||
"fontTerminal" : {
|
||||
"name" : "Consolas",
|
||||
"style" : 0,
|
||||
"size" : 14
|
||||
},
|
||||
"tabSize" : 4,
|
||||
"contentWidth" : 0,
|
||||
"editorBackground" : null,
|
||||
"editorForeground" : null,
|
||||
"simpleEditor" : false,
|
||||
"hideEditorLineNumbers" : false,
|
||||
"hideEditorContextMenu" : false,
|
||||
"consoleLocation" : "Left",
|
||||
"dataPanelLocation" : null,
|
||||
"openDataFilesInDocTab" : false,
|
||||
"noVariableEvaluationPropagation" : false,
|
||||
"processingScripts" : [ ],
|
||||
"asyncViewersUpdate" : true,
|
||||
"asyncHistoryPlotsUpdate" : false,
|
||||
"scanPlotDisabled" : false,
|
||||
"scanTableDisabled" : false,
|
||||
"cachedDataPanel" : false,
|
||||
"dataExtensions" : "",
|
||||
"dataSubFiles" : "",
|
||||
"hideFileName" : false,
|
||||
"showEmergencyStop" : false,
|
||||
"showHomingButtons" : false,
|
||||
"showJogButtons" : false,
|
||||
"hideScanPanel" : false,
|
||||
"hideOutputPanel" : false,
|
||||
"showXScanFileBrowser" : false,
|
||||
"showQueueBrowser" : false,
|
||||
"backgroundRendering" : false,
|
||||
"showImageStatusBar" : true,
|
||||
"persistRendererWindows" : true,
|
||||
"defaultRendererColormap" : "Grayscale",
|
||||
"linePlot" : "ch.psi.pshell.plot.LinePlotJFree",
|
||||
"matrixPlot" : "ch.psi.pshell.plot.MatrixPlotJFree",
|
||||
"surfacePlot" : "null",
|
||||
"timePlot" : "ch.psi.pshell.plot.TimePlotJFree",
|
||||
"plotsDetached" : false,
|
||||
"plotsHidden" : false,
|
||||
"plotLayout" : "Vertical",
|
||||
"quality" : "High",
|
||||
"defaultPlotColormap" : "Temperature",
|
||||
"markerSize" : 2,
|
||||
"plotBackground" : null,
|
||||
"gridColor" : null,
|
||||
"outlineColor" : null,
|
||||
"disableOffscreenBuffer" : false,
|
||||
"defaultPanels" : [ {
|
||||
"deviceClassName" : "ch.psi.pshell.epics.Scaler",
|
||||
"panelClassName" : "ch.psi.pshell.swing.ScalerPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.epics.Scienta",
|
||||
"panelClassName" : "ch.psi.pshell.swing.ScientaPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.Motor",
|
||||
"panelClassName" : "ch.psi.pshell.swing.MotorPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.MasterPositioner",
|
||||
"panelClassName" : "ch.psi.pshell.swing.MasterPositionerPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.ProcessVariable",
|
||||
"panelClassName" : "ch.psi.pshell.swing.ProcessVariablePanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.MotorGroup",
|
||||
"panelClassName" : "ch.psi.pshell.swing.MotorGroupPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.DiscretePositioner",
|
||||
"panelClassName" : "ch.psi.pshell.swing.DiscretePositionerPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.Camera",
|
||||
"panelClassName" : "ch.psi.pshell.swing.CameraPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.Slit",
|
||||
"panelClassName" : "ch.psi.pshell.swing.SlitPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.HistogramGenerator",
|
||||
"panelClassName" : "ch.psi.pshell.swing.HistogramGeneratorPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.bs.Stream",
|
||||
"panelClassName" : "ch.psi.pshell.swing.StreamPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.bs.StreamChannel",
|
||||
"panelClassName" : "ch.psi.pshell.swing.StreamChannelPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.camserver.CamServerStream",
|
||||
"panelClassName" : "ch.psi.pshell.swing.CamServerStreamPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.camserver.CamServerService",
|
||||
"panelClassName" : "ch.psi.pshell.swing.CamServerServicePanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.device.ReadonlyRegister",
|
||||
"panelClassName" : "ch.psi.pshell.swing.DeviceValueChart"
|
||||
}, {
|
||||
"deviceClassName" : "RobotSC",
|
||||
"panelClassName" : "RobotPanel"
|
||||
}, {
|
||||
"deviceClassName" : "BarcodeReader",
|
||||
"panelClassName" : "BarcodeReaderPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.mxsc.PuckDetection",
|
||||
"panelClassName" : "PuckDetectionPanel"
|
||||
}, {
|
||||
"deviceClassName" : "ch.psi.pshell.modbus.ModbusTCP",
|
||||
"panelClassName" : "WagoPanel"
|
||||
}, {
|
||||
"deviceClassName" : "LaserUE",
|
||||
"panelClassName" : "LaserUEPanel"
|
||||
} ],
|
||||
"scriptPopupDialog" : "None"
|
||||
}
|
||||
+15
-16
@@ -1,20 +1,19 @@
|
||||
#Wed Dec 01 14:00:32 CET 2021
|
||||
#Wed Sep 11 16:12:29 CEST 2024
|
||||
barcode_reader_scan_pucks=false
|
||||
beamline_status_enabled=false
|
||||
cold_position_timeout=3600
|
||||
dry_mount_counter=0
|
||||
mounted_sample_position=X11
|
||||
room_temperature_enabled=false
|
||||
dry_timestamp=1.69564645367E9
|
||||
force_dry_mount_count=4
|
||||
force_dry_timeout=27000
|
||||
imaging_enabled=true
|
||||
led_level=0.0
|
||||
pin_cleaner_timer=60
|
||||
pin_offset=-0.0
|
||||
puck_types=true
|
||||
pin_cleaner_timer=60
|
||||
imaging_enabled=false
|
||||
dry_timestamp=1.638363632386E9
|
||||
roi_h=1000
|
||||
led_level=0.0
|
||||
beamline_status_enabled=false
|
||||
force_dry_mount_count=1
|
||||
roi_y=123
|
||||
barcode_reader_scan_pucks=false
|
||||
cold_position_timeout=3600
|
||||
force_dry_timeout=2700
|
||||
roi_w=1000
|
||||
roi_h=400
|
||||
roi_w=600
|
||||
roi_x=289
|
||||
valve_control=false
|
||||
roi_y=123
|
||||
room_temperature_enabled=false
|
||||
valve_control=true
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#Tue Sep 17 15:06:05 CEST 2019
|
||||
#Thu Aug 15 14:00:07 CEST 2024
|
||||
configFile={config}/config.properties
|
||||
configFileDevices={config}/devices.properties
|
||||
configFilePlugins={config}/plugins.properties
|
||||
configFileSessions={config}/sessions.properties
|
||||
configFileSettings={config}/settings.properties
|
||||
configFileTasks={config}/tasks.properties
|
||||
configFileVariables={config}/variables.properties
|
||||
configPath={home}/config
|
||||
consoleSessionsPath={sessions}/console
|
||||
contextPath={outp}/context
|
||||
dataPath={outp}/data
|
||||
devicesPath={home}/devices
|
||||
@@ -14,7 +16,10 @@ imagesPath={outp}/images
|
||||
libraryPath={script}; {script}/Lib
|
||||
logPath={outp}/log
|
||||
pluginsPath={home}/plugins
|
||||
queuePath={script}
|
||||
scriptPath={home}/script
|
||||
scriptType=py
|
||||
sessionsPath={outp}/sessions
|
||||
userSessionsPath={sessions}/user
|
||||
wwwPath={home}/www
|
||||
xscanPath={script}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
tasks/LedMonitoring=120
|
||||
tasks/ColdPositionTimeout=300
|
||||
tasks/LedMonitoring=120.0;120.0
|
||||
tasks/ColdPositionTimeout=300.0;300.0
|
||||
#tasks/Reinit=30.0;30.0
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
#Mon Sep 27 14:34:33 CEST 2021
|
||||
FileSequentialNumber=236
|
||||
#Thu Aug 15 14:25:40 CEST 2024
|
||||
DaySequentialNumber=4
|
||||
FileSequentialNumber=269
|
||||
LastRunDate=240815
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Tue Nov 30 15:12:06 CET 2021
|
||||
#Thu Jan 20 14:10:37 CET 2022
|
||||
detection=Mechanical
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Tue Dec 01 08:46:40 CET 2020
|
||||
#Thu Jan 20 14:12:27 CET 2022
|
||||
detection=Mechanical
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Thu Sep 19 08:23:48 CEST 2019
|
||||
#Wed Sep 13 14:42:38 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 14:28:32 CEST 2020
|
||||
#Wed Sep 13 14:42:28 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 10:51:15 CEST 2020
|
||||
#Wed Sep 13 14:42:25 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 10:51:19 CEST 2020
|
||||
#Wed Sep 13 14:42:21 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 10:51:24 CEST 2020
|
||||
#Wed Sep 13 14:42:18 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 10:51:29 CEST 2020
|
||||
#Wed Sep 13 14:42:14 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 11:31:09 CEST 2020
|
||||
#Wed Sep 13 14:42:10 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 10:51:39 CEST 2020
|
||||
#Wed Sep 13 14:42:07 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 10:51:44 CEST 2020
|
||||
#Wed Sep 13 14:42:03 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 10:51:47 CEST 2020
|
||||
#Wed Sep 13 14:41:59 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#Fri Aug 14 10:51:50 CEST 2020
|
||||
#Wed Sep 13 14:41:55 CEST 2023
|
||||
detection=Mechanical
|
||||
disabled=true
|
||||
disabled=false
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#Wed Jun 27 10:48:14 CEST 2018
|
||||
#Thu Aug 15 14:11:16 CEST 2024
|
||||
description=null
|
||||
maxValue=NaN
|
||||
minValue=NaN
|
||||
offset=0.0
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
#Mon Jul 26 08:33:12 CEST 2021
|
||||
offset=0.0
|
||||
maxValue=60.0
|
||||
rotation=false
|
||||
precision=5
|
||||
scale=1.0
|
||||
estbilizationDelay=0
|
||||
maxSpeed=NaN
|
||||
resolution=0.0025
|
||||
homingType=None
|
||||
startRetries=1
|
||||
minValue=-3.0
|
||||
unit=mm
|
||||
#Thu Aug 15 14:00:10 CEST 2024
|
||||
defaultSpeed=5.0
|
||||
description=null
|
||||
estbilizationDelay=0
|
||||
hasEnable=false
|
||||
sign_bit=0
|
||||
monitorByPosition=false
|
||||
homingType=None
|
||||
maxSpeed=NaN
|
||||
maxValue=60.0
|
||||
minSpeed=1.0
|
||||
minValue=-3.0
|
||||
monitorByPosition=false
|
||||
offset=0.0
|
||||
precision=5
|
||||
resolution=0.0025
|
||||
rotation=false
|
||||
scale=1.0
|
||||
sign_bit=0
|
||||
startRetries=1
|
||||
unit=mm
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#Tue Jan 22 10:58:09 CET 2019
|
||||
#Thu Aug 15 14:00:10 CEST 2024
|
||||
description=null
|
||||
offset=0.0
|
||||
precision=2
|
||||
scale=0.0032
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#Wed Sep 04 15:28:07 CEST 2024
|
||||
colormap=Grayscale
|
||||
colormapAutomatic=true
|
||||
colormapLogarithmic=false
|
||||
colormapMax=NaN
|
||||
colormapMin=NaN
|
||||
flipHorizontally=false
|
||||
flipVertically=false
|
||||
grayscale=false
|
||||
invert=false
|
||||
rescaleFactor=1.0
|
||||
rescaleOffset=0.0
|
||||
roiHeight=-1
|
||||
roiWidth=-1
|
||||
roiX=0
|
||||
roiY=0
|
||||
rotation=0.0
|
||||
rotationCrop=false
|
||||
scale=1.0
|
||||
spatialCalOffsetX=NaN
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
spatialCalUnits=mm
|
||||
transpose=false
|
||||
+22
-19
@@ -1,24 +1,27 @@
|
||||
#Wed Oct 30 16:03:50 CET 2019
|
||||
spatialCalOffsetY=-482.0
|
||||
invert=false
|
||||
#Tue Aug 27 15:22:44 CEST 2024
|
||||
colormap=Grayscale
|
||||
colormapAutomatic=true
|
||||
colormapLogarithmic=false
|
||||
colormapMax=18.133
|
||||
colormapMin=6.4
|
||||
spatialCalOffsetX=-476.0
|
||||
rotation=90.5119714057
|
||||
flipHorizontally=false
|
||||
flipVertically=false
|
||||
grayscale=false
|
||||
imageHeight=0
|
||||
imageWidth=0
|
||||
invert=false
|
||||
rescaleFactor=1.0
|
||||
rescaleOffset=0.0
|
||||
roiHeight=-1
|
||||
roiWidth=-1
|
||||
roiX=0
|
||||
roiY=0
|
||||
rotation=0.0
|
||||
rotationCrop=true
|
||||
scale=1.0
|
||||
rescaleFactor=1.0
|
||||
grayscale=false
|
||||
spatialCalOffsetX=NaN
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
spatialCalUnits=mm
|
||||
flipVertically=false
|
||||
roiHeight=964
|
||||
spatialCalScaleX=0.49344173073372655
|
||||
spatialCalScaleY=0.48738915251539194
|
||||
flipHorizontally=false
|
||||
colormapAutomatic=false
|
||||
colormapMax=18.133
|
||||
roiY=17
|
||||
roiX=25
|
||||
rescaleOffset=0.0
|
||||
roiWidth=952
|
||||
transpose=false
|
||||
colormap=Grayscale
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#Wed Dec 01 08:50:46 CET 2021
|
||||
#Thu Aug 15 14:00:10 CEST 2024
|
||||
description=null
|
||||
maxValue=0.4
|
||||
minValue=0.0
|
||||
unit=V
|
||||
offset=0.0
|
||||
maxValue=1.0
|
||||
precision=2
|
||||
sign_bit=0
|
||||
scale=3.0E-4
|
||||
resolution=NaN
|
||||
scale=3.0E-4
|
||||
sign_bit=0
|
||||
unit=V
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#Wed Dec 01 08:50:46 CET 2021
|
||||
#Thu Aug 15 14:00:10 CEST 2024
|
||||
description=null
|
||||
maxValue=0.4
|
||||
minValue=0.0
|
||||
unit=V
|
||||
offset=0.0
|
||||
maxValue=1.0
|
||||
precision=2
|
||||
sign_bit=0
|
||||
scale=3.0E-4
|
||||
resolution=NaN
|
||||
scale=3.0E-4
|
||||
sign_bit=0
|
||||
unit=V
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#Wed Dec 01 08:50:46 CET 2021
|
||||
#Thu Aug 15 14:00:10 CEST 2024
|
||||
description=null
|
||||
maxValue=0.4
|
||||
minValue=0.0
|
||||
unit=V
|
||||
offset=0.0
|
||||
maxValue=1.0
|
||||
precision=2
|
||||
sign_bit=0
|
||||
scale=3.0E-4
|
||||
resolution=NaN
|
||||
scale=3.0E-4
|
||||
sign_bit=0
|
||||
unit=V
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#Tue Jun 19 16:41:24 CEST 2018
|
||||
#Thu Aug 15 14:04:07 CEST 2024
|
||||
description=null
|
||||
maxValue=NaN
|
||||
minValue=NaN
|
||||
offset=0.0
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#Tue Jun 19 16:41:20 CEST 2018
|
||||
#Thu Aug 15 14:00:10 CEST 2024
|
||||
description=null
|
||||
offset=-25.81632
|
||||
precision=2
|
||||
scale=0.003888
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#Wed Jan 30 11:33:15 CET 2019
|
||||
#Thu Aug 15 14:00:10 CEST 2024
|
||||
description=null
|
||||
maxValue=70.0
|
||||
minValue=-50.0
|
||||
offset=0.0
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#Tue Jun 19 16:45:06 CEST 2018
|
||||
#Thu Aug 15 14:00:10 CEST 2024
|
||||
description=null
|
||||
offset=0.0
|
||||
precision=2
|
||||
scale=0.003
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2018 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
*/
|
||||
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.plot.TimePlotBase;
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
import sys
|
||||
import time
|
||||
import argparse
|
||||
import socket
|
||||
from bsread.sender import sender, PUSH, PUB
|
||||
from typing import Optional, Tuple
|
||||
from logging import getLogger
|
||||
from vmbpy import *
|
||||
from flask import Flask, request, jsonify
|
||||
import threading
|
||||
|
||||
_logger = getLogger(__name__)
|
||||
|
||||
|
||||
def can_bind_to_port(port, host='0.0.0.0'):
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||
try:
|
||||
# Attempt to bind to the host and port
|
||||
sock.bind((host, port))
|
||||
return True # If binding is successful, the port is available
|
||||
except OSError:
|
||||
return False # If an OSError occurs, the port is not available
|
||||
|
||||
|
||||
class VmbPyStreamServer():
|
||||
def __init__(self, id=None, port=None, alloc=None, start = None):
|
||||
self.id = id
|
||||
self.port = port if port else 9000
|
||||
self.alloc = AllocationMode.AllocAndAnnounceFrame if alloc else AllocationMode.AnnounceFrame
|
||||
self.camera = None
|
||||
self.handler_exception = None
|
||||
self.exit_cmd = False
|
||||
self.start_streaming = True if (start or (start is None)) else None
|
||||
if self.port > 0:
|
||||
if not can_bind_to_port(self.port):
|
||||
raise Exception(f"Stream port {self.port} is not free")
|
||||
|
||||
def open_camera(self, camera_id: Optional[str]) -> Camera:
|
||||
self.camera = None
|
||||
self.handler_exception = None
|
||||
with VmbSystem.get_instance() as vmb:
|
||||
if camera_id:
|
||||
try:
|
||||
return vmb.get_camera_by_id(camera_id)
|
||||
except VmbCameraError:
|
||||
abort('Failed to access Camera \'{}\'. Abort.'.format(camera_id))
|
||||
else:
|
||||
cams = vmb.get_all_cameras()
|
||||
if not cams:
|
||||
abort('No Cameras accessible. Abort.')
|
||||
return cams[0]
|
||||
|
||||
def init_camera(self):
|
||||
#cam.set_pixel_format(PixelFormat.BayerGR8)
|
||||
self.camera.set_pixel_format(PixelFormat.Mono8)
|
||||
# Try to adjust GeV packet size. This Feature is only available for GigE - Cameras.
|
||||
try:
|
||||
stream = self.camera.get_streams()[0]
|
||||
stream.GVSPAdjustPacketSize.run()
|
||||
while not stream.GVSPAdjustPacketSize.is_done():
|
||||
pass
|
||||
except (AttributeError, VmbFeatureError):
|
||||
pass
|
||||
|
||||
def get_camera_features(self, readonly=True, readwrite=True):
|
||||
if self.camera is None:
|
||||
raise Exception("No camera instantiated")
|
||||
features = self.camera.get_all_features()
|
||||
pars = {}
|
||||
for f in features:
|
||||
try:
|
||||
name, v, (r, w) = f.get_name(), f.get(), f.get_access_mode()
|
||||
ro, rw = not w, w
|
||||
if (readonly and ro) or (readwrite and rw):
|
||||
if type(v) is EnumEntry:
|
||||
pars[name] = str(v)
|
||||
else:
|
||||
pars[name] = v
|
||||
except:
|
||||
pass
|
||||
return pars
|
||||
|
||||
def get_camera_feature(self,name):
|
||||
pars = self.get_camera_features()
|
||||
if name in pars:
|
||||
return pars[name]
|
||||
else:
|
||||
raise Exception( f"Invalid parameter: {name}")
|
||||
|
||||
def set_camera_feature(self, name, value):
|
||||
feature = self.camera.get_feature_by_name(name)
|
||||
feature.set(value)
|
||||
|
||||
def start_stream(self, publisher):
|
||||
def frame_handler(cam: Camera, stream: Stream, frame: Frame):
|
||||
try:
|
||||
fmt = frame.get_pixel_format()
|
||||
if fmt == PixelFormat.Mono8:
|
||||
arr = frame.as_numpy_ndarray()
|
||||
else:
|
||||
arr = frame.convert_pixel_format(PixelFormat.Mono8).as_numpy_ndarray()
|
||||
arr = arr[:, :, 0]
|
||||
data = {"image": arr}
|
||||
publisher.send(data=data, pulse_id=None, timestamp=time.time(), check_data=True)
|
||||
cam.queue_frame(frame)
|
||||
except Exception as e:
|
||||
self.handler_exception = e
|
||||
|
||||
if not self.is_streaming():
|
||||
self.camera.start_streaming(handler=frame_handler,
|
||||
buffer_count=10,
|
||||
allocation_mode=self.alloc)
|
||||
|
||||
def stop_stream(self):
|
||||
if self.is_streaming():
|
||||
self.camera.stop_streaming()
|
||||
|
||||
def is_streaming(self):
|
||||
return self.camera.is_streaming()
|
||||
|
||||
def set_streaming(self, value):
|
||||
if value!= self.is_streaming():
|
||||
self.start_streaming = value
|
||||
|
||||
def run(self, retry=False):
|
||||
while True:
|
||||
try:
|
||||
self.camera = None
|
||||
self.handler_exception = None
|
||||
with sender(queue_size=10, port=self.port, mode=PUB, start_pulse_id=1,
|
||||
data_header_compression=None) as publisher:
|
||||
with VmbSystem.get_instance():
|
||||
with self.open_camera(self.id) as self.camera:
|
||||
self.init_camera()
|
||||
_logger.info(f"Connected to {self.camera}")
|
||||
try:
|
||||
while True:
|
||||
if self.start_streaming is not None:
|
||||
if self.start_streaming:
|
||||
self.start_stream(publisher)
|
||||
else:
|
||||
self.stop_stream()
|
||||
self.start_streaming = None
|
||||
if self.handler_exception is not None:
|
||||
raise self.handler_exception
|
||||
time.sleep(0.1)
|
||||
if self.exit_cmd:
|
||||
break
|
||||
finally:
|
||||
self.stop_stream()
|
||||
except Exception as e:
|
||||
_logger.exception(e)
|
||||
if not retry or self.exit_cmd:
|
||||
break
|
||||
time.sleep(3.0)
|
||||
_logger.info("Restarting")
|
||||
|
||||
def start(self):
|
||||
self.thread = threading.Thread(target=self.run, daemon=True)
|
||||
self.thread.start()
|
||||
|
||||
def exit(self):
|
||||
_logger.info(f"Received exit command")
|
||||
self.exit_cmd = True
|
||||
|
||||
|
||||
class VmbPyConfigServer():
|
||||
def __init__(self, stream_server, port=None):
|
||||
self.stream_server = stream_server
|
||||
self.port = port if port else 9010
|
||||
if self.port>0:
|
||||
if not can_bind_to_port(self.port):
|
||||
raise Exception(f"Config port {self.port} is not free")
|
||||
|
||||
def run(self):
|
||||
if self.port > 0:
|
||||
app = Flask(__name__)
|
||||
@app.route('/api/parameters', methods=['GET'])
|
||||
def get_parameters():
|
||||
def str_to_bool(val):
|
||||
return not str(val).lower() in ('false', '1', 'no')
|
||||
try:
|
||||
ro = str_to_bool(request.args.get("ro", True))
|
||||
rw = str_to_bool(request.args.get("rw", True))
|
||||
return jsonify(self.stream_server.get_camera_features(ro, rw))
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 404
|
||||
|
||||
# Route to get a specific parameter
|
||||
@app.route('/api/parameters/<name>', methods=['GET'])
|
||||
def get_parameter(name):
|
||||
try:
|
||||
value = self.stream_server.get_camera_feature(name)
|
||||
return jsonify({name: value})
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 404
|
||||
|
||||
# Route to update a specific parameter
|
||||
@app.route('/api/parameters/<name>', methods=['PUT'])
|
||||
def update_parameter(name):
|
||||
try:
|
||||
pars = self.stream_server.get_camera_features(False, True)
|
||||
if name in pars:
|
||||
new_value = request.json.get('value')
|
||||
self.stream_server.set_camera_feature(name, new_value)
|
||||
updated_value = self.stream_server.get_camera_feature(name)
|
||||
return jsonify({name: updated_value})
|
||||
else:
|
||||
return jsonify({"error": f"Not a writable parameter: {name}"}), 404
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 404
|
||||
|
||||
@app.route('/api/streaming', methods=['GET'])
|
||||
def get_streaming():
|
||||
try:
|
||||
return jsonify({"value": self.stream_server.is_streaming()})
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 404
|
||||
|
||||
# Route to update a specific parameter
|
||||
@app.route('/api/streaming', methods=['PUT'])
|
||||
def update_streaming():
|
||||
try:
|
||||
self.stream_server.set_streaming(request.json.get('value'))
|
||||
return jsonify({"value": self.stream_server.is_streaming()})
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 404
|
||||
|
||||
@app.route('/api/exit', methods=['GET'])
|
||||
def exit():
|
||||
self.stream_server.exit()
|
||||
return jsonify({"exit": "ok"})
|
||||
|
||||
app.run(host='0.0.0.0', port=self.port, debug=False, use_reloader=False)
|
||||
|
||||
def start(self):
|
||||
self.thread = threading.Thread(target=self.run, daemon=True)
|
||||
self.thread.start()
|
||||
|
||||
def print_preamble():
|
||||
print('///////////////////////////////////////')
|
||||
print('/// VmbPy Camera Server ///')
|
||||
print('///////////////////////////////////////\n')
|
||||
|
||||
def abort(reason: str, return_code: int = 1, usage: bool = False):
|
||||
print(reason + '\n')
|
||||
sys.exit(return_code)
|
||||
|
||||
def parse_args():
|
||||
usage = None
|
||||
desc=None
|
||||
epilog=None
|
||||
parser = argparse.ArgumentParser(usage=usage, description=desc, prefix_chars='--', epilog=epilog)
|
||||
parser.add_argument("-i", "--id", help="Camera ID (default first camera)", required=False)
|
||||
parser.add_argument("-p", "--port", help="Output stream port (default 9000)", required=False)
|
||||
parser.add_argument("-c", "--config", help="Config port (default 9010, -1 for disabling config interface)", required=False)
|
||||
parser.add_argument("-a", "--alloc", action='store_true', help="Alloc frames", required=False)
|
||||
parser.add_argument("-s", "--start", action='store_true', help="Start streaming (default true)", default= True, required=False)
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
print_preamble()
|
||||
args = parse_args()
|
||||
stream_server = VmbPyStreamServer(args.id, args.port, args.alloc, args.start)
|
||||
config_server = VmbPyConfigServer(stream_server, args.config)
|
||||
config_server.start()
|
||||
stream_server.run(retry=True)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
#args = ["-h"]
|
||||
#sys.argv = sys.argv + args
|
||||
main()
|
||||
@@ -0,0 +1,27 @@
|
||||
def start_camera_server():
|
||||
python_name = "{home}/../anaconda3/envs/py38/python.exe"
|
||||
script_name = "{home}/script/cpython/VmbPyServer.py"
|
||||
python_name = expand_path(python_name)
|
||||
script_name = expand_path(script_name)
|
||||
print("Starting camera Server")
|
||||
r=exec_cpython(script_name, python_name = python_name)
|
||||
fork(start_camera_server)
|
||||
|
||||
|
||||
img_stream = Stream("img_stream","localhost:9000", SocketType.SUB)
|
||||
img_stream.createMatrix = True
|
||||
img_stream.initialize()
|
||||
img_stream.start()
|
||||
#show_panel(img_stream)
|
||||
def add_img(img_stream):
|
||||
img_stream.waitCacheChange(0)
|
||||
if (img_stream.state == State.Busy) and (get_context().state.isActive()):
|
||||
add_device(img_stream.getChild("image"), True)
|
||||
img = RegisterMatrixSource("img", image)
|
||||
#img = RegisterArraySource("img", image)
|
||||
#img.config.imageWidth = image.shape[0]
|
||||
#img.config.imageHeight = image.shape[1]
|
||||
add_device(img, True)
|
||||
|
||||
|
||||
fork((add_img, (img_stream,)))
|
||||
@@ -0,0 +1,6 @@
|
||||
python_name = "{home}/../anaconda3/envs/py38/python.exe"
|
||||
script_name = "{home}/script/cpython/VmbPyServer.py"
|
||||
python_name = expand_path(python_name)
|
||||
script_name = expand_path(script_name)
|
||||
|
||||
r=exec_cpython(script_name, python_name = python_name)
|
||||
@@ -19,10 +19,18 @@ class Hexiposi(DiscretePositionerBase):
|
||||
self.timeout = 3.0
|
||||
self.offline = False
|
||||
|
||||
def doInitialize(self):
|
||||
super(Hexiposi, self).doInitialize()
|
||||
self.val = self._posNameToIndex(self.doReadReadback())
|
||||
|
||||
def doInitialize(self):
|
||||
super(Hexiposi, self).doInitialize()
|
||||
retries = 3
|
||||
for retry in range(retries):
|
||||
try:
|
||||
self.val = self._posNameToIndex(self.doReadReadback())
|
||||
return
|
||||
except:
|
||||
if retry>=(retries-1):
|
||||
raise
|
||||
time.sleep(3.0)
|
||||
|
||||
def get_response(self, response):
|
||||
if (response.status_code!=200):
|
||||
raise Exception (response.text)
|
||||
@@ -186,7 +194,7 @@ class Hexiposi(DiscretePositionerBase):
|
||||
dev = Hexiposi("hexiposi", "myriotell6d")
|
||||
|
||||
#If no Rotation Lid is mounted set it to simulated
|
||||
#dev.setSimulated()
|
||||
dev.setSimulated()
|
||||
|
||||
add_device(dev, True)
|
||||
hexiposi.polling=1000
|
||||
|
||||
@@ -49,7 +49,7 @@ class SmartMagnet(DeviceBase):
|
||||
def get_supress(self):
|
||||
return smc_sup_det.read()
|
||||
|
||||
def check_mounted(self, idle_time =1.0, timeout = -1, interval = 0.01):
|
||||
def check_mounted(self, idle_time =1.0, timeout = -1, interval = 0.1):
|
||||
self.assert_status()
|
||||
start = time.time()
|
||||
last = None
|
||||
@@ -64,10 +64,12 @@ class SmartMagnet(DeviceBase):
|
||||
else:
|
||||
if det is not None:
|
||||
if (time.time()-settling_timestamp > idle_time):
|
||||
print "got result " + str(det)
|
||||
return det
|
||||
if timeout >= 0:
|
||||
if (time.time() - start) > timeout:
|
||||
raise Exception("Timeout waiting for Smart Magnet detection.")
|
||||
print "smc trying hard: det=" + str(det) + " last="+str(last)
|
||||
time.sleep(interval)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,287 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
|
||||
class VmbCamera (CameraBase):
|
||||
def __init__(self, name, config_url="localhost:9010", stream_url="localhost:9000", image_name=None):
|
||||
CameraBase.__init__(self,name)
|
||||
self.config_url = config_url
|
||||
self.base_url = "http://" + config_url + "/api"
|
||||
self.data_type = None
|
||||
self.color_mode= None
|
||||
|
||||
|
||||
self.stream_url = stream_url
|
||||
self.stream= Stream(name + "_stream",stream_url, SocketType.SUB)
|
||||
self.stream.createMatrix = True
|
||||
self.register = None
|
||||
self.image = None
|
||||
self.image_name = image_name if image_name else name + "_image"
|
||||
|
||||
|
||||
def _get_response(self, response, is_json=True):
|
||||
if response.status_code != 200:
|
||||
raise Exception(response.text)
|
||||
return json.loads(response.text) if is_json else response.text
|
||||
|
||||
|
||||
def read_parameters(self):
|
||||
return self._get_response(requests.get(url=self.base_url + "/parameters"))
|
||||
|
||||
def read_parameter(self, name):
|
||||
return self._get_response(requests.get(url=self.base_url + "/parameters/"+name))[name]
|
||||
|
||||
def write_parameter(self, name, value):
|
||||
return self._get_response(requests.put(url=self.base_url + "/parameters/"+name, json={"value": value}))
|
||||
|
||||
def doInitialize(self):
|
||||
#super(SourceBase, self).doInitialize()
|
||||
self.stream.initialize()
|
||||
self.stream.start()
|
||||
|
||||
def init_img():
|
||||
try:
|
||||
self.stream.waitCacheChange(0)
|
||||
if (self.stream.state == State.Busy) and (get_context().state.isActive()):
|
||||
self.register = self.stream.getChild("image")
|
||||
self.image = RegisterMatrixSource(self.image_name , self.register)
|
||||
#self.image = RegisterArraySource(name, )
|
||||
#self.image.config.imageWidth =self.register.shape[0]
|
||||
#self.image.config.imageHeight = self.register.shape[1]
|
||||
log("Successful VmbCamera Initialization")
|
||||
self.setState(State.Ready)
|
||||
except Exception as e:
|
||||
log(str(e))
|
||||
fork(init_img)
|
||||
self.setState(State.Disabled)
|
||||
|
||||
def add_img_device(self):
|
||||
def add_dev_task():
|
||||
try:
|
||||
self.waitStateNot(State.Disabled, -1)
|
||||
if (self.stream.state == State.Busy) and (get_context().state.isActive()):
|
||||
add_device(self.image, True)
|
||||
log("Added VmbCamera image device")
|
||||
except Exception as e:
|
||||
log(str(e))
|
||||
fork(add_dev_task)
|
||||
|
||||
def getInfo(self):
|
||||
try:
|
||||
pars = self.read_parameters()
|
||||
return pars["DeviceModelName"] + " - uid: " + pars["DeviceID"]
|
||||
except:
|
||||
return ""
|
||||
|
||||
def getSensorSize(self):
|
||||
pars = self.read_parameters()
|
||||
return [pars["SensorWidth"], pars["SensorHeight"]]
|
||||
|
||||
def setBinningX(self, value):
|
||||
self.write_parameter("BinningHorizontal", value)
|
||||
|
||||
def getBinningX(self):
|
||||
return self.read_parameter("BinningHorizontal")
|
||||
|
||||
def setBinningY(self, value):
|
||||
self.write_parameter("BinningVertical", value)
|
||||
|
||||
def getBinningY(self):
|
||||
return self.read_parameter("BinningVertical")
|
||||
|
||||
def setROI(self, x, y, w, h):
|
||||
self.write_parameter("OffsetX", 0)
|
||||
self.write_parameter("OffsetY", 0)
|
||||
self.write_parameter("Height", h)
|
||||
self.write_parameter("Width", w)
|
||||
self.write_parameter("OffsetX", x)
|
||||
self.write_parameter("OffsetY", y)
|
||||
|
||||
def getROI(self):
|
||||
pars = self.read_parameters()
|
||||
return [pars["OffsetX"], pars["OffsetY"], pars["Width"], pars["Height"]]
|
||||
|
||||
def setGain(self, value):
|
||||
self.write_parameter("GainRaw", value);
|
||||
|
||||
def getGain(self):
|
||||
return self.read_parameter("GainRaw");
|
||||
|
||||
def setDataType(self, data_type):
|
||||
self.data_type = data_type;
|
||||
self.setPixelFormat();
|
||||
|
||||
def getDataType(self):
|
||||
if self.data_type:
|
||||
return self.data_type
|
||||
fmt = self.read_parameter("PixelFormat")
|
||||
if fmt in ("Mono8", "Bayer8"):
|
||||
return Camera.DataType.UInt8
|
||||
if fmt in ("Mono16", "Bayer16"):
|
||||
return Camera.DataType.UInt16
|
||||
if fmt in ("Rgb24", "Brg24"):
|
||||
return Camera.DataType.UInt24
|
||||
if fmt in ("Rgba32", "Brga32"):
|
||||
return Camera.DataType.UInt32
|
||||
return None
|
||||
|
||||
def setPixelFormat(self):
|
||||
pixelFormat = None
|
||||
if not self.color_mode:
|
||||
self.color_mode = self.getColorMode()
|
||||
if not self.color_mode:
|
||||
raise IOException("Invalid color mode")
|
||||
if self.data_type is None:
|
||||
self.data_type = self.getDataType();
|
||||
if self.data_type is None:
|
||||
raise IOException("Invalid data type")
|
||||
if self.color_mode == Camera.ColorMode.Mono:
|
||||
pixelFormat = "Mono"
|
||||
elif self.color_mode == Camera.ColorMode. RGB1:
|
||||
pixelFormat = "Rgb"
|
||||
elif self.color_mode == Camera.ColorMode.RGB2:
|
||||
pixelFormat = "Brg"
|
||||
elif self.color_mode == Camera.ColorMode. RGB3:
|
||||
pixelFormat = "Bayer"
|
||||
|
||||
size =self.data_type.getSize()
|
||||
if size==1:
|
||||
pixelFormat += "8"
|
||||
elif size== 2:
|
||||
pixelFormat += "16"
|
||||
elif size==3:
|
||||
pixelFormat += "24"
|
||||
elif size==4:
|
||||
pixelFormat += "a32"
|
||||
self.write_parameter("PixelFormat", pixelFormat);
|
||||
|
||||
|
||||
def setColorMode(self, mode):
|
||||
self.color_mode = mode;
|
||||
self.setPixelFormat();
|
||||
|
||||
def getColorMode(self):
|
||||
if self.color_mode:
|
||||
return self.color_mode
|
||||
fmt = self.read_parameter("PixelFormat")
|
||||
if fmt in ("Mono8", "Mono16"):
|
||||
return Camera.ColorMode.Mono
|
||||
if fmt in ("Rgb24", "Rgba32"):
|
||||
return Camera.ColorMode.RGB1
|
||||
if fmt in ("Brga24", "Brga32"):
|
||||
return Camera.ColorMode.RGB2
|
||||
if fmt in ("Bayer8", "Bayer16"):
|
||||
return Camera.ColorMode.RGB3
|
||||
return None
|
||||
|
||||
def getImageSize(self):
|
||||
pars = self.read_parameters()
|
||||
return [pars["Width"], pars["Height"]]
|
||||
|
||||
def setExposure(self, value):
|
||||
self.write_parameter("ExposureTimeAbs", int(value * 1000))
|
||||
|
||||
def getExposure(self):
|
||||
return float(self.read_parameter("ExposureTimeAbs"))/1000
|
||||
|
||||
def setAcquirePeriod(self, value):
|
||||
self.write_parameter("AcquisitionFrameRateAbs", 1000.0 / value)
|
||||
|
||||
def getAcquirePeriod(self):
|
||||
return 1000.0 / self.read_parameter("AcquisitionFrameRateAbs")
|
||||
|
||||
def setNumImages(self, value):
|
||||
self.write_parameter("AcquisitionFrameCount", value)
|
||||
|
||||
def getNumImages(self):
|
||||
return self.read_parameter("AcquisitionFrameCount")
|
||||
|
||||
def setIterations(self, value):
|
||||
pass
|
||||
|
||||
def getIterations (self):
|
||||
return 1;
|
||||
|
||||
def getImagesComplete(self):
|
||||
return 0
|
||||
|
||||
def setGrabMode(self, value):
|
||||
if value==Camera.GrabMode.Continuous:
|
||||
mode = "Continuous"
|
||||
elif value==Camera.GrabMode.Single:
|
||||
mode = "SingleFrame"
|
||||
elif value==Camera.GrabMode.Multiple:
|
||||
mode = "MultiFrame"
|
||||
else:
|
||||
raise IOException("Not supported mode: ", str(value))
|
||||
self.write_parameter("AcquisitionMode", mode)
|
||||
|
||||
|
||||
def getGrabMode(self):
|
||||
mode = self.read_parameter("AcquisitionMode")
|
||||
if mode == "Continuous":
|
||||
return Camera.GrabMode.Continuous
|
||||
elif mode == "SingleFrame":
|
||||
return Camera.GrabMode.Single
|
||||
elif mode == "MultiFrame":
|
||||
return Camera.GrabMode.Multiple
|
||||
return None
|
||||
|
||||
def setTriggerMode(self, value):
|
||||
if value == Camera.TriggerMode.Free_Run:
|
||||
triggerMode = "Freerun";
|
||||
elif value == Camera.TriggerMode.External:
|
||||
triggerMode = "SyncIn1"
|
||||
elif value == Camera.TriggerMode.Software:
|
||||
triggerMode = "Software"
|
||||
elif value == Camera.TriggerMode.Fixed_Rate:
|
||||
triggerMode = "FixedRate"
|
||||
else:
|
||||
return
|
||||
self.write_parameter("TriggerSource", triggerMode);
|
||||
|
||||
def getTriggerMode(self):
|
||||
mode = self.read_parameter("TriggerSource")
|
||||
if mode == "Freerun":
|
||||
return Camera.TriggerMode.Free_Run
|
||||
if mode == "SyncIn1":
|
||||
return Camera.TriggerMode.External
|
||||
if mode == "Software":
|
||||
return Camera.TriggerMode.Software
|
||||
if mode == "FixedRate":
|
||||
return Camera.TriggerMode.Fixed_Rate
|
||||
return None
|
||||
|
||||
def trigger(self):
|
||||
pass
|
||||
|
||||
def doStart(self):
|
||||
self._get_response(requests.put(url=self.base_url + "/streaming", json={"value": True}))
|
||||
|
||||
def doStop(self):
|
||||
self._get_response(requests.put(url=self.base_url + "/streaming", json={"value": False}))
|
||||
|
||||
def getStarted(self):
|
||||
return self._get_response(requests.get(url=self.base_url + "/streaming"))["value"]
|
||||
|
||||
|
||||
def start_camera_server():
|
||||
try:
|
||||
python_name = "{home}/../anaconda3/envs/py38/python.exe"
|
||||
script_name = "{home}/script/cpython/VmbPyServer.py"
|
||||
python_name = expand_path(python_name)
|
||||
script_name = expand_path(script_name)
|
||||
print("Starting camera Server")
|
||||
r=exec_cpython(script_name, python_name = python_name)
|
||||
log("Start camera server = ret: " + str(e))
|
||||
except Exception as e:
|
||||
log(str(e))
|
||||
|
||||
fork(start_camera_server)
|
||||
|
||||
c = VmbCamera("cam", image_name="image")
|
||||
add_device(c, True)
|
||||
add_device(c.stream, True)
|
||||
c.add_img_device()
|
||||
|
||||
|
||||
@@ -154,6 +154,17 @@ def get_pin_cleaner():
|
||||
"""
|
||||
return valve_7.read()
|
||||
|
||||
def get_valves_states():
|
||||
return [
|
||||
valve_1.read(),
|
||||
valve_2.read(),
|
||||
valve_3.read(),
|
||||
valve_4.read(),
|
||||
valve_5.read(),
|
||||
valve_6.read(),
|
||||
valve_7.read(),
|
||||
valve_8.read(),
|
||||
]
|
||||
|
||||
monitor_pin_cleaner_task = None
|
||||
|
||||
|
||||
+413
-413
@@ -1,442 +1,442 @@
|
||||
###################################################################################################
|
||||
# Deployment specific global definitions - executed after startup.py
|
||||
###################################################################################################
|
||||
import traceback
|
||||
from ch.psi.pshell.serial import TcpDevice
|
||||
from ch.psi.pshell.modbus import ModbusTCP
|
||||
import ch.psi.mxsc.Controller as Controller
|
||||
import ch.psi.pshell.core.Nameable as Nameable
|
||||
import ch.psi.utils.Chrono as Chrono
|
||||
import ch.psi.mxsc.Controller as Controller
|
||||
|
||||
|
||||
|
||||
run("setup/Layout")
|
||||
###################################################################################################
|
||||
# Deployment specific global definitions - executed after startup.py
|
||||
###################################################################################################
|
||||
import traceback
|
||||
from ch.psi.pshell.serial import TcpDevice
|
||||
from ch.psi.pshell.modbus import ModbusTCP
|
||||
import ch.psi.mxsc.Controller as Controller
|
||||
import ch.psi.pshell.core.Nameable as Nameable
|
||||
import ch.psi.utils.Chrono as Chrono
|
||||
import ch.psi.mxsc.Controller as Controller
|
||||
|
||||
|
||||
|
||||
run("setup/Layout")
|
||||
run("data/reports")
|
||||
|
||||
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Configuration
|
||||
###################################################################################################
|
||||
|
||||
IMAGING_ENABLED_PREFERENCE = "imaging_enabled"
|
||||
PUCK_TYPES_PREFERENCE = "puck_types"
|
||||
BARCODE_READER_SCAN_PUCKS = "barcode_reader_scan_pucks"
|
||||
ROOM_TEMPERATURE_ENABLED_PREFERENCE = "room_temperature_enabled"
|
||||
BEAMLINE_STATUS_ENABLED_PREFERENCE = "beamline_status_enabled"
|
||||
VALVE_CONTROL_ENABLED_PREFERENCE = "valve_control"
|
||||
|
||||
def is_imaging_enabled():
|
||||
setting = get_setting(IMAGING_ENABLED_PREFERENCE)
|
||||
return not (str(setting).lower() == 'false')
|
||||
|
||||
def set_imaging_enabled(value):
|
||||
set_setting(IMAGING_ENABLED_PREFERENCE, (True if value else False) )
|
||||
|
||||
def assert_imaging_enabled():
|
||||
if is_imaging_enabled() == False:
|
||||
raise Exception ("Imaging is disabled")
|
||||
|
||||
#"unipuck", "minispine" or "mixed"
|
||||
def set_puck_types(value):
|
||||
set_setting(PUCK_TYPES_PREFERENCE, True if value else False )
|
||||
|
||||
def get_puck_types():
|
||||
setting = get_setting(PUCK_TYPES_PREFERENCE)
|
||||
if setting == "unipuck" or setting == "minispine":
|
||||
return setting
|
||||
return "mixed"
|
||||
|
||||
|
||||
def is_barcode_reader_scan_pucks():
|
||||
setting = get_setting(BARCODE_READER_SCAN_PUCKS)
|
||||
return False if setting is None else setting.lower() == "true"
|
||||
|
||||
def set_barcode_reader_scan_pucks(value):
|
||||
set_setting(BARCODE_READER_SCAN_PUCKS, True if value else False )
|
||||
|
||||
def is_valve_controlled():
|
||||
setting = get_setting(VALVE_CONTROL_ENABLED_PREFERENCE)
|
||||
return False if setting is None else setting.lower() == "true"
|
||||
|
||||
def set_valve_controlled(value):
|
||||
set_setting(VALVE_CONTROL_ENABLED_PREFERENCE, True if value else False )
|
||||
|
||||
def reset_mounted_sample_position():
|
||||
set_setting("mounted_sample_position", None)
|
||||
|
||||
|
||||
def get_puck_barcode_reader():
|
||||
if is_barcode_reader_scan_pucks():
|
||||
return barcode_reader
|
||||
else:
|
||||
return barcode_reader_puck
|
||||
|
||||
#In order to apply current config
|
||||
set_imaging_enabled(is_imaging_enabled())
|
||||
set_puck_types(get_puck_types())
|
||||
set_barcode_reader_scan_pucks(is_barcode_reader_scan_pucks())
|
||||
set_valve_controlled(is_valve_controlled())
|
||||
|
||||
|
||||
force_dry_mount_count = get_setting("force_dry_mount_count")
|
||||
if force_dry_mount_count is None:
|
||||
set_setting("force_dry_mount_count", 0)
|
||||
|
||||
force_dry_timeout = get_setting("force_dry_timeout")
|
||||
if force_dry_timeout is None:
|
||||
set_setting("force_dry_timeout", 0)
|
||||
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Configuration
|
||||
###################################################################################################
|
||||
|
||||
IMAGING_ENABLED_PREFERENCE = "imaging_enabled"
|
||||
PUCK_TYPES_PREFERENCE = "puck_types"
|
||||
BARCODE_READER_SCAN_PUCKS = "barcode_reader_scan_pucks"
|
||||
ROOM_TEMPERATURE_ENABLED_PREFERENCE = "room_temperature_enabled"
|
||||
BEAMLINE_STATUS_ENABLED_PREFERENCE = "beamline_status_enabled"
|
||||
VALVE_CONTROL_ENABLED_PREFERENCE = "valve_control"
|
||||
|
||||
def is_imaging_enabled():
|
||||
setting = get_setting(IMAGING_ENABLED_PREFERENCE)
|
||||
return not (str(setting).lower() == 'false')
|
||||
|
||||
def set_imaging_enabled(value):
|
||||
set_setting(IMAGING_ENABLED_PREFERENCE, (True if value else False) )
|
||||
|
||||
def assert_imaging_enabled():
|
||||
if is_imaging_enabled() == False:
|
||||
raise Exception ("Imaging is disabled")
|
||||
|
||||
#"unipuck", "minispine" or "mixed"
|
||||
def set_puck_types(value):
|
||||
set_setting(PUCK_TYPES_PREFERENCE, True if value else False )
|
||||
|
||||
def get_puck_types():
|
||||
setting = get_setting(PUCK_TYPES_PREFERENCE)
|
||||
if setting == "unipuck" or setting == "minispine":
|
||||
return setting
|
||||
return "mixed"
|
||||
|
||||
|
||||
def is_barcode_reader_scan_pucks():
|
||||
setting = get_setting(BARCODE_READER_SCAN_PUCKS)
|
||||
return False if setting is None else setting.lower() == "true"
|
||||
|
||||
def set_barcode_reader_scan_pucks(value):
|
||||
set_setting(BARCODE_READER_SCAN_PUCKS, True if value else False )
|
||||
|
||||
def is_valve_controlled():
|
||||
setting = get_setting(VALVE_CONTROL_ENABLED_PREFERENCE)
|
||||
return False if setting is None else setting.lower() == "true"
|
||||
|
||||
def set_valve_controlled(value):
|
||||
set_setting(VALVE_CONTROL_ENABLED_PREFERENCE, True if value else False )
|
||||
|
||||
def reset_mounted_sample_position():
|
||||
set_setting("mounted_sample_position", None)
|
||||
|
||||
|
||||
def get_puck_barcode_reader():
|
||||
if is_barcode_reader_scan_pucks():
|
||||
return barcode_reader
|
||||
else:
|
||||
return barcode_reader_puck
|
||||
|
||||
#In order to apply current config
|
||||
set_imaging_enabled(is_imaging_enabled())
|
||||
set_puck_types(get_puck_types())
|
||||
set_barcode_reader_scan_pucks(is_barcode_reader_scan_pucks())
|
||||
set_valve_controlled(is_valve_controlled())
|
||||
|
||||
|
||||
force_dry_mount_count = get_setting("force_dry_mount_count")
|
||||
if force_dry_mount_count is None:
|
||||
set_setting("force_dry_mount_count", 0)
|
||||
|
||||
force_dry_timeout = get_setting("force_dry_timeout")
|
||||
if force_dry_timeout is None:
|
||||
set_setting("force_dry_timeout", 0)
|
||||
|
||||
|
||||
cold_position_timeout = get_setting("cold_position_timeout")
|
||||
if cold_position_timeout is None:
|
||||
set_setting("cold_position_timeout", 0)
|
||||
|
||||
|
||||
def is_room_temperature_enabled():
|
||||
setting = get_setting(ROOM_TEMPERATURE_ENABLED_PREFERENCE)
|
||||
return str(setting).lower() == 'true'
|
||||
|
||||
set_setting(ROOM_TEMPERATURE_ENABLED_PREFERENCE, is_room_temperature_enabled())
|
||||
|
||||
|
||||
def is_beamline_status_enabled():
|
||||
setting = get_setting(BEAMLINE_STATUS_ENABLED_PREFERENCE)
|
||||
return str(setting).lower() == 'true'
|
||||
|
||||
set_setting(BEAMLINE_STATUS_ENABLED_PREFERENCE, is_beamline_status_enabled())
|
||||
|
||||
###################################################################################################
|
||||
# Scripted devices and pseudo-devices
|
||||
###################################################################################################
|
||||
|
||||
for script in ["devices/RobotSC", "devices/Wago", "devices/BarcodeReader", "devices/LaserDistance", \
|
||||
"devices/LedCtrl", "devices/SmartMagnet", "devices/HexiPosi", "devices/Gonio"]:
|
||||
try:
|
||||
|
||||
|
||||
def is_room_temperature_enabled():
|
||||
setting = get_setting(ROOM_TEMPERATURE_ENABLED_PREFERENCE)
|
||||
return str(setting).lower() == 'true'
|
||||
|
||||
set_setting(ROOM_TEMPERATURE_ENABLED_PREFERENCE, is_room_temperature_enabled())
|
||||
|
||||
|
||||
def is_beamline_status_enabled():
|
||||
setting = get_setting(BEAMLINE_STATUS_ENABLED_PREFERENCE)
|
||||
return str(setting).lower() == 'true'
|
||||
|
||||
set_setting(BEAMLINE_STATUS_ENABLED_PREFERENCE, is_beamline_status_enabled())
|
||||
|
||||
###################################################################################################
|
||||
# Scripted devices and pseudo-devices
|
||||
###################################################################################################
|
||||
|
||||
scripted_devices = ["devices/RobotSC", "devices/Wago", "devices/BarcodeReader", "devices/LaserDistance",
|
||||
"devices/LedCtrl", "devices/SmartMagnet", "devices/Gonio", "devices/VmbCamera" #"devices/HexiPosi"]"
|
||||
]
|
||||
|
||||
for script in scripted_devices:
|
||||
|
||||
try:
|
||||
run(script)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
#if is_imaging_enabled():
|
||||
if get_device("img") is not None:
|
||||
add_device(img.getContrast(), force = True)
|
||||
add_device(img.getCamera(), force = True)
|
||||
print "Running: ", script
|
||||
run(script)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
###################################################################################################
|
||||
# Utility modules
|
||||
###################################################################################################
|
||||
|
||||
run("data/samples")
|
||||
run("data/pucks")
|
||||
run("motion/tools")
|
||||
run("motion/mount")
|
||||
run("motion/unmount")
|
||||
run("motion/get_dewar")
|
||||
run("motion/put_dewar")
|
||||
run("motion/get_gonio")
|
||||
run("motion/put_gonio")
|
||||
run("motion/move_dewar")
|
||||
run("motion/move_gonio")
|
||||
run("motion/move_heater")
|
||||
run("motion/move_home")
|
||||
run("motion/move_park")
|
||||
run("motion/move_cold")
|
||||
run("motion/move_scanner")
|
||||
run("motion/move_aux")
|
||||
run("motion/get_aux")
|
||||
run("motion/put_aux")
|
||||
run("motion/dry")
|
||||
run("motion/trash")
|
||||
run("motion/homing_hexiposi")
|
||||
run("motion/calibrate_tool")
|
||||
run("motion/scan_pin")
|
||||
run("motion/robot_recover")
|
||||
run("motion/recover")
|
||||
run("tools/Math")
|
||||
if is_imaging_enabled():
|
||||
run("imgproc/Utils")
|
||||
|
||||
def system_check(robot_move=True):
|
||||
if not air_pressure_ok.read():
|
||||
raise Exception("Air pressure is not ok")
|
||||
if not n2_pressure_ok.read():
|
||||
raise Exception("N2 pressure is not ok")
|
||||
hexiposi.assert_in_known_position()
|
||||
|
||||
if robot_move:
|
||||
if not feedback_local_safety.read():
|
||||
raise Exception("Local safety not released")
|
||||
auto = not is_manual_mode()
|
||||
if auto:
|
||||
if not feedback_psys_safety.read():
|
||||
raise Exception("Psys safety not released")
|
||||
if not guiding_tool_park.read():
|
||||
raise Exception("Guiding tool 1 not parked")
|
||||
|
||||
#if is_imaging_enabled():
|
||||
if get_device("img") is not None:
|
||||
add_device(img.getContrast(), force = True)
|
||||
add_device(img.getCamera(), force = True)
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Utility modules
|
||||
###################################################################################################
|
||||
|
||||
run("data/samples")
|
||||
run("data/pucks")
|
||||
run("motion/tools")
|
||||
run("motion/mount")
|
||||
run("motion/unmount")
|
||||
run("motion/get_dewar")
|
||||
run("motion/put_dewar")
|
||||
run("motion/get_gonio")
|
||||
run("motion/put_gonio")
|
||||
run("motion/move_dewar")
|
||||
run("motion/move_gonio")
|
||||
run("motion/move_heater")
|
||||
run("motion/move_home")
|
||||
run("motion/move_park")
|
||||
run("motion/move_cold")
|
||||
run("motion/move_scanner")
|
||||
run("motion/move_aux")
|
||||
run("motion/get_aux")
|
||||
run("motion/put_aux")
|
||||
run("motion/dry")
|
||||
run("motion/trash")
|
||||
run("motion/homing_hexiposi")
|
||||
run("motion/calibrate_tool")
|
||||
run("motion/scan_pin")
|
||||
run("motion/robot_recover")
|
||||
run("motion/recover")
|
||||
run("tools/Math")
|
||||
if is_imaging_enabled():
|
||||
run("imgproc/Utils")
|
||||
|
||||
def system_check(robot_move=True):
|
||||
if not air_pressure_ok.read():
|
||||
raise Exception("Air pressure is not ok")
|
||||
if not n2_pressure_ok.read():
|
||||
raise Exception("N2 pressure is not ok")
|
||||
hexiposi.assert_in_known_position()
|
||||
|
||||
if robot_move:
|
||||
if not feedback_local_safety.read():
|
||||
raise Exception("Local safety not released")
|
||||
auto = not is_manual_mode()
|
||||
if auto:
|
||||
if not feedback_psys_safety.read():
|
||||
raise Exception("Psys safety not released")
|
||||
if not guiding_tool_park.read():
|
||||
raise Exception("Guiding tool 1 not parked")
|
||||
if not guiding_tool_park_2.read():
|
||||
|
||||
def system_check_msg():
|
||||
try:
|
||||
system_check(True)
|
||||
return "Ok"
|
||||
except:
|
||||
return sys.exc_info()[1]
|
||||
|
||||
def get_puck_dev(segment, puck):
|
||||
if type(segment) is int:
|
||||
segment = chr( ord('A') + (segment-1))
|
||||
|
||||
return Controller.getInstance().getPuck(str(segment).upper() + str(puck))
|
||||
|
||||
def get_puck_elect_detection(segment, puck):
|
||||
return str(get_puck_dev(segment, puck).detection)
|
||||
|
||||
def get_puck_img_detection(segment, puck):
|
||||
return str(Controller.getInstance().getPuck(str(segment).upper() + str(puck)).imageDetection)
|
||||
|
||||
def assert_puck_detected(segment, puck):
|
||||
if (segment == AUX_SEGMENT) and (puck == 1):
|
||||
return
|
||||
if get_puck_elect_detection(segment, puck) != "Present":
|
||||
raise Exception ("Puck " + str(segment).upper() + str(puck) + " not present")
|
||||
|
||||
|
||||
def start_puck_detection():
|
||||
run("tools/RestartPuckDetection")
|
||||
|
||||
def check_puck_detection():
|
||||
return run("tools/CheckPuckDetection")
|
||||
|
||||
def stop_puck_detection():
|
||||
run("tools/StopPuckDetection")
|
||||
|
||||
|
||||
|
||||
def get_detected_pucks():
|
||||
ret = []
|
||||
for i in range(30):
|
||||
p = BasePlate.getPucks()[i]
|
||||
if (str(p.getDetection()) == "Present"):
|
||||
ret.append(str(p.getName()))
|
||||
return ret
|
||||
|
||||
def get_pucks_info():
|
||||
ret = []
|
||||
for i in range(30):
|
||||
p = BasePlate.getPucks()[i]
|
||||
name = p.getName()
|
||||
det = str(p.getDetection())
|
||||
barcode = "" if p.getId() is None else p.getId()
|
||||
|
||||
ret.append({"puckAddress": name, "puckState": det, "puckBarcode":barcode})
|
||||
return json.dumps(ret)
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Device initialization
|
||||
###################################################################################################
|
||||
|
||||
try:
|
||||
set_heater(False)
|
||||
set_air_stream(False)
|
||||
raise Exception("Guiding tool 2 not parked")
|
||||
|
||||
def system_check_msg():
|
||||
try:
|
||||
system_check(True)
|
||||
return "Ok"
|
||||
except:
|
||||
return sys.exc_info()[1]
|
||||
|
||||
def get_puck_dev(segment, puck):
|
||||
if type(segment) is int:
|
||||
segment = chr( ord('A') + (segment-1))
|
||||
|
||||
return Controller.getInstance().getPuck(str(segment).upper() + str(puck))
|
||||
|
||||
def get_puck_elect_detection(segment, puck):
|
||||
return str(get_puck_dev(segment, puck).detection)
|
||||
|
||||
def get_puck_img_detection(segment, puck):
|
||||
return str(Controller.getInstance().getPuck(str(segment).upper() + str(puck)).imageDetection)
|
||||
|
||||
def assert_puck_detected(segment, puck):
|
||||
if (segment == AUX_SEGMENT) and (puck == 1):
|
||||
return
|
||||
if get_puck_elect_detection(segment, puck) != "Present":
|
||||
raise Exception ("Puck " + str(segment).upper() + str(puck) + " not present")
|
||||
|
||||
|
||||
def start_puck_detection():
|
||||
run("tools/RestartPuckDetection")
|
||||
|
||||
def check_puck_detection():
|
||||
return run("tools/CheckPuckDetection")
|
||||
|
||||
def stop_puck_detection():
|
||||
run("tools/StopPuckDetection")
|
||||
|
||||
|
||||
|
||||
def get_detected_pucks():
|
||||
ret = []
|
||||
for i in range(30):
|
||||
p = BasePlate.getPucks()[i]
|
||||
if (str(p.getDetection()) == "Present"):
|
||||
ret.append(str(p.getName()))
|
||||
return ret
|
||||
|
||||
def get_pucks_info():
|
||||
ret = []
|
||||
for i in range(30):
|
||||
p = BasePlate.getPucks()[i]
|
||||
name = p.getName()
|
||||
det = str(p.getDetection())
|
||||
barcode = "" if p.getId() is None else p.getId()
|
||||
|
||||
ret.append({"puckAddress": name, "puckState": det, "puckBarcode":barcode})
|
||||
return json.dumps(ret)
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Device initialization
|
||||
###################################################################################################
|
||||
|
||||
try:
|
||||
set_heater(False)
|
||||
set_air_stream(False)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
|
||||
try:
|
||||
release_local_safety.write(False)
|
||||
release_psys_safety.write(False)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
try:
|
||||
set_pin_cleaner(False)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
|
||||
try:
|
||||
release_local_safety.write(False)
|
||||
release_psys_safety.write(False)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
try:
|
||||
hexiposi.set_offset(16.4)
|
||||
|
||||
except:
|
||||
hexiposi.polling=500
|
||||
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
try:
|
||||
robot.setPolling(DEFAULT_ROBOT_POLLING)
|
||||
robot.set_tool(TOOL_DEFAULT)
|
||||
robot.set_frame(FRAME_DEFAULT)
|
||||
robot.set_motors_enabled(True)
|
||||
robot.set_joint_motors_enabled(True)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
if is_imaging_enabled():
|
||||
try:
|
||||
import ch.psi.pshell.device.Camera as Camera
|
||||
#img.camera.setColorMode(Camera.ColorMode.Mono)
|
||||
#img.camera.setDataType(Camera.DataType.UInt8)
|
||||
img.camera.setGrabMode(Camera.GrabMode.Continuous)
|
||||
img.camera.setTriggerMode(Camera.TriggerMode.Fixed_Rate)
|
||||
img.camera.setExposure(25.00)
|
||||
img.camera.setAcquirePeriod(200.00)
|
||||
img.camera.setGain(0.0)
|
||||
#img.camera.setROI(200, 0,1200,1200)
|
||||
"""
|
||||
img.camera.setROI(300, 200,1000,1000)
|
||||
img.config.rotation=17
|
||||
img.config.rotationCrop=True
|
||||
img.config.roiX,img.config.roiY, img.config.roiWidth,img.config.roiHeight = 50,50,900,900
|
||||
"""
|
||||
img.camera.setROI(int(get_setting("roi_x")), int(get_setting("roi_y")), int(get_setting("roi_w")), int(get_setting("roi_h")))
|
||||
|
||||
img.camera.stop()
|
||||
img.camera.start()
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
#TODO: The Smart Magnet keeps moving sample if detecting is enabled
|
||||
# Detection keeps disabled unless during moount/unmount
|
||||
try:
|
||||
smart_magnet.set_supress(True)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
#gripper_cam.paused = True
|
||||
###################################################################################################
|
||||
# Device monitoring
|
||||
###################################################################################################
|
||||
|
||||
DEWAR_LEVEL_RT = 5.0
|
||||
is_room_temperature = False
|
||||
|
||||
def is_room_temp():
|
||||
return is_room_temperature
|
||||
|
||||
|
||||
class DewarLevelListener (DeviceListener):
|
||||
def onValueChanged(self, device, value, former):
|
||||
global is_room_temperature
|
||||
if value is not None:
|
||||
is_room_temperature = value <= DEWAR_LEVEL_RT
|
||||
dewar_level_listener = DewarLevelListener()
|
||||
|
||||
for l in dewar_level.listeners:
|
||||
#if isinstance(l, DewarLevelListener): #Class changes...
|
||||
if Nameable.getShortClassName(l.getClass()) == "DewarLevelListener":
|
||||
dewar_level.removeListener(l)
|
||||
|
||||
dewar_level.addListener(dewar_level_listener)
|
||||
|
||||
try:
|
||||
robot.setPolling(DEFAULT_ROBOT_POLLING)
|
||||
robot.set_tool(TOOL_DEFAULT)
|
||||
robot.set_frame(FRAME_DEFAULT)
|
||||
robot.set_motors_enabled(True)
|
||||
robot.set_joint_motors_enabled(True)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
if is_imaging_enabled():
|
||||
try:
|
||||
import ch.psi.pshell.device.Camera as Camera
|
||||
#img.camera.setColorMode(Camera.ColorMode.Mono)
|
||||
#img.camera.setDataType(Camera.DataType.UInt8)
|
||||
img.camera.setGrabMode(Camera.GrabMode.Continuous)
|
||||
img.camera.setTriggerMode(Camera.TriggerMode.Fixed_Rate)
|
||||
img.camera.setExposure(25.00)
|
||||
img.camera.setAcquirePeriod(200.00)
|
||||
img.camera.setGain(0.0)
|
||||
#img.camera.setROI(200, 0,1200,1200)
|
||||
"""
|
||||
img.camera.setROI(300, 200,1000,1000)
|
||||
img.config.rotation=17
|
||||
img.config.rotationCrop=True
|
||||
img.config.roiX,img.config.roiY, img.config.roiWidth,img.config.roiHeight = 50,50,900,900
|
||||
"""
|
||||
img.camera.setROI(int(get_setting("roi_x")), int(get_setting("roi_y")), int(get_setting("roi_w")), int(get_setting("roi_h")))
|
||||
|
||||
img.camera.stop()
|
||||
img.camera.start()
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
#TODO: The Smart Magnet keeps moving sample if detecting is enabled
|
||||
# Detection keeps disabled unless during moount/unmount
|
||||
try:
|
||||
smart_magnet.set_supress(True)
|
||||
except:
|
||||
print >> sys.stderr, traceback.format_exc()
|
||||
|
||||
#gripper_cam.paused = True
|
||||
###################################################################################################
|
||||
# Device monitoring
|
||||
###################################################################################################
|
||||
|
||||
DEWAR_LEVEL_RT = 5.0
|
||||
is_room_temperature = False
|
||||
|
||||
def is_room_temp():
|
||||
return is_room_temperature
|
||||
|
||||
|
||||
class DewarLevelListener (DeviceListener):
|
||||
def onValueChanged(self, device, value, former):
|
||||
global is_room_temperature
|
||||
if value is not None:
|
||||
is_room_temperature = value <= DEWAR_LEVEL_RT
|
||||
dewar_level_listener = DewarLevelListener()
|
||||
|
||||
for l in dewar_level.listeners:
|
||||
#if isinstance(l, DewarLevelListener): #Class changes...
|
||||
if Nameable.getShortClassName(l.getClass()) == "DewarLevelListener":
|
||||
dewar_level.removeListener(l)
|
||||
|
||||
dewar_level.addListener(dewar_level_listener)
|
||||
dewar_level_listener.onValueChanged(dewar_level, dewar_level.take(), None)
|
||||
|
||||
|
||||
|
||||
|
||||
dewar_level_listener.onValueChanged(dewar_level, dewar_level.take(), None)
|
||||
|
||||
"""
|
||||
|
||||
robot.assert_cleared()
|
||||
|
||||
hexiposi_listener = HexiposiListener()
|
||||
hexiposi.addListener(hexiposi_listener)
|
||||
|
||||
###################################################################################################
|
||||
# Global variables & application state
|
||||
###################################################################################################
|
||||
|
||||
|
||||
context = get_context()
|
||||
|
||||
cover_detection_debug = False
|
||||
|
||||
in_mount_position = False
|
||||
|
||||
|
||||
def assert_mount_position():
|
||||
print "Source: ", get_exec_pars().source
|
||||
if not in_mount_position and get_exec_pars().source == CommandSource.server :
|
||||
class HexiposiListener (DeviceListener):
|
||||
def onValueChanging(self, device, value, former):
|
||||
robot.assert_cleared()
|
||||
hexiposi_listener = HexiposiListener()
|
||||
hexiposi.addListener(hexiposi_listener)
|
||||
|
||||
"""
|
||||
###################################################################################################
|
||||
# Global variables & application state
|
||||
###################################################################################################
|
||||
|
||||
|
||||
context = get_context()
|
||||
|
||||
cover_detection_debug = False
|
||||
|
||||
in_mount_position = False
|
||||
|
||||
|
||||
def assert_mount_position():
|
||||
print "Source: ", get_exec_pars().source
|
||||
|
||||
if not in_mount_position and get_exec_pars().source == CommandSource.server :
|
||||
raise Exception("Not in mount position")
|
||||
guiding_tools_parked = guiding_tool_park.read() and guiding_tool_park_2.read()
|
||||
return robot.state == State.Ready and robot.take()["pos"] == 'pPark' and \
|
||||
|
||||
|
||||
|
||||
not guiding_tools_parked
|
||||
|
||||
def set_pin_offset(val):
|
||||
if abs(val) >5:
|
||||
raise Exception("Invalid pin offset: " + str(val))
|
||||
try:
|
||||
set_setting("pin_offset",float(val))
|
||||
except:
|
||||
log("Error setting pin offset: " + str(sys.exc_info()[1]), False)
|
||||
|
||||
def get_pin_offset():
|
||||
try:
|
||||
ret = float(get_setting("pin_offset"))
|
||||
if abs(ret) >5:
|
||||
raise Exception("Invalid configured pin offset: " + str(ret))
|
||||
return ret
|
||||
except:
|
||||
log("Error getting pin offset: " + str(sys.exc_info()[1]), False)
|
||||
return 0.0
|
||||
|
||||
|
||||
def set_pin_angle_offset(val):
|
||||
if (abs(val) > 180.0) or (abs(val) < -180.0):
|
||||
raise Exception("Invalid pin angle offset: " + str(val))
|
||||
try:
|
||||
set_setting("pin_angle_offset",float(val))
|
||||
except:
|
||||
log("Error setting pin angle offset: " + str(sys.exc_info()[1]), False)
|
||||
|
||||
def get_pin_angle_offset():
|
||||
try:
|
||||
ret = float(get_setting("pin_angle_offset"))
|
||||
if (abs(ret) > 180.0) or (abs(ret) < -180.0):
|
||||
raise Exception("Invalid configured pin angle offset: " + str(ret))
|
||||
return ret
|
||||
except:
|
||||
log("Error getting pin angle offset: " + str(sys.exc_info()[1]), False)
|
||||
return 0.0
|
||||
|
||||
def is_force_dry():
|
||||
try:
|
||||
dry_mount_counter = int(get_setting("dry_mount_counter"))
|
||||
except:
|
||||
dry_mount_counter = 0
|
||||
|
||||
try:
|
||||
dry_timespan = time.time() - float( get_setting("dry_timestamp"))
|
||||
except:
|
||||
dry_timespan = 3600
|
||||
|
||||
try:
|
||||
force_dry_mount_count = int(get_setting("force_dry_mount_count"))
|
||||
if force_dry_mount_count>0 and dry_mount_counter>=force_dry_mount_count:
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
force_dry_timeout = float(get_setting("force_dry_timeout"))
|
||||
if force_dry_timeout>0 and dry_timespan>=force_dry_timeout:
|
||||
return True
|
||||
except:
|
||||
def is_puck_loading():
|
||||
guiding_tools_parked = guiding_tool_park.read() and guiding_tool_park_2.read()
|
||||
return robot.state == State.Ready and robot.take()["pos"] == 'pPark' and \
|
||||
feedback_psys_safety.take() == False and \
|
||||
not guiding_tools_parked
|
||||
|
||||
def set_pin_offset(val):
|
||||
if abs(val) >5:
|
||||
raise Exception("Invalid pin offset: " + str(val))
|
||||
try:
|
||||
set_setting("pin_offset",float(val))
|
||||
except:
|
||||
log("Error setting pin offset: " + str(sys.exc_info()[1]), False)
|
||||
|
||||
def get_pin_offset():
|
||||
try:
|
||||
ret = float(get_setting("pin_offset"))
|
||||
if abs(ret) >5:
|
||||
raise Exception("Invalid configured pin offset: " + str(ret))
|
||||
return ret
|
||||
except:
|
||||
log("Error getting pin offset: " + str(sys.exc_info()[1]), False)
|
||||
return 0.0
|
||||
|
||||
|
||||
def set_pin_angle_offset(val):
|
||||
if (abs(val) > 180.0) or (abs(val) < -180.0):
|
||||
raise Exception("Invalid pin angle offset: " + str(val))
|
||||
try:
|
||||
set_setting("pin_angle_offset",float(val))
|
||||
except:
|
||||
log("Error setting pin angle offset: " + str(sys.exc_info()[1]), False)
|
||||
|
||||
def get_pin_angle_offset():
|
||||
try:
|
||||
ret = float(get_setting("pin_angle_offset"))
|
||||
if (abs(ret) > 180.0) or (abs(ret) < -180.0):
|
||||
raise Exception("Invalid configured pin angle offset: " + str(ret))
|
||||
return ret
|
||||
except:
|
||||
log("Error getting pin angle offset: " + str(sys.exc_info()[1]), False)
|
||||
return 0.0
|
||||
|
||||
def is_force_dry():
|
||||
try:
|
||||
dry_mount_counter = int(get_setting("dry_mount_counter"))
|
||||
except:
|
||||
dry_mount_counter = 0
|
||||
|
||||
try:
|
||||
dry_timespan = time.time() - float( get_setting("dry_timestamp"))
|
||||
except:
|
||||
dry_timespan = 3600
|
||||
|
||||
try:
|
||||
force_dry_mount_count = int(get_setting("force_dry_mount_count"))
|
||||
if force_dry_mount_count>0 and dry_mount_counter>=force_dry_mount_count:
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
force_dry_timeout = float(get_setting("force_dry_timeout"))
|
||||
if force_dry_timeout>0 and dry_timespan>=force_dry_timeout:
|
||||
return True
|
||||
def assert_detector_safe():
|
||||
if detector_cleared.read() == False:
|
||||
raise Exception ("Detector not in safe position: move it back")
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
|
||||
def assert_detector_safe():
|
||||
set_led_state(puck_loading)
|
||||
#pass
|
||||
|
||||
update()
|
||||
add_device(Controller.getInstance().basePlate, True)
|
||||
restore_samples_info()
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def onPuckLoadingChange(puck_loading):
|
||||
set_led_state(puck_loading)
|
||||
#pass
|
||||
|
||||
update()
|
||||
add_device(Controller.getInstance().basePlate, True)
|
||||
@@ -9,8 +9,7 @@ def dry(heat_time=None, speed=None, wait_cold = None):
|
||||
wait_cold(float): if negative, move to dewar after drying
|
||||
Else move to cold and wait (in seconds) before returning.
|
||||
"""
|
||||
print "dry"
|
||||
|
||||
print "dry()"
|
||||
if heat_time is None:
|
||||
heat_time = DEFAULT_DRY_HEAT_TIME
|
||||
|
||||
|
||||
+22
-11
@@ -74,10 +74,12 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
#smart_magnet.apply_resting()
|
||||
#time.sleep(0.5)
|
||||
|
||||
sample_det = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
evlog("Sample Detection", str(sample_det))
|
||||
sample_det = smart_magnet.check_mounted(idle_time=0.6, timeout = 2.0)
|
||||
evlog("SMC Detection: ", "sample on gonio" if sample_det else "gonio free")
|
||||
|
||||
if sample_det == True:
|
||||
if auto_unmount and (get_setting("mounted_sample_position") is not None):
|
||||
evlog("sample detected on gonio, calling unmount script")
|
||||
#auto_unmount set to true so detection remains enabled
|
||||
sample_det = unmount(force = True, auto_unmount = True)
|
||||
do_unmount = True
|
||||
@@ -123,10 +125,13 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
barcode_reader.start_read(10.0)
|
||||
robot.move_scanner()
|
||||
#time.sleep(1.0)
|
||||
|
||||
|
||||
print "moving cryo out to 17"
|
||||
cryostage.moveAsync(17.0)
|
||||
#cryostage.waitInPosition(17.0, 3500)
|
||||
robot.move_gonio()
|
||||
print "waiting cryo out to 17"
|
||||
cryostage.waitInPosition(17.0, 3500)
|
||||
print "move_gonio"
|
||||
robot.move_gonio()
|
||||
|
||||
|
||||
if read_dm:
|
||||
@@ -135,11 +140,17 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
else:
|
||||
mount_sample_id = None
|
||||
|
||||
|
||||
|
||||
print "put_gonio"
|
||||
robot.put_gonio()
|
||||
cleaner_timer = float(get_setting("pin_cleaner_timer"))
|
||||
if cleaner_timer > 0:
|
||||
start_pin_cleaner(cleaner_timer)
|
||||
set_pin_cleaner(True)
|
||||
print get_valves_states()
|
||||
if not is_aux:
|
||||
cryostage.moveAsync(5.0)
|
||||
|
||||
# cleaner_timer = float(get_setting("pin_cleaner_timer"))
|
||||
# if cleaner_timer > 0:
|
||||
# start_pin_cleaner(cleaner_timer)
|
||||
|
||||
try:
|
||||
dry_mount_count = int(get_setting("dry_mount_counter"))
|
||||
@@ -152,11 +163,10 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
else:
|
||||
robot.move_cold_async()
|
||||
|
||||
cryostage.moveAsync(8.0)
|
||||
robot.wait_async_motion()
|
||||
|
||||
|
||||
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.6, timeout = 2.0, interval=0.1)
|
||||
|
||||
evlog("SMC Detection", str(mount_sample_detected))
|
||||
|
||||
@@ -164,6 +174,7 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id)
|
||||
|
||||
if mount_sample_detected == False:
|
||||
evlog("MISSING SAMPLE: No pin detected on gonio")
|
||||
raise Exception("MISSING SAMPLE: No pin detected on gonio")
|
||||
|
||||
keep_gripper_warm = was_cold and is_aux
|
||||
|
||||
+18
-11
@@ -7,6 +7,7 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
"""
|
||||
Returns if sample is detected in the end
|
||||
"""
|
||||
evlog = Controller.getInstance().logEvent
|
||||
print "unmount: ", segment, puck, sample, force
|
||||
|
||||
if (segment is None) or (puck is None) or (sample is None):
|
||||
@@ -56,9 +57,10 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
hexiposi.assert_homed()
|
||||
print "assert mount pos"
|
||||
assert_mount_position()
|
||||
|
||||
set_status("Unmounting: " + str(segment) + str(puck) + str(sample))
|
||||
Controller.getInstance().logEvent("Unmount Sample", str(segment) + str(puck) + str(sample))
|
||||
|
||||
sample_name = str(segment) + str(puck) + str(sample)
|
||||
set_status("Unmounting: " + sample_name)
|
||||
evlog("Unmount Sample", sample_name)
|
||||
|
||||
try:
|
||||
if smart_magnet.get_supress() == True:
|
||||
@@ -69,8 +71,8 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
#smart_magnet.apply_resting()
|
||||
|
||||
if not force:
|
||||
sample_det = smart_magnet.check_mounted(idle_time=0.5, timeout = 3.0)
|
||||
Controller.getInstance().logEvent("SMC Detection", str(sample_det))
|
||||
sample_det = smart_magnet.check_mounted(idle_time=0.6, timeout = 3.0)
|
||||
evlog("SMC Detection", str(sample_det))
|
||||
if sample_det == False:
|
||||
raise Exception("No pin detected on gonio")
|
||||
|
||||
@@ -91,7 +93,7 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
#location = robot.get_current_point()
|
||||
|
||||
cryostage.moveAsync(17.0)
|
||||
#cryostage.waitInPosition(17.0, 3500)
|
||||
cryostage.waitInPosition(17.0, 3500)
|
||||
if not robot.is_gonio():
|
||||
robot.move_gonio()
|
||||
|
||||
@@ -99,12 +101,13 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
#smart_magnet.set_unmount_current()
|
||||
|
||||
robot.get_gonio()
|
||||
set_pin_cleaner(True)
|
||||
|
||||
smart_magnet.apply_reverse()
|
||||
smart_magnet.apply_resting()
|
||||
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
|
||||
Controller.getInstance().logEvent("SMC Detection", str(mount_sample_detected))
|
||||
|
||||
mount_sample_detected = smart_magnet.check_mounted(idle_time=0.6, timeout = 2.0)
|
||||
evlog("SMC Detection: ", "sample on gonio" if mount_sample_detected else "gonio free")
|
||||
|
||||
if is_aux:
|
||||
robot.move_aux()
|
||||
robot.put_aux(sample)
|
||||
@@ -114,7 +117,7 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
if hexiposi.position != segment:
|
||||
robot.move_cold() #Save the sample
|
||||
log_str = "Hexiposi detected in wrong position " + str(hexiposi.readback.take()) + " - not in " + str(segment)
|
||||
Controller.getInstance().logEvent(log_str); log(log_str, False) ; print log_str
|
||||
evlog(log_str); log(log_str, False) ; print log_str
|
||||
set_hexiposi(segment, force=False)
|
||||
if hexiposi.position != segment:
|
||||
log_str = "Cannot restore hexiposi position"
|
||||
@@ -126,8 +129,12 @@ def unmount(segment = None, puck = None, sample = None, force=False, auto_unmoun
|
||||
update_samples_info_sample_unmount(get_puck_name(segment, puck), sample)
|
||||
robot.move_dewar()
|
||||
robot.put_dewar(segment, puck, sample)
|
||||
set_setting("mounted_sample_position", None)
|
||||
|
||||
if mount_sample_detected:
|
||||
evlog("failed to unmount sample " + sample_name)
|
||||
raise Exception("failed to unmount sample " + sample_name)
|
||||
else:
|
||||
set_setting("mounted_sample_position", None)
|
||||
return mount_sample_detected
|
||||
finally:
|
||||
if not auto_unmount:
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
if len(reinit()) == 0:
|
||||
stop_task("reinit", False)
|
||||
@@ -1,19 +1,58 @@
|
||||
import math
|
||||
from ijutils import *
|
||||
|
||||
ca = []
|
||||
aa = []
|
||||
pa = []
|
||||
|
||||
#for i in range(6):
|
||||
#index = i+1
|
||||
for i in ['A', 'B', 'C', 'D', 'E', 'F']:
|
||||
hexiposi.move(i)
|
||||
[position, angle, confidence] = run("imgproc/CoverDetection")
|
||||
print [position, angle, confidence]
|
||||
pa.append(position)
|
||||
aa.append(angle)
|
||||
ca.append(confidence)
|
||||
|
||||
print "---"
|
||||
print "Position: " ,pa
|
||||
print "Angle: " ,aa
|
||||
print "Confidence: " ,ca, " mean: ", mean(ca)
|
||||
DIAM_1 = 80
|
||||
DIAM_2 = 550
|
||||
DETECT_THRESHOLD = 10 #PIXELS
|
||||
|
||||
renderer=show_panel(image)
|
||||
renderer.setMarker(None);
|
||||
|
||||
|
||||
|
||||
#Image Loading
|
||||
ip = load_image(image.output, title="Image")
|
||||
aux = grayscale(ip, in_place=False)
|
||||
#invert(aux);
|
||||
|
||||
px1 = int(pow(DIAM_1/2,2) * math.pi)
|
||||
px2 = int(pow(DIAM_2/2,2) * math.pi)
|
||||
|
||||
#aux.show()
|
||||
|
||||
#binary_open(aux); aux.repaintWindow()
|
||||
|
||||
|
||||
ti = auto_threshold(aux, dark_background=False, in_place=False) #; aux.repaintWindow()
|
||||
#ti.show()
|
||||
#binary_fill_holes(ti)
|
||||
#ti.repaintWindow()
|
||||
|
||||
(res1,out1)=analyse_particles(ti, px1/2, px1*2, \
|
||||
fill_holes = False, exclude_edges = True, print_table=True, \
|
||||
output_image = "outlines", minCirc = 0.8, maxCirc = 1.0)
|
||||
#out1.show()
|
||||
|
||||
ti = auto_threshold(aux, dark_background=True, in_place=False) #; aux.repaintWindow()
|
||||
(res2,out2)=analyse_particles(ti, px2/2, px2*2, \
|
||||
fill_holes = False, exclude_edges = True, print_table=True, \
|
||||
output_image = "outlines", minCirc = 0.8, maxCirc = 1.0)
|
||||
|
||||
|
||||
#output_img.show()
|
||||
|
||||
if res1.size() == res2.size() == 1:
|
||||
x1,y1 = res1.getValue("XM", 0), res1.getValue("YM", 0)
|
||||
x2,y2 = res2.getValue("XM", 0), res2.getValue("YM", 0)
|
||||
|
||||
if abs(x1-x2) <= DETECT_THRESHOLD and abs(y1-y2) <= DETECT_THRESHOLD:
|
||||
print("Detected: ", (x1, y1))
|
||||
renderer=show_panel(image)
|
||||
p = Point(int(x1),int(y1))
|
||||
ov = Overlays.Crosshairs(renderer.getPenProfile(), p, Dimension(-1, -1))
|
||||
renderer.setMarker(ov);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
img_stream = Stream("img_stream","localhost:9000", SocketType.SUB)
|
||||
#image = img_stream.addWaveform("image", "image")
|
||||
add_device(img_stream, True)
|
||||
img_stream.start()
|
||||
show_panel(img_stream)
|
||||
img_stream.waitCacheChange(0)
|
||||
add_device(img_stream.getChild("image"), True)
|
||||
|
||||
|
||||
#img = RegisterMatrixSource("img", image)
|
||||
#add_device(img, True)
|
||||
|
||||
img = RegisterArraySource("img", image)
|
||||
img.config.imageWidth = image.shape[0]
|
||||
img.config.imageHeight = image.shape[1]
|
||||
add_device(img, True)
|
||||
@@ -0,0 +1,5 @@
|
||||
"PacketSize=1504;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=290;RegionY=130;Width=1000;Height=1000;MulticastEnable=Off;AcquisitionMode=Continuous"
|
||||
|
||||
"PacketSize=9000;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=0;RegionY=0;Width=1000;Height=1000;MulticastEnable=Off;AcquisitionMode=Continuous"
|
||||
|
||||
25001 "PacketSize=1504;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=290;RegionY=130;Width=1000;Height=1000;MulticastEnable=Off"
|
||||
Reference in New Issue
Block a user