This commit is contained in:
gac-S_Changer
2018-09-17 16:56:55 +02:00
parent 531c3f5dfe
commit bc21bb95a3
21 changed files with 486 additions and 114 deletions

View File

@@ -1,5 +1,6 @@
#Wed Jun 13 10:31:31 CEST 2018
#Mon Sep 17 09:27:01 CEST 2018
autoSaveScanData=true
commandExecutionEvents=false
createSessionFiles=true
dataLayout=default
dataPath={data}/{year}_{month}/{date}/{date}_{time}_{name}
@@ -11,7 +12,7 @@ dataServerPort=-1
depthDimension=0
hostName=null
instanceName=MXSC
logDaysToLive=-1
logDaysToLive=30
logLevel=Fine
logLevelConsole=Off
logPath={logs}/{date}_{time}

View File

@@ -1,4 +1,4 @@
#Thu Aug 30 15:04:59 CEST 2018
#Wed Sep 12 14:06:31 CEST 2018
colormap=Grayscale
colormapAutomatic=false
colormapMax=18.133
@@ -9,16 +9,16 @@ grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=887
roiWidth=887
roiX=59
roiY=56
rotation=229.76067253596318
roiHeight=899
roiWidth=893
roiX=48
roiY=45
rotation=230.05382605006437
rotationCrop=true
scale=1.0
spatialCalOffsetX=-444.0
spatialCalOffsetY=-444.0
spatialCalScaleX=0.5295623677991782
spatialCalScaleY=0.5294932790504361
spatialCalOffsetX=-447.0
spatialCalOffsetY=-450.0
spatialCalScaleX=0.5262180258614136
spatialCalScaleY=0.5227145226413789
spatialCalUnits=mm
transpose=false

View File

@@ -1,5 +1,5 @@
#Fri Aug 24 20:52:17 CEST 2018
maxValue=0.4
#Tue Sep 11 11:02:40 CEST 2018
maxValue=1.0
minValue=0.0
offset=0.0
precision=2

View File

@@ -1,5 +1,5 @@
#Fri Aug 24 20:52:17 CEST 2018
maxValue=0.4
#Tue Sep 11 11:02:40 CEST 2018
maxValue=1.0
minValue=0.0
offset=0.0
precision=2

View File

@@ -1,5 +1,5 @@
#Fri Aug 24 20:52:17 CEST 2018
maxValue=0.4
#Tue Sep 11 11:02:40 CEST 2018
maxValue=1.0
minValue=0.0
offset=0.0
precision=2

View File

@@ -1,4 +1,4 @@
#Fri Aug 24 14:18:31 CEST 2018
#Wed Sep 12 12:51:56 CEST 2018
holdingCurrent=30.0
mountCurrent=35.0
remanenceCurrent=-10.0

View File

@@ -40,43 +40,51 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="buttonRecover" max="32767" attributes="0"/>
<Component id="buttonMoveHeater" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonMoveGonio" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonMovePark" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonGetGonio" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonPutGonio" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonMount" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonUnmount" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonGetDewar" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonPutDewar" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonDry" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace type="separate" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonMoveScanner" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonMoveHome" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonMoveDewar" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonHomingHexiposi" linkSize="7" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
</Group>
<Component id="jPanel5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="buttonEnableAll" alignment="1" min="-2" pref="112" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="buttonRecover" max="32767" attributes="0"/>
<Component id="buttonMoveHeater" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonMovePark" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonGetGonio" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonPutGonio" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonMount" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonUnmount" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonGetDewar" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonPutDewar" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonDry" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spinnerDrySpeed" pref="92" max="32767" attributes="0"/>
<Component id="spinnerDryTime" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="buttonMoveCold" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonMoveScanner" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonMoveHome" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonMoveDewar" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonHomingHexiposi" linkSize="7" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
</Group>
<Component id="jPanel5" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="buttonEnableAll" alignment="1" min="-2" pref="112" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="spinnerDrySpeed" pref="92" max="32767" attributes="0"/>
<Component id="spinnerDryTime" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<Component id="buttonMoveGonio" linkSize="7" alignment="1" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -104,7 +112,10 @@
<Component id="buttonHomingHexiposi" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonPutGonio" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonPutGonio" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveGonio" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonMovePark" alignment="3" min="-2" max="-2" attributes="0"/>
@@ -112,8 +123,8 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonMoveGonio" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveDewar" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonMoveCold" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@@ -438,6 +449,14 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEnableAllActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonMoveCold">
<Properties>
<Property name="text" type="java.lang.String" value="Move Cold"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMoveColdActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@@ -145,6 +145,7 @@ public class Commands extends Panel {
spinnerDrySpeed = new ch.psi.utils.swing.HorizontalSpinner();
buttonRecover = new javax.swing.JButton();
buttonEnableAll = new javax.swing.JButton();
buttonMoveCold = new javax.swing.JButton();
panelCommands.setBorder(javax.swing.BorderFactory.createTitledBorder("Commands"));
@@ -338,43 +339,55 @@ public class Commands extends Panel {
}
});
buttonMoveCold.setText("Move Cold");
buttonMoveCold.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonMoveColdActionPerformed(evt);
}
});
javax.swing.GroupLayout panelCommandsLayout = new javax.swing.GroupLayout(panelCommands);
panelCommands.setLayout(panelCommandsLayout);
panelCommandsLayout.setHorizontalGroup(
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCommandsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(buttonRecover, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveHeater, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveGonio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMovePark, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonGetGonio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPutGonio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMount, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonUnmount, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonGetDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPutDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonDry, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(18, 18, Short.MAX_VALUE)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelCommandsLayout.createSequentialGroup()
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonMoveScanner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveHome, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonHomingHexiposi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(1, 1, 1))
.addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonEnableAll, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(panelCommandsLayout.createSequentialGroup()
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel6)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(spinnerDrySpeed, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
.addComponent(spinnerDryTime))))
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(buttonRecover, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveHeater, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMovePark, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonGetGonio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPutGonio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMount, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonUnmount, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonGetDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPutDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonDry, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(buttonMoveCold, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelCommandsLayout.createSequentialGroup()
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonMoveScanner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveHome, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonHomingHexiposi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(1, 1, 1))
.addComponent(jPanel5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonEnableAll, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(panelCommandsLayout.createSequentialGroup()
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel6)
.addComponent(jLabel7))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(spinnerDrySpeed, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
.addComponent(spinnerDryTime))))
.addComponent(buttonMoveGonio, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
@@ -399,15 +412,17 @@ public class Commands extends Panel {
.addComponent(buttonGetGonio)
.addComponent(buttonHomingHexiposi))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonPutGonio)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonPutGonio)
.addComponent(buttonMoveGonio))
.addGap(18, 18, 18)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonMovePark)
.addComponent(buttonMoveHome))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonMoveGonio)
.addComponent(buttonMoveDewar))
.addComponent(buttonMoveDewar)
.addComponent(buttonMoveCold))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonMoveHeater)
@@ -529,6 +544,10 @@ public class Commands extends Panel {
execute("robot_recover()");
}//GEN-LAST:event_buttonRecoverActionPerformed
private void buttonMoveColdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveColdActionPerformed
execute("move_cold()");
}//GEN-LAST:event_buttonMoveColdActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonDry;
private javax.swing.JButton buttonEnableAll;
@@ -536,6 +555,7 @@ public class Commands extends Panel {
private javax.swing.JButton buttonGetGonio;
private javax.swing.JButton buttonHomingHexiposi;
private javax.swing.JButton buttonMount;
private javax.swing.JButton buttonMoveCold;
private javax.swing.JButton buttonMoveDewar;
private javax.swing.JButton buttonMoveGonio;
private javax.swing.JButton buttonMoveHeater;

Binary file not shown.

14
script/data/pucks.py Normal file
View File

@@ -0,0 +1,14 @@
def get_puck_names():
return [str(a)+str(b) for a in BLOCKS for b in range(1,6)]
def get_puck_info():
ret = []
#for puck in get_puck_names():
for puck in BasePlate.pucks:
ret.append({"address" : str(puck.name), "status": str(puck.status), "barcode" : str(puck.id)})
return ret
def get_puck_obj(address):
return BasePlate.getChild(address)

View File

@@ -1,23 +1,279 @@
import json
import org.python.core.PyDictionary as PyDictionary
SAMPLE_INFO_KEYS = ["userName", "dewarName", "puckName", "puckBarcode", "puckType", "puckAddress",
"sampleName", "samplePosition", "sampleStatus", "sampleMountCount"]
samples_info = []
def set_samples_info(info):
global samples_info
if (is_string(info)):
info = json.loads(info)
if not is_list(info):
raise Exception("Sample info must be a list (given object type is " + str(type(info)) + ")")
#for sample in info:
# if not (type(sample) is PyDictionary):
# raise Exception("Sample info element must be a dictionary (given object type is " + str(type(sample)) + ")")
#Sanitize list
remove = []
for sample in info:
try:
if set(sample.keys()) != set(SAMPLE_INFO_KEYS):
raise Exception()
except:
remove.append(sample)
for el in remove:
info.remove(el)
print "Invalid samples info element: " + str(el)
samples_info = info
return samples_info
save_samples_info()
#Trust beamline on assignments, so update puck info
update_puck_table()
def clear_samples_info():
set_samples_info([])
def save_samples_info():
data = get_samples_info(True)
output_file = open( get_context().setup.expandPath("{context}/samples_info.json") , "w")
output_file.write(data)
output_file.close()
def restore_samples_info():
try:
inputfile = open(get_context().setup.expandPath("{context}/samples_info.json"), "r")
info = inputfile.read()
except:
print >> sys.stderr, "Error reading sample info file: " + str(sys.exc_info()[1])
info = []
set_samples_info(info)
def get_samples_info(as_json=True):
global sample_info
return json.dumps(samples_info) if as_json else samples_info
return json.dumps(samples_info) if as_json else samples_info
def has_puck_datamatrix(datamatrix):
if samples_info is not None:
for si in samples_info:
if si["puckBarcode"] == datamatrix:
return True
return False
def add_puck_datamatrix(barcode, address = "", dewar = "Unknown", user = "Unknown", puck = "Unknown", type = "unipuck", sample_prefix = "Sample"):
if has_puck_datamatrix(barcode):
raise Exception("Datamatrix already defined: " + str(barcode))
for s in range(1,17):
info = \
{ "userName": user, \
"dewarName": dewar, \
"puckName": puck, \
"puckBarcode": address if barcode is None else barcode, \
"puckType": type, \
"puckAddress": address,\
"sampleName": sample_prefix + " " + str(s), \
"samplePosition": str(s),\
"sampleStatus": "Unknown", \
"sampleMountCount": "0",
}
samples_info.append(info)
save_samples_info()
def remove_puck_datamatrix(barcode):
remove = []
for si in samples_info:
if si["puckBarcode"] == barcode:
remove.append(si)
for el in remove: samples_info.remove(el)
save_samples_info()
def set_puck_datamatrix(puck, datamatrix):
if puck is None:
puck = ""
if datamatrix is None:
datamatrix = ""
if samples_info is not None:
for si in samples_info:
if si["puckBarcode"] == datamatrix:
si["puckAddress"] = puck
elif si["puckAddress"] == puck:
si["puckAddress"] = ""
save_samples_info()
def reset_puck_datamatrix(puck = None):
if samples_info is not None:
for si in samples_info:
if (si["puckAddress"] == puck) or (puck is None):
si["puckAddress"] = ""
save_samples_info()
def get_puck_datamatrix():
ret = {}
for si in samples_info:
if si["puckBarcode"] is not None and si["puckBarcode"]!="":
ret[si["puckBarcode"]] = si["puckAddress"]
return ret
def get_puck_address(barcode):
try:
return get_puck_datamatrix()[barcode]
except:
return None
def update_puck_table():
dms = get_puck_datamatrix()
for barcode in dms.keys():
address = dms[barcode]
puck = get_puck_obj(address)
if puck is not None:
puck.id = barcode
#Sample mount/unmount
def update_samples_info_sample_mount(puck_address, sample_position, sample_detected):
try:
if (samples_info is not None) and (puck_address is not None):
for si in samples_info:
if str(si["puckAddress"]) == str(puck_address) and str(si["samplePosition"]) == str(sample_position):
if sample_detected:
if si["sampleStatus"] != "Mounted":
si["sampleStatus"] = "Mounted"
try:
mount_count = int(si["sampleMountCount"])
except:
mount_count = 0
si["sampleMountCount"] = mount_count + 1
else:
si["sampleStatus"] = "Unknown"
save_samples_info()
return
except:
pass
def update_samples_info_sample_unmount(puck_address, sample_position):
try:
if (samples_info is not None) and (puck_address is not None):
for si in samples_info:
if str(si["puckAddress"]) == str(puck_address) and str(si["samplePosition"]) == str(sample_position):
si["sampleStatus"] = "HasBeenMounted"
save_samples_info()
return
except:
pass
test_sample_data = [ \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0001", \
"puckType": "unipuck", \
"puckAddress": "A1",\
"sampleName": "MySample 1", \
"samplePosition": 1,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0001", \
"puckType": "unipuck", \
"puckAddress": "A1",\
"sampleName": "MySample 2", \
"samplePosition": 2,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0001", \
"puckType": "unipuck", \
"puckAddress": "A1",\
"sampleName": "MySample 3", \
"samplePosition": 3,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0001", \
"puckType": "unipuck", \
"puckAddress": "A1",\
"sampleName": "MySample 4", \
"samplePosition": 4,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0001", \
"puckType": "unipuck", \
"puckAddress": "A1",\
"sampleName": "MySample 5", \
"samplePosition": 5,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0002", \
"puckType": "unipuck", \
"puckAddress": "C2",\
"sampleName": "MySample 1", \
"samplePosition": 1,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0002", \
"puckType": "unipuck", \
"puckAddress": "C2",\
"sampleName": "MySample 2", \
"samplePosition": 2,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0002", \
"puckType": "unipuck", \
"puckAddress": "C2",\
"sampleName": "MySample 3", \
"samplePosition": 3,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0002", \
"puckType": "unipuck", \
"puckAddress": "C2",\
"sampleName": "MySample 4", \
"samplePosition": 4,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
{ "userName": "Alexandre", \
"dewarName": "TEST", \
"puckName": "My puck", \
"puckBarcode": "AAA0002", \
"puckType": "unipuck", \
"puckAddress": "C2",\
"sampleName": "MySample 5", \
"samplePosition": 5,\
"sampleStatus": "Present", \
"sampleMountCount": 0,
} , \
]

View File

@@ -22,8 +22,8 @@ joint_forces = False
class RobotSC(RobotTCP):
def __init__(self, name, server, timeout = 1000, retries = 1):
RobotTCP.__init__(self, name, server, timeout, retries)
self.set_tasks(["getDewar", "putDewar", "putGonio", "getGonio", "robotRecover", "moveDewar", "movePark", "moveGonio","moveHeater", "moveScanner","moveHome"])
self.set_known_points(["pPark", "pGonioHome", "pDewarWait", "pGonioGet", "pScanHome", "pHeaterHome", "pHeater", "pHeaterBottom", "pScanStop","pHelium", "pHome"])
self.set_tasks(["getDewar", "putDewar", "putGonio", "getGonio", "robotRecover", "moveDewar", "moveCold", "movePark", "moveGonio","moveHeater", "moveScanner","moveHome"])
self.set_known_points(["pPark", "pGonioHome", "pDewarWait", "pGonioGet", "pScanHome", "pHeaterHome", "pHeater", "pHeaterBottom", "pScanStop","pHelium", "pHome", "pCold"])
self.setPolling(DEFAULT_ROBOT_POLLING)
def move_dewar(self):
@@ -31,6 +31,11 @@ class RobotSC(RobotTCP):
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
self.assert_dewar()
def move_cold(self):
self.start_task('moveCold')
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
self.assert_cold()
def move_home(self):
self.start_task('moveHome')
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
@@ -141,6 +146,9 @@ class RobotSC(RobotTCP):
def is_park(self):
return self.is_in_point("pPark")
def is_cold(self):
return self.is_in_point("pCold")
def is_home(self):
return self.is_in_point("pHome")
@@ -175,6 +183,9 @@ class RobotSC(RobotTCP):
def assert_heater_home(self):
self.assert_in_point("pHeaterHome")
def assert_cold(self):
self.assert_in_point("pCold")
def assert_heater(self):
self.assert_in_point("pHeater")

View File

@@ -125,7 +125,7 @@ def release_psys():
# Drier
###################################################################################################
MAX_HEATER_TIME = 15000
MAX_HEATER_TIME = 45000
def set_air_stream(state):

View File

@@ -7,6 +7,8 @@ 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")
@@ -76,6 +78,7 @@ add_device(img.getCamera(), force = True)
###################################################################################################
run("data/samples")
run("data/pucks")
run("motion/tools")
run("motion/mount")
run("motion/unmount")
@@ -88,6 +91,7 @@ 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/dry")
run("motion/homing_hexiposi")
@@ -216,7 +220,7 @@ for l in dewar_level.listeners:
dewar_level.addListener(dewar_level_listener)
dewar_level_listener.onValueChanged(dewar_level, dewar_level.take(), None)
###################################################################################################
@@ -230,10 +234,15 @@ cover_detection_debug = False
def is_puck_loading():
return robot.state == State.Ready and robot.take()["pos"] == 'pPark' and feedback_psys_safety.take() == False
return robot.state == State.Ready and robot.take()["pos"] == 'pPark' and \
feedback_psys_safety.take() == False and \
not guiding_tool_park.read()
update()
add_device(Controller.getInstance().basePlate, True)
restore_samples_info()
print "Initialization complete"

View File

@@ -4,7 +4,7 @@ def get_dewar(segment, puck, sample, force=False):
print "get_dewar: ", segment, puck, sample, force
#Initial checks
assertValidAddress(segment, puck, sample)
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()

View File

@@ -4,7 +4,7 @@ def mount(segment, puck, sample, force=False, read_dm=False):
print "mount: ", segment, puck, sample, force
start = time.time()
#Initial checks
assertValidAddress(segment, puck, sample)
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()
@@ -45,8 +45,11 @@ def mount(segment, puck, sample, force=False, read_dm=False):
smart_magnet.set_mount_current()
try:
robot.put_gonio()
robot.move_dewar()
if smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) == False:
robot.move_dewar()
sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0)
#TODO: Should do on finally?
update_samples_info_sample_mount(get_puck_name(segment, puck), sample, sample_detected)
if sample_detected == False:
raise Exception("No pin detected on gonio")
finally:
smart_magnet.set_default_current()

View File

@@ -0,0 +1,18 @@
def move_cold():
"""
"""
print "move_cold"
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
#Enabling
enable_motion()
if not robot.is_cold():
robot.move_cold()

View File

@@ -4,7 +4,7 @@ def put_dewar(segment, puck, sample, force=False):
print "put_dewar: ", segment, puck, sample, force
#Initial checks
assertValidAddress(segment, puck, sample)
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()

View File

@@ -128,7 +128,7 @@ def update_tool(tool=None, x_offset=0.0, y_offset=0.0, z_offset=0.0):
robot.save_program()
def assertValidAddress(segment, puck, sample):
def assert_valid_address(segment, puck, sample):
if is_string(segment):
segment = ord(segment.upper()) - ord('A') +1
if segment<=0 or segment >6:
@@ -137,4 +137,20 @@ def assertValidAddress(segment, puck, sample):
raise Exception ("Invalid puck")
if sample<=0 or sample >16:
raise Exception ("Invalid sample")
def get_puck_name(segment, puck):
try:
assert_valid_address(segment, puck, 1)
if type(segment) is int:
segment = chr( ord('A') + (pos-1))
elif type(segment) is str:
segment = pos.upper()
else:
return None
return segment + str(puck)
except:
return None

View File

@@ -4,7 +4,7 @@ def unmount(segment, puck, sample, force=False):
print "unmount: ", segment, puck, sample, force
#Initial checks
assertValidAddress(segment, puck, sample)
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()
@@ -34,6 +34,8 @@ def unmount(segment, puck, sample, force=False):
smart_magnet.set_unmount_current()
try:
robot.get_gonio()
#TODO: Shuld check if smart magnet detection is off?
update_samples_info_sample_unmount(get_puck_name(segment, puck))
robot.move_dewar()
robot.put_dewar(segment, puck, sample)
finally:

View File

@@ -1,11 +1,14 @@
cover_detection_debug=False
for pos in ['A', 'B', 'C', 'D', 'E', 'F']:
print "Moving to ", pos
hexiposi.move(pos)
ret = run("imgproc/CoverDetection")
det = ret[0]
print "Detected: ", det
if det != pos:
raise "Position error"
cover_detection_debug=True
while True:
for pos in ['A', 'B', 'C', 'D', 'E', 'F']:
print "Moving to ", pos
hexiposi.move(pos)
move_home()
move_park()
time.sleep(2.0)
ret = run("imgproc/CoverDetection")
det = ret[0]
print "Detected: ", det
if det != pos:
raise Exception("Position error")