This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#Thu Oct 25 15:44:44 CEST 2018
|
||||
maxValue=0.4
|
||||
#Thu Nov 08 11:41:48 CET 2018
|
||||
maxValue=1.0
|
||||
minValue=0.0
|
||||
offset=0.0
|
||||
precision=2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#Thu Oct 25 15:44:44 CEST 2018
|
||||
maxValue=0.4
|
||||
#Thu Nov 08 11:41:48 CET 2018
|
||||
maxValue=1.0
|
||||
minValue=0.0
|
||||
offset=0.0
|
||||
precision=2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#Thu Oct 25 15:44:44 CEST 2018
|
||||
maxValue=0.4
|
||||
#Thu Nov 08 11:41:48 CET 2018
|
||||
maxValue=1.0
|
||||
minValue=0.0
|
||||
offset=0.0
|
||||
precision=2
|
||||
|
||||
Binary file not shown.
@@ -18,12 +18,9 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
<Component id="panelState" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="panelCurrent" max="32767" attributes="0"/>
|
||||
<Component id="jPanel2" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="panelCurrent" max="32767" attributes="0"/>
|
||||
<Component id="jPanel2" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -183,10 +180,10 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonHoming" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="buttonMount" linkSize="1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ledMountPosition" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -194,10 +191,10 @@
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="buttonHoming" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonMount" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="2" attributes="0">
|
||||
<Component id="jLabel2" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="ledMountPosition" alignment="2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@@ -205,21 +202,18 @@
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="buttonHoming">
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Home Fast Table"/>
|
||||
<Property name="horizontalAlignment" type="int" value="11"/>
|
||||
<Property name="text" type="java.lang.String" value="Mount Position:"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonHomingActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonMount">
|
||||
<Component class="ch.psi.pshell.swing.Led" name="ledMountPosition">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Set Mount Position"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="SansSerif" size="18" style="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMountActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
|
||||
@@ -27,6 +27,19 @@ public class SmartMagnetPanel extends DevicePanel {
|
||||
|
||||
}
|
||||
panelState.setDevice(device);
|
||||
this.startTimer(1000, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTimer(){
|
||||
Color color = Color.RED;
|
||||
try{
|
||||
if (Context.getInstance().evalLineBackground("in_mount_position").equals(Boolean.TRUE)){
|
||||
color = Color.GREEN;
|
||||
}
|
||||
} catch (Exception ex){
|
||||
}
|
||||
ledMountPosition.setColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,8 +88,8 @@ public class SmartMagnetPanel extends DevicePanel {
|
||||
panelState = new ch.psi.pshell.swing.DeviceStatePanel();
|
||||
panelCurrent = new ch.psi.pshell.swing.ProcessVariablePanel();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
buttonHoming = new javax.swing.JButton();
|
||||
buttonMount = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
ledMountPosition = new ch.psi.pshell.swing.Led();
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Status"));
|
||||
|
||||
@@ -153,41 +166,29 @@ public class SmartMagnetPanel extends DevicePanel {
|
||||
|
||||
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Gonio"));
|
||||
|
||||
buttonHoming.setText("Home Fast Table");
|
||||
buttonHoming.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonHomingActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
jLabel2.setText("Mount Position:");
|
||||
|
||||
buttonMount.setText("Set Mount Position");
|
||||
buttonMount.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonMountActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
ledMountPosition.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
|
||||
jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonHoming)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonMount)
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(ledMountPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonHoming, buttonMount});
|
||||
|
||||
jPanel2Layout.setVerticalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(buttonHoming)
|
||||
.addComponent(buttonMount))
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(ledMountPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@@ -197,11 +198,9 @@ public class SmartMagnetPanel extends DevicePanel {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(panelState, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(panelCurrent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGap(0, 0, 0))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(panelCurrent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -216,45 +215,15 @@ public class SmartMagnetPanel extends DevicePanel {
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonHomingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHomingActionPerformed
|
||||
try{
|
||||
Context.getInstance().evalLineAsync("home_fast_table()").handle((ret, ex) -> {
|
||||
if (SmartMagnetPanel.this.isShowing()){
|
||||
if (ex != null){
|
||||
showException((Exception)ex);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
} catch (Exception ex){
|
||||
this.showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonHomingActionPerformed
|
||||
|
||||
private void buttonMountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMountActionPerformed
|
||||
try{
|
||||
Context.getInstance().evalLineAsync("set_mount_position()").handle((ret, ex) -> {
|
||||
if (SmartMagnetPanel.this.isShowing()){
|
||||
if (ex != null){
|
||||
showException((Exception)ex);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
} catch (Exception ex){
|
||||
this.showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonMountActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonHoming;
|
||||
private javax.swing.JButton buttonMount;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel10;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private ch.psi.pshell.swing.Led ledMountPosition;
|
||||
private ch.psi.pshell.swing.Led ledMounted;
|
||||
private ch.psi.pshell.swing.Led ledStatus;
|
||||
private ch.psi.pshell.swing.ProcessVariablePanel panelCurrent;
|
||||
|
||||
@@ -38,7 +38,12 @@ class TellClient(PShellClient):
|
||||
if self.state != "Ready":
|
||||
raise Exception("Invalid state: " + str(self.state))
|
||||
|
||||
|
||||
def set_in_mount_position(self, value):
|
||||
self.eval("in_mount_position = " + str(value) +"&")
|
||||
|
||||
def is_in_mount_position(self):
|
||||
return self.eval("in_mount_position&").lower()=="true"
|
||||
|
||||
def get_samples_info(self):
|
||||
return json.loads(self.eval("get_samples_info()&"))
|
||||
|
||||
@@ -89,6 +94,11 @@ class TellClient(PShellClient):
|
||||
self.abort()
|
||||
self.eval("robot.stop_task()&")
|
||||
|
||||
def set_gonio_mount_position(homing = False):
|
||||
if homing:
|
||||
self.eval("home_fast_table()")
|
||||
self.eval("set_mount_position()")
|
||||
|
||||
def get_mounted_sample(self):
|
||||
ret = self.eval("get_setting('mounted_sample_position')&").strip()
|
||||
return None if len(ret)==0 else ret
|
||||
@@ -111,14 +121,21 @@ class TellClient(PShellClient):
|
||||
def get_detected_pucks(self):
|
||||
return self.eval("get_detected_pucks()&")
|
||||
|
||||
def set_pin_offset(self, value):
|
||||
self.eval("set_pin_offset(" + str(value)+ ")&")
|
||||
|
||||
def get_pin_offset(self):
|
||||
return self.eval("get_pin_offset()&")
|
||||
|
||||
def print_info(self):
|
||||
print ("State: " + str(self.get_state()))
|
||||
print ("Mounted Sample: " + str(self.get_mounted_sample()))
|
||||
print ("System Check: " + str(self.get_system_check()))
|
||||
print ("Mounted sample: " + str(self.get_mounted_sample()))
|
||||
print ("System check: " + str(self.get_system_check()))
|
||||
print ("Robot state: " + str(self.get_robot_state()))
|
||||
print ("Robot status: " + str(self.get_robot_status()))
|
||||
print ("Detected Pucks: " + str(self.get_detected_pucks()))
|
||||
print ("Detected pucks: " + str(self.get_detected_pucks()))
|
||||
print ("Pin offset: " + str(self.get_pin_offset()))
|
||||
print ("Mount position: " + str(self.is_in_mount_position()))
|
||||
print ("")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -14,18 +14,20 @@ def info():
|
||||
|
||||
def help():
|
||||
print ("Commands: \n\thelp()\n\tinfo()\n\tmount(segment, puck, sample)\n\tunmount() \n\tdry() " \
|
||||
"\n\tscan(segment, puck, sample=None) \n\tmove_cold() \n\ttrash() \n\tabort()\n")
|
||||
"\n\tscan(segment, puck, sample=None) \n\tmove_cold() \n\ttrash() \n\tabort() " \
|
||||
"\n\tset_pin_offset(value)")
|
||||
|
||||
def set_gonio():
|
||||
pass
|
||||
def assert_transfer_allowed():
|
||||
if not tell.is_in_mount_position():
|
||||
raise Exception("Gonio is not in mount position")
|
||||
|
||||
def mount(segment, puck, sample):
|
||||
set_gonio()
|
||||
assert_transfer_allowed()
|
||||
cmd = tell.mount(segment, puck, sample, True, True, True)
|
||||
print (tell.wait_cmd(cmd))
|
||||
|
||||
def unmount():
|
||||
set_gonio()
|
||||
assert_transfer_allowed()
|
||||
cmd=tell.unmount(force=True)
|
||||
print (tell.wait_cmd(cmd))
|
||||
|
||||
@@ -51,6 +53,9 @@ def scan(segment, puck, sample=None):
|
||||
def abort():
|
||||
tell.abort_cmd()
|
||||
|
||||
def set_pin_offset(value):
|
||||
tell.set_pin_offset(value)
|
||||
|
||||
info()
|
||||
help()
|
||||
|
||||
|
||||
@@ -23,10 +23,6 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
assert_valid_address(segment, puck, sample)
|
||||
assert_puck_detected(segment, puck)
|
||||
|
||||
if auto_unmount:
|
||||
if get_setting("mounted_sample_position") is not None:
|
||||
unmount()
|
||||
|
||||
if robot.simulated:
|
||||
time.sleep(3.0)
|
||||
mount_sample_detected = True
|
||||
@@ -41,14 +37,17 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False)
|
||||
robot.assert_cleared()
|
||||
#robot.assert_in_known_point()
|
||||
hexiposi.assert_homed()
|
||||
|
||||
set_status("Mounting: " + str(segment) + str(puck) + str(sample))
|
||||
|
||||
|
||||
try:
|
||||
smart_magnet.enforce_sample_detection()
|
||||
if smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) == True:
|
||||
raise Exception("Pin detected on gonio")
|
||||
|
||||
if auto_unmount and (get_setting("mounted_sample_position") is not None):
|
||||
unmount(force = True)
|
||||
else:
|
||||
raise Exception("Pin detected on gonio")
|
||||
|
||||
set_status("Mounting: " + str(segment) + str(puck) + str(sample))
|
||||
#location = robot.get_current_point()
|
||||
|
||||
#Enabling
|
||||
|
||||
@@ -7,7 +7,7 @@ def unmount(segment = None, puck = None, sample = None, force=False):
|
||||
pos = get_setting("mounted_sample_position")
|
||||
if pos is None:
|
||||
raise Exception("Mounted sample position is not defined")
|
||||
segment, puck , sample = pos[0:1], int(pos[1]), int(pos[2])
|
||||
segment, puck , sample = pos[0:1], int(pos[1]), int(pos[2:])
|
||||
print "Mounted sample position: ", segment, puck , sample
|
||||
is_aux = (segment == AUX_SEGMENT)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user