diff --git a/plugins/Expert.form b/plugins/Expert.form
index 98bf7f2..a60bd7a 100644
--- a/plugins/Expert.form
+++ b/plugins/Expert.form
@@ -17,43 +17,15 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
@@ -61,97 +33,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -165,12 +62,12 @@
-
+
-
+
@@ -205,22 +102,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -233,24 +114,24 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
@@ -274,5 +155,201 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/plugins/Expert.java b/plugins/Expert.java
index 1bef3f0..9cd7d2a 100644
--- a/plugins/Expert.java
+++ b/plugins/Expert.java
@@ -7,6 +7,9 @@ import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
/**
*
@@ -15,6 +18,7 @@ public class Expert extends Panel {
public Expert() {
initComponents();
+ ((JSpinner.DefaultEditor)spinnerSegment.getEditor()).getTextField().setHorizontalAlignment(JTextField.RIGHT);
}
//Overridable callbacks
@@ -71,52 +75,26 @@ public class Expert extends Panel {
// //GEN-BEGIN:initComponents
private void initComponents() {
+ jPanel1 = new javax.swing.JPanel();
+ buttonEnable = new javax.swing.JButton();
+ buttonDisable = new javax.swing.JButton();
+ jPanel2 = new javax.swing.JPanel();
+ buttonHomingHexiposi = new javax.swing.JButton();
+ buttonPositionsHexiposi = new javax.swing.JButton();
+ jPanel3 = new javax.swing.JPanel();
+ buttonReleasePsys = new javax.swing.JButton();
buttonEnableAll = new javax.swing.JButton();
+ buttonReleaseLocal = new javax.swing.JButton();
+ jPanel4 = new javax.swing.JPanel();
+ spinnerSample = new javax.swing.JSpinner();
+ checkForce = new javax.swing.JCheckBox();
buttonMount = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
spinnerSegment = new javax.swing.JSpinner();
jLabel2 = new javax.swing.JLabel();
spinnerPuck = new javax.swing.JSpinner();
jLabel3 = new javax.swing.JLabel();
- spinnerSample = new javax.swing.JSpinner();
- checkFirst = new javax.swing.JCheckBox();
- jPanel1 = new javax.swing.JPanel();
- buttonEnable = new javax.swing.JButton();
- buttonDisable = new javax.swing.JButton();
- buttonReleaseLocal = new javax.swing.JButton();
- buttonReleasePsys = new javax.swing.JButton();
- jPanel2 = new javax.swing.JPanel();
- buttonHomingHexiposi = new javax.swing.JButton();
- buttonPositionsHexiposi = new javax.swing.JButton();
-
- buttonEnableAll.setText("Enable All");
- buttonEnableAll.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonEnableAllActionPerformed(evt);
- }
- });
-
- buttonMount.setText("Mount");
- buttonMount.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonMountActionPerformed(evt);
- }
- });
-
- jLabel1.setText("Segment:");
-
- spinnerSegment.setModel(new javax.swing.SpinnerNumberModel(1, 1, 6, 1));
-
- jLabel2.setText("Puck:");
-
- spinnerPuck.setModel(new javax.swing.SpinnerNumberModel(1, 1, 5, 1));
-
- jLabel3.setText("Sample:");
-
- spinnerSample.setModel(new javax.swing.SpinnerNumberModel(1, 1, 16, 1));
-
- checkFirst.setSelected(true);
- checkFirst.setText("First mount");
+ buttonUnmount = new javax.swing.JButton();
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Robot"));
@@ -139,11 +117,11 @@ public class Expert extends Panel {
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addContainerGap(78, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonEnable)
.addComponent(buttonDisable))
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap(79, Short.MAX_VALUE))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDisable, buttonEnable});
@@ -158,20 +136,6 @@ public class Expert extends Panel {
.addContainerGap())
);
- buttonReleaseLocal.setText("Release Local");
- buttonReleaseLocal.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonReleaseLocalActionPerformed(evt);
- }
- });
-
- buttonReleasePsys.setText("Release PSYS");
- buttonReleasePsys.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- buttonReleasePsysActionPerformed(evt);
- }
- });
-
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Hexiposi"));
buttonHomingHexiposi.setText("Homing");
@@ -192,21 +156,151 @@ public class Expert extends Panel {
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(buttonHomingHexiposi)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonPositionsHexiposi)
- .addContainerGap())
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
+ .addContainerGap(75, Short.MAX_VALUE)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(buttonHomingHexiposi)
+ .addComponent(buttonPositionsHexiposi))
+ .addContainerGap(75, Short.MAX_VALUE))
);
+
+ jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonHomingHexiposi, buttonPositionsHexiposi});
+
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
- .addGap(20, 20, 20)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buttonHomingHexiposi)
- .addComponent(buttonPositionsHexiposi))
- .addContainerGap(24, Short.MAX_VALUE))
+ .addContainerGap()
+ .addComponent(buttonHomingHexiposi)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(buttonPositionsHexiposi)
+ .addContainerGap())
+ );
+
+ jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Safety"));
+
+ buttonReleasePsys.setText("Release PSYS");
+ buttonReleasePsys.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonReleasePsysActionPerformed(evt);
+ }
+ });
+
+ buttonEnableAll.setText("Enable All");
+ buttonEnableAll.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonEnableAllActionPerformed(evt);
+ }
+ });
+
+ buttonReleaseLocal.setText("Release Local");
+ buttonReleaseLocal.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonReleaseLocalActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
+ jPanel3.setLayout(jPanel3Layout);
+ jPanel3Layout.setHorizontalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(buttonEnableAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addComponent(buttonReleasePsys)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(buttonReleaseLocal)))
+ .addContainerGap())
+ );
+ jPanel3Layout.setVerticalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(buttonEnableAll)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(buttonReleaseLocal)
+ .addComponent(buttonReleasePsys))
+ .addContainerGap())
+ );
+
+ jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Commands"));
+
+ spinnerSample.setModel(new javax.swing.SpinnerNumberModel(1, 1, 16, 1));
+
+ checkForce.setText("Force");
+
+ buttonMount.setText("Mount");
+ buttonMount.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonMountActionPerformed(evt);
+ }
+ });
+
+ jLabel1.setText("Segment:");
+
+ spinnerSegment.setModel(new javax.swing.SpinnerListModel(new String[] {"A", "B", "C", "D", "E", "F"}));
+
+ jLabel2.setText("Puck:");
+
+ spinnerPuck.setModel(new javax.swing.SpinnerNumberModel(1, 1, 5, 1));
+
+ jLabel3.setText("Sample:");
+
+ buttonUnmount.setText("Unmount");
+ buttonUnmount.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ buttonUnmountActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
+ jPanel4.setLayout(jPanel4Layout);
+ jPanel4Layout.setHorizontalGroup(
+ jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel4Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(buttonMount, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonUnmount, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(checkForce))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel3)
+ .addComponent(jLabel2)
+ .addComponent(jLabel1))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(spinnerSample, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spinnerPuck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(spinnerSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(13, Short.MAX_VALUE))
+ );
+
+ jPanel4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3});
+
+ jPanel4Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerPuck, spinnerSample, spinnerSegment});
+
+ jPanel4Layout.setVerticalGroup(
+ jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel4Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(buttonMount)
+ .addComponent(jLabel1)
+ .addComponent(spinnerSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel2)
+ .addComponent(spinnerPuck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(buttonUnmount))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel3)
+ .addComponent(spinnerSample, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(checkForce))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@@ -214,68 +308,28 @@ public class Expert extends Panel {
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
- .addGap(16, 16, 16)
+ .addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(buttonMount, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(layout.createSequentialGroup()
- .addGap(10, 10, 10)
- .addComponent(checkFirst)))
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel3)
- .addComponent(jLabel2)
- .addComponent(jLabel1))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(spinnerSample, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(spinnerPuck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(spinnerSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addComponent(jPanel1, 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))
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(buttonEnableAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(layout.createSequentialGroup()
- .addComponent(buttonReleasePsys)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(buttonReleaseLocal))))
- .addContainerGap(377, Short.MAX_VALUE))
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(6, 6, 6)
+ .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
-
- layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3});
-
- layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerPuck, spinnerSample, spinnerSegment});
-
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
- .addComponent(buttonEnableAll)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buttonReleaseLocal)
- .addComponent(buttonReleasePsys))
- .addGap(18, 18, 18)
- .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(buttonMount)
- .addComponent(jLabel1)
- .addComponent(spinnerSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel2)
- .addComponent(spinnerPuck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(checkFirst))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel3)
- .addComponent(spinnerSample, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(175, Short.MAX_VALUE))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
+ .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// //GEN-END:initComponents
@@ -284,9 +338,11 @@ public class Expert extends Panel {
}//GEN-LAST:event_buttonEnableAllActionPerformed
private void buttonMountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMountActionPerformed
- String cmd = checkFirst.isSelected() ? "firstmount" : "mount";
- execute("robot.start_task('" + cmd + "'," + spinnerSegment.getValue() + "," + spinnerPuck.getValue() + "," + spinnerSample.getValue() + ")");
- checkFirst.setSelected(false);
+ String segment = (String) spinnerSegment.getValue();
+ int puck = (Integer) spinnerPuck.getValue();
+ int sample = (Integer) spinnerSample.getValue();
+ String force = checkForce.isSelected() ? "True" : "False";
+ execute("mount('" + segment + "'," + puck + "," + sample + ", force=" + force + ")");
}//GEN-LAST:event_buttonMountActionPerformed
@@ -314,6 +370,14 @@ public class Expert extends Panel {
this.showDevicePanel("hexiposi");
}//GEN-LAST:event_buttonPositionsHexiposiActionPerformed
+ private void buttonUnmountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonUnmountActionPerformed
+ String segment = (String) spinnerSegment.getValue();
+ int puck = (Integer) spinnerPuck.getValue();
+ int sample = (Integer) spinnerSample.getValue();
+ String force = checkForce.isSelected() ? "True" : "False";
+ execute("unmount('" + segment + "'," + puck + "," + sample + ", force=" + force + ")");
+ }//GEN-LAST:event_buttonUnmountActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonDisable;
private javax.swing.JButton buttonEnable;
@@ -323,12 +387,15 @@ public class Expert extends Panel {
private javax.swing.JButton buttonPositionsHexiposi;
private javax.swing.JButton buttonReleaseLocal;
private javax.swing.JButton buttonReleasePsys;
- private javax.swing.JCheckBox checkFirst;
+ private javax.swing.JButton buttonUnmount;
+ private javax.swing.JCheckBox checkForce;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanel3;
+ private javax.swing.JPanel jPanel4;
private javax.swing.JSpinner spinnerPuck;
private javax.swing.JSpinner spinnerSample;
private javax.swing.JSpinner spinnerSegment;
diff --git a/script/calibration/ScanRZ.py b/script/calibration/ScanRZ.py
index ac10b5a..55d3bba 100644
--- a/script/calibration/ScanRZ.py
+++ b/script/calibration/ScanRZ.py
@@ -9,7 +9,7 @@ LATENCY = 0.005
RELATIVE = False
#Enabling and checking
-#enable_power()
+#enable_motion()
#system_check()
robot.enable()
diff --git a/script/devices/Hexiposi.py b/script/devices/Hexiposi.py
index 869f6e6..9271b6a 100644
--- a/script/devices/Hexiposi.py
+++ b/script/devices/Hexiposi.py
@@ -82,6 +82,9 @@ class Hexiposi(DiscretePositionerBase):
except:
pass
+ def assert_in_position(self, pos):
+ return take() == pos
+
#def isReady(self):
# self.get_status()
# return self.moving == False
@@ -102,4 +105,15 @@ dev = Hexiposi("hexiposi", "myriotell:8002/hexiposi")
add_device(dev, True)
hexiposi.polling=500
#print dev.url
-#print dev.get_status()
\ No newline at end of file
+#print dev.get_status()
+
+class hexiposi_position(ReadonlyRegisterBase):
+ def doRead(self):
+ try:
+ return float(hexiposi.pos)
+ except:
+ return float("nan")
+
+add_device(hexiposi_position(), True)
+hexiposi_position.polling = 1000
+
diff --git a/script/devices/RobotSC.py b/script/devices/RobotSC.py
index 943dbcc..27142fb 100644
--- a/script/devices/RobotSC.py
+++ b/script/devices/RobotSC.py
@@ -24,17 +24,49 @@ class RobotSC(RobotTCP):
RobotTCP.__init__(self, name, server, timeout, retries)
self.setPolling(DEFAULT_ROBOT_POLLING)
- def mount(self, segment, puck, sample):
- return self.execute('mount',segment, puck, sample)
+ def get_dewar(self, segment, puck, sample):
+ segment = self.toSegmentNumber(segment)
+ self.assert_dewar()
+ self.start_task('getDewar',segment, puck, sample)
+ self.wait_task_finished()
+ self.assert_dewar()
- def firstmount(self, segment, puck, sample):
- return self.execute('firstmount', segment, puck, sample)
+ def put_dewar(self, segment, puck, sample):
+ segment = self.toSegmentNumber(segment)
+ self.assert_dewar()
+ self.start_task('putDewar',segment, puck, sample)
+ self.wait_task_finished()
+ self.assert_dewar()
- def unmount(self, segment, puck, sample):
- return self.execute('unmount',segment, puck, sample)
+ def put_gonio(self):
+ self.start_task('putGonio',segment, puck, sample)
+ self.wait_task_finished()
+ #TODO
- def robotRecover(self):
- return self.execute('robotRecover')
+ def get_gonio(self):
+ self.start_task('getGonio')
+ self.wait_task_finished()
+ #TODO
+
+ def robot_recover(self):
+ self.start_task('robotRecover')
+ self.wait_task_finished()
+
+ def move_dewar(self):
+ self.start_task('moveDewar')
+ self.wait_task_finished()
+ self.assert_dewar()
+
+ def move_park(self):
+ self.start_task('movePark')
+ self.wait_task_finished()
+ self.assert_park()
+
+ def toSegmentNumber(self, segment):
+ if type(segment) == str:
+ segment = ord(segment.upper()) - ord('A') +1
+ return segment
+
def on_event(self,ev):
#print "EVT: " + ev
@@ -65,7 +97,49 @@ class RobotSC(RobotTCP):
def set_local(self):
robot.set_profile("default")
+
+ def is_home(self):
+ return self.is_in_point("pHome")
+
+ def is_park(self):
+ return self.is_in_point("pPark")
+
+ def is_dewarHome(self):
+ return self.is_in_point("pDewarHome")
+
+ def is_dewarWait(self):
+ return self.is_in_point("pDewarWait")
+
+ def is_gonio(self):
+ return self.is_in_point("pGonioHome")
+ def is_cleared(self):
+ return self.is_home() or self.is_park() or self.is_dewarHome() or self.is_dewarWait()
+
+ def assert_home(self):
+ self.assert_in_point("pHome")
+
+ def assert_park(self):
+ self.assert_in_point("pPark")
+
+ def assert_dewarHome(self):
+ self.assert_in_point("pDewarHome")
+
+ def assert_dewarWait(self):
+ self.assert_in_point("pDewarWait")
+
+ def assert_gonio(self):
+ self.assert_in_point("pGonioHome")
+
+ def assert_cleared(self):
+ if not self.is_cleared():
+ raise Exception("Robot not in cleared position")
+
+ def get_current_point(self):
+ for p in ["pHome", "pPark", "pDewarHome", "pGonioHome", "pDewarWait"]:
+ if self.is_in_point(p):
+ return p
+ return None
if simulation:
diff --git a/script/devices/RobotTCP.py b/script/devices/RobotTCP.py
index bcf7a53..3d9785e 100644
--- a/script/devices/RobotTCP.py
+++ b/script/devices/RobotTCP.py
@@ -25,7 +25,7 @@ class RobotTCP(TcpDevice, Stoppable):
self.status = None
self.lock = threading.Lock()
self.joint_forces = None
- self.current_task = None
+ self.current_task = None
self.high_level_tasks = []
self.cartesian_destination = None
#self.flange_pos = [None] * 6
@@ -340,9 +340,9 @@ class RobotTCP(TcpDevice, Stoppable):
time.sleep(0.05)
self.update()
#time.sleep(0.01)
- #robot.waitCacheChange(-1)
+ #self.waitCacheChange(-1)
self.waitReady(-1)
- #robot.waitState(State.Ready, -1)
+ #self.waitState(State.Ready, -1)
#Tool
@@ -455,8 +455,10 @@ class RobotTCP(TcpDevice, Stoppable):
self.speed = int(sts[3])
self.empty = sts[4] == "1"
self.settled = sts[5] == "1"
- if int(sts[6]) < 0:
- self.current_task = None
+ if int(sts[6]) < 0:
+ if self.current_task is not None:
+ log("Task finished: " + str(self.current_task), False)
+ self.current_task = None
for i in range(6):
self.joint_pos[i] = float(sts[7 + i])
@@ -513,6 +515,17 @@ class RobotTCP(TcpDevice, Stoppable):
self.get_cartesian_pos()
return self.distance_p("tcp_p", name)
+ def is_in_point(self, p, tolerance = 50): #Tolerance in mm
+ d = self.get_distance_to_pnt(p)
+ if d<0:
+ raise Exception ("Error calculating distance to " + p + " : " + str(d))
+ return d=0:
raise Exception("Ongoing high-level task: " + task)
self.task_create(program, *args, **kwargs)
start = time.time()
- while self.get_task_status(program)[0] < 0:
- if time.time() - start > 5000:
- raise Exception("Cannot start task " + task)
- time.sleep(0.1)
- self.update()
+ #while self.get_task_status(program)[0] < 0:
+ # if time.time() - start > 5.0:
+ # raise Exception("Cannot start task " + task)
+ # time.sleep(0.1)
self.current_task = program
+ (code, status) = self.get_task_status(task)
+ log("Task started: " + str(self.current_task) + " - status: " + str(status) + " (" + str(code) + ")", False)
+
+ self.update()
self._update_state()
+ return code
def stop_task(self):
tasks = [t for t in self.high_level_tasks]
@@ -597,10 +614,19 @@ class RobotTCP(TcpDevice, Stoppable):
for task in self.high_level_tasks:
if self.get_task_status(task)[0]>=0:
self.current_task = task
+ log("Task detected: " + str(self.current_task), False)
return task
return None
+
+ def wait_task_finished (self):
+ while get_task() != None:
+ time.sleep(0.01)
-
+ def assert_no_task(self):
+ task = self.get_task()
+ if task != None:
+ raise Exception("Ongoing task: " + task)
+
def on_event(self,ev):
pass
diff --git a/script/hexiposi_positon.scd b/script/hexiposi_positon.scd
new file mode 100644
index 0000000..471fb41
--- /dev/null
+++ b/script/hexiposi_positon.scd
@@ -0,0 +1,11 @@
+[
+ [ [ true, "hexiposi_position", "Device", 1, 1, null ] ],
+ [ [ "1", null, null, null, null, null, null, null ],
+ [ "2", null, null, null, null, null, null, null ],
+ [ "3", null, null, null, null, null, null, null ],
+ [ "4", null, null, null, null, null, null, null ],
+ [ "5", null, null, null, null, null, null, null ] ],
+ [ [ ] ],
+ [ [ "", 1000, 100 ],
+ [ "", "" ] ]
+]
\ No newline at end of file
diff --git a/script/imgproc/CoverDetection2.py b/script/imgproc/CoverDetection2.py
index 7fb8bf0..62eebce 100644
--- a/script/imgproc/CoverDetection2.py
+++ b/script/imgproc/CoverDetection2.py
@@ -7,13 +7,12 @@ FRAMES_INTEGRATION = 3
STEP_SIZE = 2
POSITION_NAMES = [ 'A','B','C','D', 'E', 'F']
POSITION_ANGLES = [330, 30, 90, 150, 210, 270]
-POSITION_TOLERANCE = 10
+POSITION_TOLERANCE = 3
MINIMUM_CONFIDENCE = 10
DEBUG = True
PLOT = True
REFERENCE_IMG = "ref2"
-
#Load reference image
ref = load_image(str("{images}/cover/" + REFERENCE_IMG + ".png") , title="Line")
@@ -31,6 +30,7 @@ ip = sub_image(ip, cx-ref.width/2, cy-ref.height/2, ref.width, ref.height)
#Show ROI of pre-processed image
image_panel = show_panel(ip.bufferedImage)
+
#Calculate correlation between image and reference, rotating the reference from 0 to 360
import ch.psi.pshell.imaging.Utils.integrateVertically as integrateVertically
ydata = []
@@ -39,12 +39,12 @@ for i in xdata:
r = ref.duplicate()
r.getProcessor().setBackgroundValue(0.0)
r.getProcessor().rotate(float(i))
- op = op_fft(ip, r, "correlate")
+ op = op_fft(r, ip, "correlate")
bi = op.getBufferedImage()
p = integrateVertically(bi)
ydata.append(sum(p))
#image_panel = show_panel(op.bufferedImage)
- #time.sleep(0.001)
+ #time.sleep(1.0)
#Calculate angle of the highest correlation, and confidence level
@@ -72,7 +72,7 @@ if DEBUG:
print "Peak values: " + str(peaks_y)
print "Angle: " , angle
print "Position: " , position
- print "Confifdence: " , confidence
+ print "Confidence: " , confidence
#Set return value
set_return ([position, angle, confidence])
diff --git a/script/imgproc/LedDetectionProc.py b/script/imgproc/LedDetectionProc.py
index 2589c7d..3730c23 100644
--- a/script/imgproc/LedDetectionProc.py
+++ b/script/imgproc/LedDetectionProc.py
@@ -51,10 +51,10 @@ set_led_state(False)
op_image(image, background, "subtract", float_result=True, in_place=True)
-if RENDERER is None:
+if RENDERER is not None:
+ RENDERER.setImage(None, image.getBufferedImage(), None)
+else:
RENDERER = show_panel(image.getBufferedImage())
-else:
- RENDERER.setImage(None, image.getBufferedImage(), None)
RENDERER.clearOverlays()
invert(image)
@@ -73,15 +73,14 @@ for row in range (r.counter):
x, y = int(r.getValue("XM", row)), int(r.getValue("YM", row))
cx, cy = img.getCalibration().convertToAbsoluteX(x), img.getCalibration().convertToAbsoluteY(y)
points.append([cx,cy])
- RENDERER.addOverlay(Crosshairs(Pen(java.awt.Color.MAGENTA), java.awt.Point(x,y), java.awt.Dimension(15,15)))
+ if RENDERER is not None:
+ RENDERER.addOverlay(Crosshairs(Pen(java.awt.Color.MAGENTA), java.awt.Point(x,y), java.awt.Dimension(15,15)))
-
-#RENDERER.addOverlays(ovs)
-
clear_detection(block_id)
detect_pucks(points, block_id)
-plot_base_plate(points, p=PLOT)
+if PLOT is not None:
+ plot_base_plate(points, p=PLOT)
ret = get_puck_detection_dict(block_id)
diff --git a/script/imgproc/Utils.py b/script/imgproc/Utils.py
index 208d72b..57acc3b 100644
--- a/script/imgproc/Utils.py
+++ b/script/imgproc/Utils.py
@@ -15,6 +15,14 @@ def get_img_cover_pos():
[position, angle, confidence] = run("imgproc/CoverDetection2")
return position
+def assert_img_in_cover_pos(pos = None):
+ if pos==None:
+ pos = hexiposi.take()
+ img_segment = get_img_cover_pos()
+ if img_segment != segment:
+ raise Excepton ("Image detection of cover does not match hexiposi: " + str(img_segment))
+
+
def in_roi(x,y):
global roi_center, roi_radius, roi_border
return math.hypot(x-roi_center[0], y-roi_center[1]) < (roi_radius-roi_border)
diff --git a/script/local.py b/script/local.py
index 7053501..874d4a7 100644
--- a/script/local.py
+++ b/script/local.py
@@ -65,7 +65,7 @@ except:
try:
robot.setPolling(DEFAULT_ROBOT_POLLING)
- robot.high_level_tasks = ["mount", "firstmount"]
+ robot.high_level_tasks = ["getDewar", "putDewar", "putGonio", "getGonio", "robotRecover", "moveDewar", "movePark"]
robot.set_tool(TOOL_CALIBRATION)
robot.set_motors_enabled(True)
robot.set_joint_motors_enabled(True)
diff --git a/script/motion/mount.py b/script/motion/mount.py
index 81f0c1f..6907f08 100644
--- a/script/motion/mount.py
+++ b/script/motion/mount.py
@@ -1,16 +1,40 @@
-def mount(segment, puck, sample, unmount = False):
+def mount(segment, puck, sample, force=False):
"""
"""
- cmd = "firstmount" if unmount else "mount"
+ print "mount: ", segment, puck, sample, force
+
+ #Initial checks
assertValidAddress(segment, puck, sample)
+ robot.assert_no_task()
+ robot.state.assertReady()
+ robot.assert_cleared()
- hexiposi.move(segment)
+ if hexiposi.homed == False:
+ raise Exception ("Hexiposi is not homed")
- img_segment = get_img_cover_pos()
- if img_segment != segment:
- raise Excepton ("Image detection of cover does not match hexiposi: " + str(img_segment))
+ #Enabling
+ enable_motion()
+
+ set_hexiposi(segment)
- if type(segment) == str:
- segment = ord(segment.upper()) - ord('A') +1
- robot.start_task(cmd,segment, puck, sample)
- #robot.mount(segment, puck, sample)
+
+ if not force:
+ #Clearing for image processing
+ robot.move_park()
+ assert_img_in_cover_pos(segment)
+
+ location = get_current_point()
+ print "Location: " + location
+
+ robot.move_dewar()
+ try:
+ robot.get_dewar(segment, puck, sample)
+ except:
+ #robot.move_dewar()
+ raise
+
+ try:
+ robot.put_gonio()
+ except:
+ #TODO: recover
+ raise
diff --git a/script/motion/tools.py b/script/motion/tools.py
index 4a9746a..17292cc 100644
--- a/script/motion/tools.py
+++ b/script/motion/tools.py
@@ -1,20 +1,39 @@
POSITION_TOLERANCE = 50
-def enable_power():
+def enable_motion():
"""
- Check safety and enable arm power
+ Check safety and enable arm power if in remote mode
"""
- release_psys()
- time.sleep(0.1)
- if feedback_psys_safety.read() == False:
- raise Exception("Cannot enable power: check doors")
+ if robot.working_mode != "manual":
+ release_psys()
+ time.sleep(0.1)
+ if feedback_psys_safety.read() == False:
+ raise Exception("Cannot enable power: check doors")
+
release_local()
if feedback_local_safety.read() == False:
raise Exception("Cannot enable power: check sample changer emergency stop button")
- time.sleep(0.25)
- if not robot.state.isNormal():
- raise Exception("Cannot enable power: robot state is " + str(robot.state))
- robot.enable()
+
+ if robot.working_mode == "manual":
+ pass
+ else:
+ time.sleep(0.25)
+ if not robot.state.isNormal():
+ raise Exception("Cannot enable power: robot state is " + str(robot.state))
+ robot.enable()
+
+def set_hexiposi(pos):
+ """
+ Set the hexiposi posiiton in remote mode, or wait for it to be set in manual mode
+ """
+ if robot.working_mode == "manual":
+ set_status("Move Hexiposi to position " + str(pos) + " ...")
+ try:
+ hexiposi.waitInPosition(pos, -1)
+ finally:
+ set_status(None)
+ else:
+ hexiposi.move(pos)
@@ -57,8 +76,6 @@ def move_to_laser():
raise Exception ("Must be in home position to start move to laser")
-
-
def update_tool(tool=None, x_offset=0.0, y_offset=0.0, z_offset=0.0):
#Updating tool:
t=robot.get_tool_trsf(tool)
diff --git a/script/motion/unmount.py b/script/motion/unmount.py
index 42f94e6..e151134 100644
--- a/script/motion/unmount.py
+++ b/script/motion/unmount.py
@@ -1,15 +1,44 @@
-def unmount(segment, puck, sample):
+def unmount(segment, puck, sample, force=False):
"""
"""
+ print "unmount: ", segment, puck, sample, force
+
+ #Initial checks
assertValidAddress(segment, puck, sample)
+ robot.assert_no_task()
+ robot.state.assertReady()
+ robot.assert_cleared()
- hexiposi.move(segment)
+ if hexiposi.homed == False:
+ raise Exception ("Hexiposi is not homed")
- img_segment = get_img_cover_pos()
- if img_segment != segment:
- raise Excepton ("Image detection of cover does not match hexiposi: " + str(img_segment))
+ #Enabling
+ enable_motion()
- if type(segment) == str:
- segment = ord(segment.upper()) - ord('A') +1
+ set_hexiposi(segment)
- robot.unmount(segment, puck, sample)
+ if not force:
+ #Clearing for image processing
+ robot.move_park()
+ assert_img_in_cover_pos(segment)
+
+ location = get_current_point()
+
+
+ try:
+ robot.get_gonio()
+ except:
+ #TODO: recover
+ raise
+
+ try:
+ robot.move_dewar()
+ except:
+ #TODO: recover
+ raise
+
+ try:
+ robot.pet_dewar(segment, puck, sample)
+ except:
+ #robot.move_dewar()
+ raise
\ No newline at end of file