This commit is contained in:
gac-S_Changer
2018-05-29 10:32:34 +02:00
parent 05f982c86b
commit fb1e1221f1
14 changed files with 689 additions and 343 deletions

View File

@@ -17,43 +17,15 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonMount" min="-2" pref="106" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Component id="checkFirst" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerSample" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPuck" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSegment" linkSize="2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
</Group>
<Group type="103" alignment="1" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonEnableAll" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="buttonReleasePsys" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonReleaseLocal" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="jPanel1" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jPanel2" alignment="1" min="-2" max="-2" attributes="0"/>
<Component id="jPanel3" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="377" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -61,97 +33,22 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonEnableAll" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonReleaseLocal" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonReleasePsys" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jPanel4" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonMount" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSegment" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPuck" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="checkFirst" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSample" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="175" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonEnableAll">
<Properties>
<Property name="text" type="java.lang.String" value="Enable All"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEnableAllActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonMount">
<Properties>
<Property name="text" type="java.lang.String" value="Mount"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMountActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Segment:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerSegment">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="6" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Puck:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerPuck">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="5" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Sample:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerSample">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="16" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkFirst">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="First mount"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
@@ -165,12 +62,12 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="78" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonEnable" linkSize="4" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="buttonDisable" linkSize="4" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace pref="79" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -205,22 +102,6 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="buttonReleaseLocal">
<Properties>
<Property name="text" type="java.lang.String" value="Release Local"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReleaseLocalActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonReleasePsys">
<Properties>
<Property name="text" type="java.lang.String" value="Release PSYS"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReleasePsysActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
@@ -233,24 +114,24 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonHomingHexiposi" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonPositionsHexiposi" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="75" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonHomingHexiposi" linkSize="5" min="-2" max="-2" attributes="0"/>
<Component id="buttonPositionsHexiposi" linkSize="5" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="75" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonHomingHexiposi" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPositionsHexiposi" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="24" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonHomingHexiposi" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonPositionsHexiposi" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -274,5 +155,201 @@
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel3">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Safety"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" alignment="1" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonEnableAll" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="buttonReleasePsys" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonReleaseLocal" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonEnableAll" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonReleaseLocal" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonReleasePsys" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonReleasePsys">
<Properties>
<Property name="text" type="java.lang.String" value="Release PSYS"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReleasePsysActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonEnableAll">
<Properties>
<Property name="text" type="java.lang.String" value="Enable All"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEnableAllActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonReleaseLocal">
<Properties>
<Property name="text" type="java.lang.String" value="Release Local"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReleaseLocalActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel4">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Commands"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonMount" min="-2" pref="106" max="-2" attributes="0"/>
<Component id="buttonUnmount" alignment="0" min="-2" pref="106" max="-2" attributes="0"/>
<Component id="checkForce" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerSample" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPuck" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSegment" linkSize="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="13" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonMount" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSegment" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPuck" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonUnmount" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSample" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="checkForce" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JSpinner" name="spinnerSample">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="16" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkForce">
<Properties>
<Property name="text" type="java.lang.String" value="Force"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonMount">
<Properties>
<Property name="text" type="java.lang.String" value="Mount"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonMountActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Segment:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerSegment">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel type="list">
<ListItem value="A"/>
<ListItem value="B"/>
<ListItem value="C"/>
<ListItem value="D"/>
<ListItem value="E"/>
<ListItem value="F"/>
</SpinnerModel>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Puck:"/>
</Properties>
</Component>
<Component class="javax.swing.JSpinner" name="spinnerPuck">
<Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
<SpinnerModel initial="1" maximum="5" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Sample:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="buttonUnmount">
<Properties>
<Property name="text" type="java.lang.String" value="Unmount"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonUnmountActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@@ -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 {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//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))
);
}// </editor-fold>//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;

View File

@@ -9,7 +9,7 @@ LATENCY = 0.005
RELATIVE = False
#Enabling and checking
#enable_power()
#enable_motion()
#system_check()
robot.enable()

View File

@@ -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()
#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

View File

@@ -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:

View File

@@ -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<tolerance
def assert_in_point(self, p, tolerance = 50): #Tolerance in mm
if not self.is_in_point(p, tolerance):
raise Exception ("Not in position " + p)
#Cartesian peudo-motors
def set_motors_enabled(self, value):
if value !=self.cartesian_motors_enabled:
@@ -567,21 +580,25 @@ class RobotTCP(TcpDevice, Stoppable):
def start_task(self, program, *args, **kwargs):
tasks = [t for t in self.high_level_tasks]
if (self.current_task is not None) and (not self.current_task in tasks):
tasks.append(pro)
tasks.append(self.current_task)
if not program in tasks:
tasks.append(pro)
tasks.append(program)
for task in tasks:
if self.get_task_status(task)[0]>=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

View File

@@ -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 ],
[ "", "" ] ]
]

View File

@@ -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])

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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