diff --git a/plugins/Commands.form b/plugins/Commands.form
index f263024..299aaee 100644
--- a/plugins/Commands.form
+++ b/plugins/Commands.form
@@ -161,9 +161,10 @@
-
+
+
-
+
@@ -171,19 +172,21 @@
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -205,7 +208,7 @@
-
+
@@ -213,7 +216,7 @@
-
+
@@ -221,7 +224,7 @@
-
+
@@ -248,12 +251,11 @@
-
+
-
@@ -355,12 +357,20 @@
-
+
-
+
+
+
+
+
+
+
+
+
diff --git a/plugins/Commands.java b/plugins/Commands.java
index c542995..cdb4482 100644
--- a/plugins/Commands.java
+++ b/plugins/Commands.java
@@ -50,10 +50,13 @@ public class Commands extends Panel {
@Override
public void onStateChange(State state, State former) {
+ boolean enabled = (state == State.Ready);
for (Component c: SwingUtils.getComponentsByType(this, JComponent.class)){
- c.setEnabled(state == State.Ready);
+ c.setEnabled(enabled);
}
- buttonMoveAux.setEnabled(state == State.Ready);
+ spinnerSegment.setEnabled(enabled && !checkAuxiliary.isSelected());
+ spinnerPuck.setEnabled(enabled && !checkAuxiliary.isSelected());
+ buttonScanPuck.setEnabled(enabled && !checkAuxiliary.isSelected());
}
@Override
@@ -135,7 +138,8 @@ public class Commands extends Panel {
checkDatamatrix = new javax.swing.JCheckBox();
buttonUnmount = new javax.swing.JButton();
buttonScanPin = new javax.swing.JButton();
- buttonScanPin1 = new javax.swing.JButton();
+ buttonScanPuck = new javax.swing.JButton();
+ checkAuxiliary = new javax.swing.JCheckBox();
pnLowLevel = new javax.swing.JPanel();
buttonMovePark = new javax.swing.JButton();
buttonMoveCold = new javax.swing.JButton();
@@ -297,11 +301,10 @@ public class Commands extends Panel {
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel4)
.addComponent(checkForce))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel5)
- .addComponent(checkDatamatrix))
- .addGap(0, 0, 0))
+ .addComponent(checkDatamatrix)))
);
buttonUnmount.setText("Unmount");
@@ -318,10 +321,17 @@ public class Commands extends Panel {
}
});
- buttonScanPin1.setText("Scan Puck");
- buttonScanPin1.addActionListener(new java.awt.event.ActionListener() {
+ buttonScanPuck.setText("Scan Puck");
+ buttonScanPuck.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonScanPin1ActionPerformed(evt);
+ buttonScanPuckActionPerformed(evt);
+ }
+ });
+
+ checkAuxiliary.setText("Auxiliary");
+ checkAuxiliary.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ checkAuxiliaryActionPerformed(evt);
}
});
@@ -335,8 +345,9 @@ public class Commands extends Panel {
.addComponent(buttonMount, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonUnmount, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonScanPin, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(buttonScanPin1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(18, 31, Short.MAX_VALUE)
+ .addComponent(buttonScanPuck, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(checkAuxiliary))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
@@ -348,15 +359,17 @@ public class Commands extends Panel {
.addGroup(pnTransferLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pnTransferLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pnTransferLayout.createSequentialGroup()
.addComponent(buttonMount)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonUnmount)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonScanPin)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(buttonScanPuck)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(buttonScanPin1))
- .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(checkAuxiliary)))
.addContainerGap())
);
@@ -633,8 +646,8 @@ public class Commands extends Panel {
}//GEN-LAST:event_buttonEnableAllActionPerformed
private void buttonMountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMountActionPerformed
- String segment = (String) spinnerSegment.getValue();
- int puck = (Integer) spinnerPuck.getValue();
+ String segment = checkAuxiliary.isSelected() ? "X" : (String) spinnerSegment.getValue();
+ int puck = checkAuxiliary.isSelected() ? 1 :(Integer) spinnerPuck.getValue();
int sample = (Integer) spinnerSample.getValue();
String force = checkForce.isSelected() ? "True" : "False";
String readDatamatrix = checkDatamatrix.isSelected() ? "True" : "False";
@@ -647,8 +660,8 @@ public class Commands extends Panel {
}//GEN-LAST:event_buttonMoveAuxActionPerformed
private void buttonUnmountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUnmountActionPerformed
- String segment = (String) spinnerSegment.getValue();
- int puck = (Integer) spinnerPuck.getValue();
+ String segment = checkAuxiliary.isSelected() ? "X" : (String) spinnerSegment.getValue();
+ int puck = checkAuxiliary.isSelected() ? 1 :(Integer) spinnerPuck.getValue();
int sample = (Integer) spinnerSample.getValue();
String force = checkForce.isSelected() ? "True" : "False";
execute("unmount('" + segment + "'," + puck + "," + sample + ", force=" + force + ")");
@@ -729,19 +742,19 @@ public class Commands extends Panel {
}//GEN-LAST:event_buttonResetPuckIdsActionPerformed
private void buttonScanPinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScanPinActionPerformed
- String segment = (String) spinnerSegment.getValue();
- int puck = (Integer) spinnerPuck.getValue();
+ String segment = checkAuxiliary.isSelected() ? "X" : (String) spinnerSegment.getValue();
+ int puck = checkAuxiliary.isSelected() ? 1 :(Integer) spinnerPuck.getValue();
int sample = (Integer) spinnerSample.getValue();
String force = checkForce.isSelected() ? "True" : "False";
execute("scan_pin('" + segment + "'," + puck + "," + sample + ", force=" + force + ")", false, true);
}//GEN-LAST:event_buttonScanPinActionPerformed
- private void buttonScanPin1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScanPin1ActionPerformed
- String segment = (String) spinnerSegment.getValue();
- int puck = (Integer) spinnerPuck.getValue();
+ private void buttonScanPuckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonScanPuckActionPerformed
+ String segment = checkAuxiliary.isSelected() ? "X" : (String) spinnerSegment.getValue();
+ int puck = checkAuxiliary.isSelected() ? 1 :(Integer) spinnerPuck.getValue();
String force = checkForce.isSelected() ? "True" : "False";
execute("scan_puck('" + segment + "'," + puck + ", force=" + force + ")", false, true);
- }//GEN-LAST:event_buttonScanPin1ActionPerformed
+ }//GEN-LAST:event_buttonScanPuckActionPerformed
private void buttonGetAuxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGetAuxActionPerformed
int sample = (Integer) spinnerSample.getValue();
@@ -753,6 +766,10 @@ public class Commands extends Panel {
execute("put_aux('" + sample + ")");
}//GEN-LAST:event_buttonPutAuxActionPerformed
+ private void checkAuxiliaryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAuxiliaryActionPerformed
+ onStateChange(getState(), null);
+ }//GEN-LAST:event_checkAuxiliaryActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonClearSampleDb;
private javax.swing.JButton buttonDry;
@@ -775,8 +792,9 @@ public class Commands extends Panel {
private javax.swing.JButton buttonRecover;
private javax.swing.JButton buttonResetPuckIds;
private javax.swing.JButton buttonScanPin;
- private javax.swing.JButton buttonScanPin1;
+ private javax.swing.JButton buttonScanPuck;
private javax.swing.JButton buttonUnmount;
+ private javax.swing.JCheckBox checkAuxiliary;
private javax.swing.JCheckBox checkDatamatrix;
private javax.swing.JCheckBox checkForce;
private javax.swing.JCheckBox ckeckParkOnDry;
diff --git a/script/devices/SmartMagnet.py b/script/devices/SmartMagnet.py
index 21b4b25..c0ad89a 100644
--- a/script/devices/SmartMagnet.py
+++ b/script/devices/SmartMagnet.py
@@ -99,10 +99,10 @@ class SmartMagnet(DeviceBase):
self.set_resting_current()
def is_resting_current(self):
- return self.get_current() != self.config.getFieldValue("restingCurrent")
+ return self.get_current() == self.config.getFieldValue("restingCurrent")
- #Setting resting curren t to better detect sample
+ #Setting resting current to better detect sample
def enforce_sample_detection(self):
if not self.is_resting_current():
self.set_resting_current()
diff --git a/script/local.py b/script/local.py
index 3d405f0..2af1d40 100644
--- a/script/local.py
+++ b/script/local.py
@@ -97,6 +97,7 @@ run("motion/move_aux")
run("motion/get_aux")
run("motion/put_aux")
run("motion/dry")
+run("motion/trash")
run("motion/homing_hexiposi")
run("motion/scan_pin")
run("motion/robot_recover")
diff --git a/script/motion/calibrate_tool.py b/script/motion/calibrate_tool.py
new file mode 100644
index 0000000..9e47630
--- /dev/null
+++ b/script/motion/calibrate_tool.py
@@ -0,0 +1,18 @@
+def calibrate_tool():
+ """
+ """
+ print "calibrate_tool"
+
+ #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_gonio():
+ robot.move_gonio()
+ robot.put_gonio()
diff --git a/script/motion/mount.py b/script/motion/mount.py
index 4ef32b7..f3a712d 100644
--- a/script/motion/mount.py
+++ b/script/motion/mount.py
@@ -9,7 +9,7 @@ def mount(segment, puck, sample, force=False, read_dm=False):
start = time.time()
- is_aux = segment == AUX_SEGMENT
+ is_aux = (segment == AUX_SEGMENT)
puck_address = get_puck_address(puck)
if puck_address is None:
puck_obj = get_puck_obj_by_id(puck)
@@ -46,8 +46,7 @@ def mount(segment, puck, sample, force=False, read_dm=False):
robot.move_aux()
robot.get_aux(sample)
- robot.move_home()
-
+
else:
set_hexiposi(segment)
diff --git a/script/motion/recover.py b/script/motion/recover.py
index 97d430e..bee6369 100644
--- a/script/motion/recover.py
+++ b/script/motion/recover.py
@@ -6,15 +6,15 @@ RECOVER_DESC = "mRecovery"
RECOVER_TOOL = TOOL_DEFAULT
known_segments = [ ("pHome", "pPark", 50), \
- ("pHome", "pGonioH", 30), \
+ ("pHome", "pGonio", 30), \
("pHome", "pScan", 25), \
("pHome", "pHeater", 75), \
("pHome", "pDewar", 10), \
("pHome", "pHelium", 230), \
- ("pGonioH", "pGonioG", 10), \
+ ("pGonio", "pGonioG", 10), \
("pPark", "pHeat", 40), \
("pHeater", "pHeatB", 10), \
- ("pPark", "pAux", 30), \
+ ("pPark", "pAux", 50), \
]
def get_dist_to_line(segment):
diff --git a/script/motion/scan_pin.py b/script/motion/scan_pin.py
index 5deaa61..9355466 100644
--- a/script/motion/scan_pin.py
+++ b/script/motion/scan_pin.py
@@ -5,6 +5,7 @@ def scan_pin(segment, puck, sample, force=False):
#Initial checks
assert_valid_address(segment, puck, sample)
assert_puck_detected(segment, puck)
+ is_aux = (segment == AUX_SEGMENT)
robot.assert_no_task()
robot.reset_motion()
@@ -17,20 +18,31 @@ def scan_pin(segment, puck, sample, force=False):
set_status("Scanning pin: " + str(pin_name))
enable_motion()
- set_hexiposi(segment)
- if not force:
- visual_check_hexiposi(segment)
-
- if not robot.is_dewar():
- robot.move_dewar()
+
+ if is_aux:
+ if not robot.is_aux():
+ robot.move_aux()
- robot.get_dewar(segment, puck, sample)
-
+ robot.get_aux(sample)
+ else:
+ set_hexiposi(segment)
+ if not force:
+ visual_check_hexiposi(segment)
+
+ if not robot.is_dewar():
+ robot.move_dewar()
+
+ robot.get_dewar(segment, puck, sample)
+
(detected, dm) = move_scanner()
update_samples_info_sample_scan(get_puck_name(segment, puck), sample, detected, dm)
-
- robot.move_dewar()
- robot.put_dewar(segment, puck, sample)
+
+ if is_aux:
+ robot.move_aux()
+ robot.put_aux( sample)
+ else:
+ robot.move_dewar()
+ robot.put_dewar(segment, puck, sample)
ret = "Empty"
if detected:
if (dm is None) or (len(dm.strip())==0):
@@ -41,6 +53,8 @@ def scan_pin(segment, puck, sample, force=False):
def scan_puck(segment, puck, force=False):
+ if segment == AUX_SEGMENT:
+ raise Exception("Cannot scan auxiliary puck")
ret = []
for i in range(16):
ret.append(scan_pin (segment, puck, i+1, force))
diff --git a/script/motion/trash.py b/script/motion/trash.py
new file mode 100644
index 0000000..d9c229d
--- /dev/null
+++ b/script/motion/trash.py
@@ -0,0 +1,27 @@
+def trash():
+ """
+ """
+ print "trash"
+
+ #Initial checks
+ robot.assert_no_task()
+ robot.reset_motion()
+ robot.wait_ready()
+ robot.assert_cleared()
+ #robot.assert_in_known_point()
+
+ #Enabling
+ enable_motion()
+
+ robot.move_heater(to_bottom = False)
+ robot.move_heater(to_bottom = True)
+
+ for i in range(3):
+ robot.open_tool()
+ time.sleep(1.0)
+ robot.close_tool()
+
+ robot.move_heater(to_bottom = False)
+ robot.move_home()
+
+
\ No newline at end of file
diff --git a/script/motion/unmount.py b/script/motion/unmount.py
index 763d846..84b2464 100644
--- a/script/motion/unmount.py
+++ b/script/motion/unmount.py
@@ -9,7 +9,7 @@ def unmount(segment = None, puck = None, sample = None, force=False):
raise Exception("Mounted sample position is not defined")
segment, puck , sample = pos[0:1], int(pos[1]), int(pos[2])
print "Mounted sample position: ", segment, puck , sample
- is_aux = segment == AUX_SEGMENT
+ is_aux = (segment == AUX_SEGMENT)
#Initial checks
assert_valid_address(segment, puck, sample)
@@ -49,10 +49,8 @@ def unmount(segment = None, puck = None, sample = None, force=False):
robot.get_gonio()
if is_aux:
- robot.move_dewar()
robot.move_aux()
robot.put_aux( sample)
- robot.move_home()
else:
#TODO: Shuld check if smart magnet detection is off?
update_samples_info_sample_unmount(get_puck_name(segment, puck), sample)