This commit is contained in:
gac-S_Changer
2018-07-06 09:56:19 +02:00
parent 4371d9c6d8
commit 4c38bcba7c
34 changed files with 1820 additions and 968 deletions

View File

@@ -1,5 +1,5 @@
img=ch.psi.pshell.prosilica.Prosilica|25001 "PacketSize=1522;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=300;RegionY=200;Width=1000;Height=1000;MulticastEnable=Off"|||false
#gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://129.129.110.114/axis-cgi/mjpg/video.cgi||100|
gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://129.129.110.114/axis-cgi/mjpg/video.cgi||-1|
microscan=ch.psi.pshell.serial.TcpDevice|129.129.110.200:2001|||
microscan_cmd=ch.psi.pshell.serial.TcpDevice|129.129.110.200:2003|||
ue=LaserUE|COM4|||false

View File

@@ -1,15 +1,18 @@
WagoPanel.java=enabled
LaserUEPanel.java=enabled
BarcodeReaderPanel.java=enabled
PuckDetectionPanel.java=enabled
HexiposiPanel.java=enabled
MjpegSource2.java=enabled
MXSC-1.10.0.jar=enabled
LN2.java=enabled
Hexiposi.java=enabled
Hexiposi.java=disabled
NewJPanel.java=disabled
Expert.java=disabled
RobotPanel.java=enabled
Wayne.java=disabled
SmartMagnetConfig.java=disabled
SmartMagnetPanel.java=enabled
LaserUE.java=enabled
PuckDetection.java=disabled
TestZMQ.java=disabled
RobotModbus.java=disabled
RobotTcp.java=disabled

View File

@@ -1,5 +1,5 @@
#Wed Jun 27 09:59:11 CEST 2018
maxValue=1.0
#Fri Jun 29 16:49:51 CEST 2018
maxValue=0.4
minValue=0.0
offset=0.0
precision=2

View File

@@ -1,5 +1,5 @@
#Wed Jun 27 09:59:11 CEST 2018
maxValue=1.0
#Fri Jun 29 16:49:51 CEST 2018
maxValue=0.4
minValue=0.0
offset=0.0
precision=2

View File

@@ -1,5 +1,5 @@
#Wed Jun 27 09:59:11 CEST 2018
maxValue=1.0
#Fri Jun 29 16:49:51 CEST 2018
maxValue=0.4
minValue=0.0
offset=0.0
precision=2

View File

@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel3" max="32767" attributes="0"/>
<Component id="deviceValuePanel1" max="32767" attributes="0"/>
<Component id="deviceStatePanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="deviceValuePanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="deviceStatePanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<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="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"/>
<Component id="buttonEnable" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonDisable" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonRead" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" 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="buttonEnable" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDisable" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonRead" 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="buttonEnable">
<Properties>
<Property name="text" type="java.lang.String" value="Enable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEnableActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonDisable">
<Properties>
<Property name="text" type="java.lang.String" value="Disable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDisableActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonRead">
<Properties>
<Property name="text" type="java.lang.String" value="Read"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReadActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="deviceStatePanel1">
<Properties>
<Property name="deviceName" type="java.lang.String" value="barcode_reader"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel1">
<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="Value"/>
</Border>
</Property>
<Property name="deviceName" type="java.lang.String" value="barcode_reader"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -0,0 +1,162 @@
import ch.psi.pshell.core.Context;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.utils.swing.SwingUtils;
import java.util.concurrent.CompletableFuture;
/**
*
*/
public class BarcodeReaderPanel extends DevicePanel {
volatile boolean enabled;
public BarcodeReaderPanel() {
initComponents();
this.startTimer(100);
}
CompletableFuture future;
@Override
public void onTimer(){
if ((getDevice()!=null) && enabled){
if ((future==null) || (future.isDone())){
future = Context.getInstance().evalLineBackgroundAsync("barcode_reader.get()");
}
}
}
void execute(String statement, boolean showReturn){
try {
Context.getInstance().evalLineBackgroundAsync(statement).handle((ret, ex) -> {
if (BarcodeReaderPanel.this.isShowing()){
if (ex != null){
showException((Exception)ex);
} else if (showReturn){
if (ret == null){
SwingUtils.showMessage(this, "Return", "No code detected", 20000);
} else {
SwingUtils.showMessage(this, "Return", "Detected code: " +ret, 20000);
}
}
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
buttonEnable = new javax.swing.JButton();
buttonDisable = new javax.swing.JButton();
buttonRead = new javax.swing.JButton();
deviceStatePanel1 = new ch.psi.pshell.swing.DeviceStatePanel();
deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Commands"));
buttonEnable.setText("Enable");
buttonEnable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonEnableActionPerformed(evt);
}
});
buttonDisable.setText("Disable");
buttonDisable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDisableActionPerformed(evt);
}
});
buttonRead.setText("Read");
buttonRead.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonReadActionPerformed(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()
.addComponent(buttonEnable)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonDisable)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonRead)
.addContainerGap())
);
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDisable, buttonEnable, buttonRead});
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonEnable)
.addComponent(buttonDisable)
.addComponent(buttonRead))
.addContainerGap())
);
deviceStatePanel1.setDeviceName("barcode_reader");
deviceValuePanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Value"));
deviceValuePanel1.setDeviceName("barcode_reader");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEnableActionPerformed
execute("barcode_reader.enable()", false);
enabled = true;
}//GEN-LAST:event_buttonEnableActionPerformed
private void buttonDisableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDisableActionPerformed
enabled = false;
execute("barcode_reader.disable()", false);
}//GEN-LAST:event_buttonDisableActionPerformed
private void buttonReadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReadActionPerformed
enabled = false;
execute("barcode_reader.read(5.0) ", true);
}//GEN-LAST:event_buttonReadActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonDisable;
private javax.swing.JButton buttonEnable;
private javax.swing.JButton buttonRead;
private ch.psi.pshell.swing.DeviceStatePanel deviceStatePanel1;
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel1;
private javax.swing.JPanel jPanel3;
// End of variables declaration//GEN-END:variables
}

View File

@@ -16,206 +16,16 @@
<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="2" attributes="0">
<Component id="panelRobot1" linkSize="9" alignment="2" max="-2" attributes="0"/>
<Component id="panelRobot" linkSize="9" alignment="2" max="-2" attributes="0"/>
<Component id="jPanel3" linkSize="9" alignment="2" max="-2" attributes="0"/>
<Component id="jPanel2" linkSize="9" alignment="2" max="-2" attributes="0"/>
<Component id="panelSafety" linkSize="9" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="panelCommands" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="panelCommands" min="-2" max="-2" attributes="0"/>
</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="0" attributes="0">
<Component id="panelCommands" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="panelSafety" 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="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelRobot" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelRobot1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="23" max="32767" attributes="0"/>
</Group>
<Component id="panelCommands" min="-2" max="-2" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="panelRobot">
<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="Robot"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="32" max="32767" attributes="0"/>
<Component id="buttonEnable" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="27" max="-2" attributes="0"/>
<Component id="buttonDisable" linkSize="4" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="32" 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="buttonEnable" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonDisable" 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="buttonEnable">
<Properties>
<Property name="text" type="java.lang.String" value="Enable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEnableActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonDisable">
<Properties>
<Property name="text" type="java.lang.String" value="Disable"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDisableActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
<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="Hexiposi"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="76" max="32767" attributes="0"/>
<Component id="buttonPositionsHexiposi" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="74" 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"/>
<Component id="buttonPositionsHexiposi" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonPositionsHexiposi">
<Properties>
<Property name="text" type="java.lang.String" value="Positions"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPositionsHexiposiActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelSafety">
<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 Motion"/>
</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="panelCommands">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
@@ -228,11 +38,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonMoveHeater" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonMoveGonio" linkSize="7" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="buttonRecover" max="32767" attributes="0"/>
<Component id="buttonMoveHeater" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonMoveGonio" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonMovePark" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonGetGonio" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonPutGonio" linkSize="7" alignment="1" max="32767" attributes="0"/>
@@ -240,16 +51,14 @@
<Component id="buttonUnmount" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonGetDewar" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonPutDewar" linkSize="7" alignment="1" max="32767" attributes="0"/>
<Component id="buttonDry" max="32767" attributes="0"/>
<Component id="buttonDry" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonMoveScanner" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonMoveHome" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonMoveDewar" linkSize="7" max="32767" attributes="0"/>
<Component id="jPanel5" max="32767" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonMoveScanner" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonMoveHome" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonMoveDewar" linkSize="7" max="32767" attributes="0"/>
<Component id="jPanel5" max="32767" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
@@ -263,8 +72,9 @@
</Group>
</Group>
<Component id="buttonHomingHexiposi" linkSize="7" max="32767" attributes="0"/>
<Component id="buttonEnableAll" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace pref="30" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -312,12 +122,17 @@
<Component id="spinnerDryTime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="spinnerDrySpeed" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonEnableAll" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="buttonRecover" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -584,121 +399,20 @@
</Property>
</Properties>
</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="Puck Detection"/>
</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"/>
<Component id="buttonPuckDetCheck" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="11" max="32767" attributes="0"/>
<Component id="buttonPuckDetStop" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="11" max="32767" attributes="0"/>
<Component id="buttonPuckDetStart" linkSize="6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" 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="buttonPuckDetCheck" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPuckDetStop" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPuckDetStart" 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="buttonPuckDetCheck">
<Component class="javax.swing.JButton" name="buttonRecover">
<Properties>
<Property name="text" type="java.lang.String" value="Ckeck"/>
<Property name="text" type="java.lang.String" value="Recover"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetCheckActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRecoverActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPuckDetStop">
<Component class="javax.swing.JButton" name="buttonEnableAll">
<Properties>
<Property name="text" type="java.lang.String" value="Stop"/>
<Property name="text" type="java.lang.String" value="Enable Motion"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetStopActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPuckDetStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetStartActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelRobot1">
<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="Dryer"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="24" max="32767" attributes="0"/>
<Component id="buttonHeater" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonStream" linkSize="8" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="25" 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="buttonHeater" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonStream" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JToggleButton" name="buttonHeater">
<Properties>
<Property name="text" type="java.lang.String" value="Heater"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonHeaterActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToggleButton" name="buttonStream">
<Properties>
<Property name="text" type="java.lang.String" value="Air Stream"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStreamActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonEnableAllActionPerformed"/>
</Events>
</Component>
</SubComponents>

View File

@@ -2,17 +2,13 @@
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.core.Context;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Component;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComponent;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
/**
*
@@ -47,6 +43,12 @@ public class Expert extends Panel {
protected void doUpdate() {
}
@Override
public boolean isActive() {
return true;
}
void execute(String statement){
execute(statement, false);
}
@@ -89,15 +91,6 @@ public class Expert extends Panel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
panelRobot = new javax.swing.JPanel();
buttonEnable = new javax.swing.JButton();
buttonDisable = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
buttonPositionsHexiposi = new javax.swing.JButton();
panelSafety = new javax.swing.JPanel();
buttonReleasePsys = new javax.swing.JButton();
buttonEnableAll = new javax.swing.JButton();
buttonReleaseLocal = new javax.swing.JButton();
panelCommands = new javax.swing.JPanel();
buttonMount = new javax.swing.JButton();
buttonUnmount = new javax.swing.JButton();
@@ -128,128 +121,8 @@ public class Expert extends Panel {
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
spinnerDrySpeed = new javax.swing.JSpinner();
jPanel3 = new javax.swing.JPanel();
buttonPuckDetCheck = new javax.swing.JButton();
buttonPuckDetStop = new javax.swing.JButton();
buttonPuckDetStart = new javax.swing.JButton();
panelRobot1 = new javax.swing.JPanel();
buttonHeater = new javax.swing.JToggleButton();
buttonStream = new javax.swing.JToggleButton();
panelRobot.setBorder(javax.swing.BorderFactory.createTitledBorder("Robot"));
buttonEnable.setText("Enable");
buttonEnable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonEnableActionPerformed(evt);
}
});
buttonDisable.setText("Disable");
buttonDisable.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonDisableActionPerformed(evt);
}
});
javax.swing.GroupLayout panelRobotLayout = new javax.swing.GroupLayout(panelRobot);
panelRobot.setLayout(panelRobotLayout);
panelRobotLayout.setHorizontalGroup(
panelRobotLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRobotLayout.createSequentialGroup()
.addContainerGap(32, Short.MAX_VALUE)
.addComponent(buttonEnable)
.addGap(27, 27, 27)
.addComponent(buttonDisable)
.addContainerGap(32, Short.MAX_VALUE))
);
panelRobotLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDisable, buttonEnable});
panelRobotLayout.setVerticalGroup(
panelRobotLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRobotLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelRobotLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonEnable)
.addComponent(buttonDisable))
.addContainerGap())
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Hexiposi"));
buttonPositionsHexiposi.setText("Positions");
buttonPositionsHexiposi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPositionsHexiposiActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap(76, Short.MAX_VALUE)
.addComponent(buttonPositionsHexiposi)
.addContainerGap(74, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(buttonPositionsHexiposi)
.addContainerGap())
);
panelSafety.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 Motion");
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 panelSafetyLayout = new javax.swing.GroupLayout(panelSafety);
panelSafety.setLayout(panelSafetyLayout);
panelSafetyLayout.setHorizontalGroup(
panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSafetyLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonEnableAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelSafetyLayout.createSequentialGroup()
.addComponent(buttonReleasePsys)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonReleaseLocal)))
.addContainerGap())
);
panelSafetyLayout.setVerticalGroup(
panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSafetyLayout.createSequentialGroup()
.addContainerGap()
.addComponent(buttonEnableAll)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonReleaseLocal)
.addComponent(buttonReleasePsys))
.addContainerGap())
);
buttonRecover = new javax.swing.JButton();
buttonEnableAll = new javax.swing.JButton();
panelCommands.setBorder(javax.swing.BorderFactory.createTitledBorder("Commands"));
@@ -431,30 +304,44 @@ public class Expert extends Panel {
spinnerDrySpeed.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.1d, 10.0d, 1.0d));
buttonRecover.setText("Recover");
buttonRecover.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonRecoverActionPerformed(evt);
}
});
buttonEnableAll.setText("Enable Motion");
buttonEnableAll.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonEnableAllActionPerformed(evt);
}
});
javax.swing.GroupLayout panelCommandsLayout = new javax.swing.GroupLayout(panelCommands);
panelCommands.setLayout(panelCommandsLayout);
panelCommandsLayout.setHorizontalGroup(
panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCommandsLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(buttonRecover, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveHeater, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveGonio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMovePark, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonGetGonio, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPutGonio, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMount, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonUnmount, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonGetDewar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPutDewar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonDry, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(buttonMovePark, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonGetGonio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPutGonio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMount, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonUnmount, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonGetDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPutDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonDry, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(30, 30, 30)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonMoveScanner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveHome, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonMoveScanner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveHome, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonMoveDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(panelCommandsLayout.createSequentialGroup()
.addComponent(jLabel7)
@@ -464,8 +351,9 @@ public class Expert extends Panel {
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(spinnerDryTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(buttonHomingHexiposi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(30, Short.MAX_VALUE))
.addComponent(buttonHomingHexiposi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonEnableAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelCommandsLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonGetDewar, buttonGetGonio, buttonHomingHexiposi, buttonMount, buttonMoveDewar, buttonMoveGonio, buttonMoveHeater, buttonMoveHome, buttonMovePark, buttonMoveScanner, buttonPutDewar, buttonPutGonio, buttonUnmount});
@@ -507,139 +395,26 @@ public class Expert extends Panel {
.addComponent(buttonDry)
.addComponent(spinnerDryTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(spinnerDrySpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7))
.addContainerGap())
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Puck Detection"));
buttonPuckDetCheck.setText("Ckeck");
buttonPuckDetCheck.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPuckDetCheckActionPerformed(evt);
}
});
buttonPuckDetStop.setText("Stop");
buttonPuckDetStop.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPuckDetStopActionPerformed(evt);
}
});
buttonPuckDetStart.setText("Start");
buttonPuckDetStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPuckDetStartActionPerformed(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()
.addComponent(buttonPuckDetCheck)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
.addComponent(buttonPuckDetStop)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
.addComponent(buttonPuckDetStart)
.addContainerGap())
);
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonPuckDetCheck, buttonPuckDetStart, buttonPuckDetStop});
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonPuckDetCheck)
.addComponent(buttonPuckDetStop)
.addComponent(buttonPuckDetStart))
.addContainerGap())
);
panelRobot1.setBorder(javax.swing.BorderFactory.createTitledBorder("Dryer"));
buttonHeater.setText("Heater");
buttonHeater.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonHeaterActionPerformed(evt);
}
});
buttonStream.setText("Air Stream");
buttonStream.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStreamActionPerformed(evt);
}
});
javax.swing.GroupLayout panelRobot1Layout = new javax.swing.GroupLayout(panelRobot1);
panelRobot1.setLayout(panelRobot1Layout);
panelRobot1Layout.setHorizontalGroup(
panelRobot1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRobot1Layout.createSequentialGroup()
.addContainerGap(24, Short.MAX_VALUE)
.addComponent(buttonHeater)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonStream)
.addContainerGap(25, Short.MAX_VALUE))
);
panelRobot1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonHeater, buttonStream});
panelRobot1Layout.setVerticalGroup(
panelRobot1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRobot1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(panelRobot1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonHeater)
.addComponent(buttonStream))
.addContainerGap())
.addGroup(panelCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonEnableAll)
.addComponent(buttonRecover))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(panelRobot1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelRobot, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelSafety, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(panelCommands, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addComponent(panelCommands, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jPanel2, jPanel3, panelRobot, panelRobot1, panelSafety});
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(panelCommands, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(panelSafety, 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(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelRobot, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelRobot1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(23, Short.MAX_VALUE))
.addComponent(panelCommands, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
}// </editor-fold>//GEN-END:initComponents
@@ -657,30 +432,10 @@ public class Expert extends Panel {
}//GEN-LAST:event_buttonMountActionPerformed
private void buttonEnableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEnableActionPerformed
execute("robot.enable()", true);
}//GEN-LAST:event_buttonEnableActionPerformed
private void buttonDisableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDisableActionPerformed
execute("robot.disable()", true);
}//GEN-LAST:event_buttonDisableActionPerformed
private void buttonReleaseLocalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReleaseLocalActionPerformed
execute("release_local()", true);
}//GEN-LAST:event_buttonReleaseLocalActionPerformed
private void buttonReleasePsysActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReleasePsysActionPerformed
execute("release_psys()", true);
}//GEN-LAST:event_buttonReleasePsysActionPerformed
private void buttonHomingHexiposiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHomingHexiposiActionPerformed
execute("homing_hexiposi()");
}//GEN-LAST:event_buttonHomingHexiposiActionPerformed
private void buttonPositionsHexiposiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPositionsHexiposiActionPerformed
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();
@@ -715,18 +470,6 @@ public class Expert extends Panel {
execute("put_gonio('force=" + force + ")");
}//GEN-LAST:event_buttonPutGonioActionPerformed
private void buttonPuckDetCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetCheckActionPerformed
execute("check_puck_detection()", true, true);
}//GEN-LAST:event_buttonPuckDetCheckActionPerformed
private void buttonPuckDetStopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetStopActionPerformed
execute("stop_puck_detection()", true);
}//GEN-LAST:event_buttonPuckDetStopActionPerformed
private void buttonPuckDetStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetStartActionPerformed
execute("start_puck_detection()", true);
}//GEN-LAST:event_buttonPuckDetStartActionPerformed
private void buttonMoveParkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonMoveParkActionPerformed
execute("move_park()");
}//GEN-LAST:event_buttonMoveParkActionPerformed
@@ -758,22 +501,15 @@ public class Expert extends Panel {
execute("dry(" + dryTime + ", " + streamTime + ")");
}//GEN-LAST:event_buttonDryActionPerformed
private void buttonHeaterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHeaterActionPerformed
execute("set_heater(" + (buttonHeater.isSelected() ? "True": "False") + ")", true);
}//GEN-LAST:event_buttonHeaterActionPerformed
private void buttonStreamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStreamActionPerformed
execute("set_air_stream(" + (buttonStream.isSelected()? "True": "False")+ ")", true);
}//GEN-LAST:event_buttonStreamActionPerformed
private void buttonRecoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRecoverActionPerformed
execute("robot_recover()");
}//GEN-LAST:event_buttonRecoverActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonDisable;
private javax.swing.JButton buttonDry;
private javax.swing.JButton buttonEnable;
private javax.swing.JButton buttonEnableAll;
private javax.swing.JButton buttonGetDewar;
private javax.swing.JButton buttonGetGonio;
private javax.swing.JToggleButton buttonHeater;
private javax.swing.JButton buttonHomingHexiposi;
private javax.swing.JButton buttonMount;
private javax.swing.JButton buttonMoveDewar;
@@ -782,15 +518,9 @@ public class Expert extends Panel {
private javax.swing.JButton buttonMoveHome;
private javax.swing.JButton buttonMovePark;
private javax.swing.JButton buttonMoveScanner;
private javax.swing.JButton buttonPositionsHexiposi;
private javax.swing.JButton buttonPuckDetCheck;
private javax.swing.JButton buttonPuckDetStart;
private javax.swing.JButton buttonPuckDetStop;
private javax.swing.JButton buttonPutDewar;
private javax.swing.JButton buttonPutGonio;
private javax.swing.JButton buttonReleaseLocal;
private javax.swing.JButton buttonReleasePsys;
private javax.swing.JToggleButton buttonStream;
private javax.swing.JButton buttonRecover;
private javax.swing.JButton buttonUnmount;
private javax.swing.JCheckBox checkDatamatrix;
private javax.swing.JCheckBox checkForce;
@@ -801,13 +531,8 @@ public class Expert extends Panel {
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel panelCommands;
private javax.swing.JPanel panelRobot;
private javax.swing.JPanel panelRobot1;
private javax.swing.JPanel panelSafety;
private javax.swing.JSpinner spinnerDrySpeed;
private javax.swing.JSpinner spinnerDryTime;
private javax.swing.JSpinner spinnerPuck;

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="discretePositionerPanel" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="discretePositionerPanel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.DiscretePositionerPanel" name="discretePositionerPanel">
</Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<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="Initialize"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonHoming" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="buttonHoming" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonHoming">
<Properties>
<Property name="text" type="java.lang.String" value="Homing"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonHomingActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

109
plugins/HexiposiPanel.java Normal file
View File

@@ -0,0 +1,109 @@
import ch.psi.pshell.core.Context;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.swing.DevicePanel;
/**
*
*/
public class HexiposiPanel extends DevicePanel {
/**
* Creates new form HexiposiPositionPanel
*/
public HexiposiPanel() {
initComponents();
}
@Override
public void setDevice(Device device){
super.setDevice(device);
discretePositionerPanel.setDevice(device);
}
@Override
public void setEnabled(boolean enabled){
super.setEnabled(enabled);
discretePositionerPanel.setEnabled(enabled);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
discretePositionerPanel = new ch.psi.pshell.swing.DiscretePositionerPanel();
jPanel1 = new javax.swing.JPanel();
buttonHoming = new javax.swing.JButton();
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Initialize"));
buttonHoming.setText("Homing");
buttonHoming.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonHomingActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonHoming)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(buttonHoming)
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(discretePositionerPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(discretePositionerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonHomingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHomingActionPerformed
try {
Context.getInstance().evalLineAsync("hexiposi.move_home()").handle((ret, ex) -> {
if (ex != null){
showException((Exception)ex);
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}//GEN-LAST:event_buttonHomingActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonHoming;
private ch.psi.pshell.swing.DiscretePositionerPanel discretePositionerPanel;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
}

View File

@@ -3,11 +3,15 @@
*/
import ch.psi.pshell.core.Context;
import ch.psi.pshell.plot.TimePlotBase;
import ch.psi.pshell.swing.StripChart;
import ch.psi.pshell.ui.App;
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import java.awt.Dimension;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -16,6 +20,7 @@ import java.util.logging.Logger;
*/
public class LN2 extends Panel {
final StripChart stripChart;
TimePlotBase plot;
public LN2() {
initComponents();
stripChart = new StripChart(this.getTopLevel(), false, App.getStripChartFolderArg());
@@ -27,23 +32,30 @@ public class LN2 extends Panel {
} catch (Exception ex) {
showException(ex);
Logger.getLogger(LN2.class.getName()).log(Level.WARNING, null, ex);
}
}
plot = (TimePlotBase) SwingUtils.getComponentsByType(stripChart.getPlotPanel(),TimePlotBase.class)[0];
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStop() {
//saveImage();
super.onStop();
}
@Override
public void onStateChange(State state, State former) {
if ( (state == State.Closing) ||
((state == State.Initializing) && (former != State.Invalid))
){
saveImage();
}
}
@@ -51,6 +63,17 @@ public class LN2 extends Panel {
public void onExecutedFile(String fileName, Object result) {
}
public void saveImage(){
getLogger().severe("Saving image");
try {
String fileName = new File(getContext().getSetup().expandPath("{images}/ln2/{date}_{time}.png")).getCanonicalPath();
getLogger().severe("File: " + fileName);
plot.saveSnapshot(fileName, "png", new Dimension(1200,800));
} catch (Exception ex) {
getLogger().log(Level.SEVERE, null, ex);
}
getLogger().severe("Done");
}
//Callback to perform update - in event thread
@Override

59
plugins/LaserUEPanel.form Normal file
View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="historyChart" pref="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="deviceStatePanel2" pref="297" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="deviceValuePanel1" pref="297" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="historyChart" pref="307" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="deviceStatePanel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="deviceValuePanel1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="deviceStatePanel2">
<Properties>
<Property name="deviceName" type="java.lang.String" value="ue"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.HistoryChart" name="historyChart">
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="deviceValuePanel1">
<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="Value"/>
</Border>
</Property>
<Property name="deviceName" type="java.lang.String" value="ue"/>
</Properties>
</Component>
</SubComponents>
</Form>

98
plugins/LaserUEPanel.java Normal file
View File

@@ -0,0 +1,98 @@
import ch.psi.pshell.core.Context;
import ch.psi.pshell.device.Device;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.utils.swing.SwingUtils;
/**
*
*/
public class LaserUEPanel extends DevicePanel {
public LaserUEPanel() {
initComponents();
}
@Override
public void setDevice(Device device){
super.setDevice(device);
if (device!=null){
historyChart.addDevice("Laser Distance", device);
} else {
for (Device d: historyChart.getDevices()){
historyChart.removeDevice(device);
}
}
}
void execute(String statement, boolean showReturn){
try {
Context.getInstance().evalLineBackgroundAsync(statement).handle((ret, ex) -> {
if (LaserUEPanel.this.isShowing()){
if (ex != null){
showException((Exception)ex);
} else if (showReturn){
if (ret == null){
SwingUtils.showMessage(this, "Return", "No code detected", 20000);
} else {
SwingUtils.showMessage(this, "Return", "Detected code: " +ret, 20000);
}
}
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
deviceStatePanel2 = new ch.psi.pshell.swing.DeviceStatePanel();
try {
historyChart = new ch.psi.pshell.swing.HistoryChart();
} catch (java.lang.ClassNotFoundException e1) {
e1.printStackTrace();
} catch (java.lang.InstantiationException e2) {
e2.printStackTrace();
} catch (java.lang.IllegalAccessException e3) {
e3.printStackTrace();
}
deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
deviceStatePanel2.setDeviceName("ue");
deviceValuePanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Value"));
deviceValuePanel1.setDeviceName("ue");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(historyChart, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(deviceStatePanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(historyChart, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(deviceStatePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private ch.psi.pshell.swing.DeviceStatePanel deviceStatePanel2;
private ch.psi.pshell.swing.DeviceValuePanel deviceValuePanel1;
private ch.psi.pshell.swing.HistoryChart historyChart;
// End of variables declaration//GEN-END:variables
}

Binary file not shown.

View File

@@ -35,9 +35,9 @@ public class MjpegSource2 extends SourceBase {
super.doInitialize();
URL aux = new URL(url);
stream = aux.openStream();
// if (!stream.markSupported()) {
if (!stream.markSupported()) {
stream = new BufferedInputStream(stream);
// }
}
}
Thread monitoredThread;
@@ -102,7 +102,7 @@ public class MjpegSource2 extends SourceBase {
if (endOfFrame >= 0) {
stream.reset();
stream.skip(startOfFrame);
int length = endOfFrame - END_OF_FRAME.length;
int length = endOfFrame ;//- END_OF_FRAME.length ;
byte[] data = new byte[length];
stream.read(data, 0, length);
return data;

View File

@@ -1,169 +0,0 @@
import ch.psi.pshell.device.DeviceBase;
import ch.psi.utils.Arr;
import ch.psi.utils.Chrono;
import ch.psi.utils.State;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
public class PuckDetection extends DeviceBase{
public static final int PUCKS_NUMBER = 30;
final String server;
public volatile Chrono chrono;
public PuckDetection(String name, String server){
super(name);
this.server = server.startsWith("tcp://") ? server : "tcp://" + server;
}
public static class PuckState{
public boolean online;
public boolean mecSwitch;
public boolean indSwitch;
void clear(){
online = false;
mecSwitch = false;
indSwitch = false;
}
void set(boolean mecSwitch, boolean indSwitch){
online = true;
this.mecSwitch = mecSwitch;
this.indSwitch = indSwitch;
}
@Override
public String toString(){
return "Online = " + online + "\ns1 = " + mecSwitch+ "\ns2 = " + indSwitch;
}
}
PuckState[] pucks;
public PuckState[] getPucks(){
return pucks;
}
//From 1 to PUCKS_NUMBER
public PuckState getPuck(int id) throws Exception{
assertInitialized();
if ((id<=0) || (id>PUCKS_NUMBER)){
throw new Exception("invalid puck id: "+ id);
}
return pucks[id-1];
}
Thread thread;
Thread watchDog;
@Override
protected void doInitialize() throws IOException, InterruptedException{
doClose();
super.doInitialize();
pucks = new PuckState[PUCKS_NUMBER];
for (int i=0; i<PUCKS_NUMBER; i++ ){
pucks[i] = new PuckState();
}
chrono = new Chrono();
thread = new Thread(new Runnable() {
@Override
public void run() {
subscriberTask();
}
});
thread.setDaemon(true);
thread.start();
watchDog = new Thread(new Runnable() {
@Override
public void run() {
try{
while (!Thread.currentThread().isInterrupted()) {
if (chrono.isTimeout(3000)){
setState(State.Offline);
for (PuckState puck:pucks){
puck.clear();
}
}
Thread.sleep(1000);
}
} catch (Exception ex){
getLogger().log(Level.INFO, null, ex);
}
}
});
watchDog.setDaemon(true);
watchDog.start();
}
void subscriberTask(){
try{
setState(State.Ready);
org.zeromq.ZMQ.Context context = org.zeromq.ZMQ.context(1);
org.zeromq.ZMQ.Socket subscriber = context.socket(org.zeromq.ZMQ.SUB);
subscriber.connect(server);
subscriber.subscribe("Status".getBytes());
try{
while (!Thread.currentThread().isInterrupted()) {
String type = subscriber.recvStr();
System.out.println(type);
String contents = subscriber.recvStr();
System.out.println(contents);
processMessage(contents);
setState(State.Ready);
chrono = new Chrono();
}
} finally{
for (PuckState puck:pucks){
puck.clear();
}
subscriber.close();
context.term();
}
} catch (Exception ex){
getLogger().log(Level.INFO, null, ex);
}
setState(State.Offline);
}
void processMessage(String msg){
ArrayList<Integer> present = new ArrayList<>();
for (String line:msg.split("\t")){
try{
line = line.trim();
String[] tokens = line.split(" ");
int id = Integer.valueOf(tokens[0].substring(1));
present.add(id);
PuckState puck = getPuck(id);
if (tokens.length<3){
puck.clear();
} else {
puck.set(tokens[1].trim().equals("1"),tokens[2].trim().equals("1"));
}
} catch (Exception ex){
getLogger().log(Level.INFO, null, ex);
}
}
for (int i=1; i<= PUCKS_NUMBER; i++){
if (!Arr.containsEqual(present.toArray(), i)){
pucks[i-1].clear();
}
}
}
@Override
protected void doClose(){
if (watchDog!=null){
watchDog.interrupt();
watchDog = null;
}
if (thread!=null){
thread.interrupt();
thread = null;
}
}
}

View File

@@ -0,0 +1,184 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel3" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="deviceStatePanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="deviceStatePanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<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="Raspberry Pi "/>
</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"/>
<Component id="buttonPuckDetCheck" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="107" max="32767" attributes="0"/>
<Component id="buttonPuckDetStop" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="108" max="32767" attributes="0"/>
<Component id="buttonPuckDetStart" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" 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="buttonPuckDetCheck" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPuckDetStop" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPuckDetStart" 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="buttonPuckDetCheck">
<Properties>
<Property name="text" type="java.lang.String" value="Ckeck"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetCheckActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPuckDetStop">
<Properties>
<Property name="text" type="java.lang.String" value="Stop"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetStopActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPuckDetStart">
<Properties>
<Property name="text" type="java.lang.String" value="Start"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPuckDetStartActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel1">
<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="Detection"/>
</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"/>
<Component id="jScrollPane1" pref="0" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" pref="274" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="table">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="6" rowCount="30">
<Column editable="false" title="Puck" type="java.lang.String"/>
<Column editable="false" title="Online" type="java.lang.Boolean"/>
<Column editable="false" title="Mechanical" type="java.lang.Boolean"/>
<Column editable="false" title="Inductive" type="java.lang.Boolean"/>
<Column editable="false" title="Detection" type="java.lang.String"/>
<Column editable="false" title="Image" type="java.lang.String"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
</TableColumnModel>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="deviceStatePanel1">
<Properties>
<Property name="deviceName" type="java.lang.String" value="puck_detection"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -0,0 +1,250 @@
import ch.psi.mxsc.Puck;
import ch.psi.mxsc.PuckDetection;
import ch.psi.mxsc.PuckState;
import ch.psi.pshell.core.Context;
import ch.psi.pshell.swing.DevicePanel;
import ch.psi.utils.swing.SwingUtils;
/**
*
*/
public class PuckDetectionPanel extends DevicePanel {
public PuckDetectionPanel() {
initComponents();
int row = 0;
for (String segment : new String[]{"A", "B", "C", "D", "E", "F"}){
for (int puck=1; puck<=5; puck++){
table.getModel().setValueAt(segment+puck, row++, 0);
}
}
}
@Override
public PuckDetection getDevice(){
return (PuckDetection) super.getDevice();
}
@Override
protected void onDeviceCacheChanged(Object value, Object former, long timestamp, boolean arg3) {
for (int row=0; row< 30; row++){
String name = table.getModel().getValueAt(row, 0).toString();
//int id = row+1;
try {
Puck puck = getDevice().getPuck(name);
int id = puck.getIndex() + 1;
PuckState state = getDevice().getPuckState(id);
table.getModel().setValueAt(state.online, row, 1);
table.getModel().setValueAt(state.mecSwitch, row, 2);
table.getModel().setValueAt(state.indSwitch, row, 3);
table.getModel().setValueAt(puck.getDetection() == null ? "" : puck.getDetection(), row, 4);
table.getModel().setValueAt(puck.getImageDetection() == null ? "" : puck.getImageDetection(), row, 5);
} catch (Exception ex) {
ex.printStackTrace();
table.getModel().setValueAt(false, row, 1);
table.getModel().setValueAt(false, row, 2);
table.getModel().setValueAt(false, row, 3);
table.getModel().setValueAt("", row, 4);
table.getModel().setValueAt("", row, 5);
}
}
}
void execute(String statement, boolean showReturn){
try {
Context.getInstance().evalLineBackgroundAsync(statement).handle((ret, ex) -> {
if (ex != null){
showException((Exception)ex);
} else if (showReturn){
SwingUtils.showMessage(this, "Return", String.valueOf(ret));
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
buttonPuckDetCheck = new javax.swing.JButton();
buttonPuckDetStop = new javax.swing.JButton();
buttonPuckDetStart = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
table = new javax.swing.JTable();
deviceStatePanel1 = new ch.psi.pshell.swing.DeviceStatePanel();
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Raspberry Pi "));
buttonPuckDetCheck.setText("Ckeck");
buttonPuckDetCheck.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPuckDetCheckActionPerformed(evt);
}
});
buttonPuckDetStop.setText("Stop");
buttonPuckDetStop.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPuckDetStopActionPerformed(evt);
}
});
buttonPuckDetStart.setText("Start");
buttonPuckDetStart.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPuckDetStartActionPerformed(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()
.addComponent(buttonPuckDetCheck)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 107, Short.MAX_VALUE)
.addComponent(buttonPuckDetStop)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 108, Short.MAX_VALUE)
.addComponent(buttonPuckDetStart)
.addContainerGap())
);
jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonPuckDetCheck, buttonPuckDetStart, buttonPuckDetStop});
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonPuckDetCheck)
.addComponent(buttonPuckDetStop)
.addComponent(buttonPuckDetStart))
.addContainerGap())
);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Detection"));
table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null},
{null, null, null, null, null, null}
},
new String [] {
"Puck", "Online", "Mechanical", "Inductive", "Detection", "Image"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.Boolean.class, java.lang.Boolean.class, java.lang.Boolean.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(table);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE)
.addContainerGap())
);
deviceStatePanel1.setDeviceName("puck_detection");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel3, 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.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(0, 0, 0)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonPuckDetCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetCheckActionPerformed
execute("check_puck_detection()", true);
}//GEN-LAST:event_buttonPuckDetCheckActionPerformed
private void buttonPuckDetStopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetStopActionPerformed
execute("stop_puck_detection()", false);
}//GEN-LAST:event_buttonPuckDetStopActionPerformed
private void buttonPuckDetStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPuckDetStartActionPerformed
execute("start_puck_detection()", false);
}//GEN-LAST:event_buttonPuckDetStartActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonPuckDetCheck;
private javax.swing.JButton buttonPuckDetStart;
private javax.swing.JButton buttonPuckDetStop;
private ch.psi.pshell.swing.DeviceStatePanel deviceStatePanel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable table;
// End of variables declaration//GEN-END:variables
}

View File

@@ -20,6 +20,7 @@
<Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel3" alignment="0" max="32767" attributes="0"/>
<Component id="panelState" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel4" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@@ -27,6 +28,8 @@
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
@@ -446,5 +449,103 @@
</Container>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="panelState">
</Component>
<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="Tool"/>
</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"/>
<Component id="jLabel5" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledOpen" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelPowerCtr1" min="-2" max="-2" attributes="0"/>
<EmptySpace 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="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel5" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledOpen" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelPowerCtr1" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.Led" name="ledOpen">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="SansSerif" size="18" style="0"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Open:"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelPowerCtr1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="buttonOpen" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="18" max="32767" attributes="0"/>
<Component id="buttonClose" linkSize="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Group type="103" alignment="2" groupAlignment="1" max="-2" attributes="0">
<Component id="buttonClose" alignment="1" max="32767" attributes="0"/>
<Component id="buttonOpen" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonClose">
<Properties>
<Property name="text" type="java.lang.String" value=" Close "/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonCloseActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonOpen">
<Properties>
<Property name="text" type="java.lang.String" value=" Open "/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonOpenActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@@ -5,7 +5,6 @@ import ch.psi.pshell.swing.DevicePanel;
import ch.psi.pshell.core.Context;
import ch.psi.utils.State;
import java.awt.Color;
import java.lang.reflect.Method;
import java.util.Map;
/**
@@ -52,6 +51,7 @@ public class RobotPanel extends DevicePanel {
Boolean empty = null;
Boolean settled = null;
Boolean moving = null;
Boolean open = null;
Integer speed = null;
String task = null;
String mode = null;
@@ -70,6 +70,10 @@ public class RobotPanel extends DevicePanel {
settled = (Boolean) status.get("settled");
} catch (Exception ex) {
}
try {
open = (Boolean) status.get("open");
} catch (Exception ex) {
}
try {
speed = (Integer) status.get("speed");
} catch (Exception ex) {
@@ -109,6 +113,7 @@ public class RobotPanel extends DevicePanel {
ledPowered.setColor((powered == null) ? Color.GRAY : (powered ? Color.YELLOW : Color.DARK_GRAY));
ledEmpty.setColor((empty == null) ? Color.GRAY : (empty ? Color.GREEN : Color.YELLOW));
ledSettled.setColor((settled == null) ? Color.GRAY : (settled ? Color.GREEN : Color.YELLOW));
ledOpen.setColor((open == null) ? Color.GRAY : (open ? Color.GREEN : Color.DARK_GRAY));
ledMoving.setColor((moving == null) ? Color.GRAY : (moving ? Color.YELLOW : Color.DARK_GRAY));
textTask.setText((task == null) ? "" : task);
ledTask.setColor((task == null) ? Color.GRAY : (task.isEmpty() ? Color.DARK_GRAY : Color.YELLOW));
@@ -164,6 +169,12 @@ public class RobotPanel extends DevicePanel {
ledTask = new ch.psi.pshell.swing.Led();
ledMode = new ch.psi.pshell.swing.Led();
panelState = new ch.psi.pshell.swing.DeviceStatePanel();
jPanel4 = new javax.swing.JPanel();
ledOpen = new ch.psi.pshell.swing.Led();
jLabel5 = new javax.swing.JLabel();
panelPowerCtr1 = new javax.swing.JPanel();
buttonClose = new javax.swing.JButton();
buttonOpen = new javax.swing.JButton();
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Power"));
@@ -428,6 +439,74 @@ public class RobotPanel extends DevicePanel {
.addGap(2, 2, 2))
);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Tool"));
ledOpen.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Open:");
buttonClose.setText(" Close ");
buttonClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonCloseActionPerformed(evt);
}
});
buttonOpen.setText(" Open ");
buttonOpen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonOpenActionPerformed(evt);
}
});
javax.swing.GroupLayout panelPowerCtr1Layout = new javax.swing.GroupLayout(panelPowerCtr1);
panelPowerCtr1.setLayout(panelPowerCtr1Layout);
panelPowerCtr1Layout.setHorizontalGroup(
panelPowerCtr1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPowerCtr1Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(buttonOpen)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
.addComponent(buttonClose))
);
panelPowerCtr1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonClose, buttonOpen});
panelPowerCtr1Layout.setVerticalGroup(
panelPowerCtr1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelPowerCtr1Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addGroup(panelPowerCtr1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(buttonClose, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonOpen))
.addGap(0, 0, 0))
);
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()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledOpen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelPowerCtr1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel5)
.addComponent(ledOpen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelPowerCtr1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@@ -436,12 +515,15 @@ public class RobotPanel extends DevicePanel {
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelState, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -509,32 +591,54 @@ public class RobotPanel extends DevicePanel {
}
}//GEN-LAST:event_buttonAbortActionPerformed
private void buttonCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCloseActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".close_tool()");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_buttonCloseActionPerformed
private void buttonOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOpenActionPerformed
try{
Context.getInstance().evalLineBackground(getDevice().getName() + ".open_tool()");
} catch (Exception ex){
this.showException(ex);
}
}//GEN-LAST:event_buttonOpenActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton butonStop;
private javax.swing.JButton buttonAbort;
private javax.swing.JButton buttonClose;
private javax.swing.JButton buttonDisable;
private javax.swing.JButton buttonEnable;
private javax.swing.JButton buttonOpen;
private javax.swing.JButton buttonPause;
private javax.swing.JButton buttonResume;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private ch.psi.pshell.swing.Led ledEmpty;
private ch.psi.pshell.swing.Led ledMode;
private ch.psi.pshell.swing.Led ledMoving;
private ch.psi.pshell.swing.Led ledOpen;
private ch.psi.pshell.swing.Led ledPowered;
private ch.psi.pshell.swing.Led ledSettled;
private ch.psi.pshell.swing.Led ledTask;
private javax.swing.JPanel panelMotionCtr;
private javax.swing.JPanel panelPowerCtr;
private javax.swing.JPanel panelPowerCtr1;
private ch.psi.pshell.swing.DeviceStatePanel panelState;
private javax.swing.JSpinner spinnerSpeed;
private javax.swing.JTextField textMode;

167
plugins/WagoPanel.form Normal file
View File

@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="deviceStatePanel1" max="32767" attributes="0"/>
<Component id="panelSafety" max="32767" attributes="0"/>
<Component id="panelRobot1" max="32767" attributes="0"/>
<Component id="panelDewar" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="panelSafety" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelDewar" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="panelRobot1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="deviceStatePanel1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="deviceStatePanel1">
<Properties>
<Property name="deviceName" type="java.lang.String" value="wago"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelSafety">
<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" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonReleasePsys" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonReleaseLocal" linkSize="2" min="-2" max="-2" attributes="0"/>
<EmptySpace 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="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="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="panelRobot1">
<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="Dryer"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonHeater" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonStream" linkSize="3" min="-2" max="-2" attributes="0"/>
<EmptySpace 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="buttonHeater" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonStream" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JToggleButton" name="buttonHeater">
<Properties>
<Property name="text" type="java.lang.String" value="Heater"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonHeaterActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JToggleButton" name="buttonStream">
<Properties>
<Property name="text" type="java.lang.String" value="Air Stream"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonStreamActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.ProcessVariablePanel" name="panelDewar">
<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 justification="1" title="Dewar Light"/>
</Border>
</Property>
<Property name="deviceName" type="java.lang.String" value="led_level"/>
<Property name="showAdvanced" type="boolean" value="false"/>
<Property name="showButtons" type="boolean" value="false"/>
<Property name="showLimitButtons" type="boolean" value="false"/>
<Property name="showSlider" type="boolean" value="true"/>
<Property name="showStop" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Form>

207
plugins/WagoPanel.java Normal file
View File

@@ -0,0 +1,207 @@
import ch.psi.mxsc.Controller;
import ch.psi.pshell.core.Context;
import ch.psi.pshell.swing.DevicePanel;
import java.util.concurrent.CompletableFuture;
import javax.swing.border.TitledBorder;
/**
*
*/
public class WagoPanel extends DevicePanel {
public WagoPanel() {
initComponents();
this.startTimer(10000);
}
CompletableFuture future;
@Override
public void onTimer(){
if ((getDevice()!=null)){
updateTitle();
}
}
void updateTitle(){
Boolean roomTemp = (Controller.getInstance().isLedRoomTemp());
if (roomTemp==null){
((TitledBorder)panelDewar.getBorder()).setTitle("Dewar Light");
} else if (roomTemp==true){
((TitledBorder)panelDewar.getBorder()).setTitle("Dewar Light (room temperature)");
} else {
((TitledBorder)panelDewar.getBorder()).setTitle("Dewar Light (LN2)");
}
}
void execute(String statement){
try {
Context.getInstance().evalLineBackgroundAsync(statement).handle((ret, ex) -> {
if (WagoPanel.this.isShowing()){
if (ex != null){
showException((Exception)ex);
}
}
return ret;
});
} catch (Exception ex) {
showException(ex);
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
deviceStatePanel1 = new ch.psi.pshell.swing.DeviceStatePanel();
panelSafety = new javax.swing.JPanel();
buttonReleasePsys = new javax.swing.JButton();
buttonReleaseLocal = new javax.swing.JButton();
panelRobot1 = new javax.swing.JPanel();
buttonHeater = new javax.swing.JToggleButton();
buttonStream = new javax.swing.JToggleButton();
panelDewar = new ch.psi.pshell.swing.ProcessVariablePanel();
deviceStatePanel1.setDeviceName("wago");
panelSafety.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);
}
});
buttonReleaseLocal.setText("Release Local");
buttonReleaseLocal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonReleaseLocalActionPerformed(evt);
}
});
javax.swing.GroupLayout panelSafetyLayout = new javax.swing.GroupLayout(panelSafety);
panelSafety.setLayout(panelSafetyLayout);
panelSafetyLayout.setHorizontalGroup(
panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSafetyLayout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonReleasePsys)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonReleaseLocal)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelSafetyLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonReleaseLocal, buttonReleasePsys});
panelSafetyLayout.setVerticalGroup(
panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelSafetyLayout.createSequentialGroup()
.addContainerGap()
.addGroup(panelSafetyLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonReleaseLocal)
.addComponent(buttonReleasePsys))
.addContainerGap())
);
panelRobot1.setBorder(javax.swing.BorderFactory.createTitledBorder("Dryer"));
buttonHeater.setText("Heater");
buttonHeater.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonHeaterActionPerformed(evt);
}
});
buttonStream.setText("Air Stream");
buttonStream.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonStreamActionPerformed(evt);
}
});
javax.swing.GroupLayout panelRobot1Layout = new javax.swing.GroupLayout(panelRobot1);
panelRobot1.setLayout(panelRobot1Layout);
panelRobot1Layout.setHorizontalGroup(
panelRobot1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRobot1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonHeater)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonStream)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panelRobot1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonHeater, buttonStream});
panelRobot1Layout.setVerticalGroup(
panelRobot1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(panelRobot1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(panelRobot1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonHeater)
.addComponent(buttonStream))
.addContainerGap())
);
panelDewar.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dewar Light", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION));
panelDewar.setDeviceName("led_level");
panelDewar.setShowAdvanced(false);
panelDewar.setShowButtons(false);
panelDewar.setShowLimitButtons(false);
panelDewar.setShowSlider(true);
panelDewar.setShowStop(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelSafety, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelRobot1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(panelDewar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(panelSafety, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(panelDewar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(panelRobot1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(deviceStatePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>//GEN-END:initComponents
private void buttonReleasePsysActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReleasePsysActionPerformed
execute("release_psys()");
}//GEN-LAST:event_buttonReleasePsysActionPerformed
private void buttonReleaseLocalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonReleaseLocalActionPerformed
execute("release_local()");
}//GEN-LAST:event_buttonReleaseLocalActionPerformed
private void buttonHeaterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHeaterActionPerformed
execute("set_heater(" + (buttonHeater.isSelected() ? "True": "False") + ")");
}//GEN-LAST:event_buttonHeaterActionPerformed
private void buttonStreamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStreamActionPerformed
execute("set_air_stream(" + (buttonStream.isSelected()? "True": "False")+ ")");
}//GEN-LAST:event_buttonStreamActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JToggleButton buttonHeater;
private javax.swing.JButton buttonReleaseLocal;
private javax.swing.JButton buttonReleasePsys;
private javax.swing.JToggleButton buttonStream;
private ch.psi.pshell.swing.DeviceStatePanel deviceStatePanel1;
private ch.psi.pshell.swing.ProcessVariablePanel panelDewar;
private javax.swing.JPanel panelRobot1;
private javax.swing.JPanel panelSafety;
// End of variables declaration//GEN-END:variables
}

View File

@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="358" 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="29" max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="85" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="jButton1"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View File

@@ -1,82 +0,0 @@
/*
* Copyright (c) 2014-2017 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.ui.Panel;
import ch.psi.utils.State;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
*/
public class Wayne extends Panel {
public Wayne() {
initComponents();
}
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
}
@Override
public void onStateChange(State state, State former) {
}
@Override
public void onExecutedFile(String fileName, Object result) {
}
//Callback to perform update - in event thread
@Override
protected void doUpdate() {
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
jButton1.setText("jButton1");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jButton1)
.addContainerGap(358, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(29, 29, 29)
.addComponent(jButton1)
.addContainerGap(85, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
try {
this.runAsync("test/RobotCartesianScan");
} catch (Exception ex) {
Logger.getLogger(Wayne.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
// End of variables declaration//GEN-END:variables
}

View File

@@ -40,6 +40,7 @@ class RobotTCP(TcpDevice, Stoppable):
self.joint_motors = []
self.tool = None
self.default_desc = None
self.tool_open = None
#self.tool_trsf = [0.0] * 6
self.frame = FRAME_DEFAULT
self.polling_interval = 0.01
@@ -52,7 +53,7 @@ class RobotTCP(TcpDevice, Stoppable):
def doInitialize(self):
super(RobotTCP, self).doInitialize()
self.reset = True
self.reset = True
def set_tool(self, tool):
self.tool = tool
@@ -60,7 +61,8 @@ class RobotTCP(TcpDevice, Stoppable):
self.evaluate("tcp_curtool=" + tool)
if self.cartesian_motors_enabled:
self.update()
self.set_motors_enabled(True)
self.set_motors_enabled(True)
self.is_tool_open()
def get_tool(self):
return self.tool
@@ -395,18 +397,36 @@ class RobotTCP(TcpDevice, Stoppable):
#self.waitState(State.Ready, -1)
#Tool
#This function can timeout since it synchronizes move.
#Better check state before otherwise it can freeze the communication
#Tool - synchronized as can freeze communication
"""
def open_tool(self, tool=None, timeout=3000):
#This function can timeout since it synchronizes move. Checking state before otherwise it can freeze the communication.
self.waitState(State.Ready, -1)
if tool is None: tool = self.tool
return self.evaluate("open(" + tool + " )", timeout=timeout)
def close_tool(self, tool=None, timeout=3000):
#This function can timeout since it synchronizes move. Checking state before otherwise it can freeze the communication.
self.waitState(State.Ready, -1)
if tool is None: tool = self.tool
return self.evaluate("close(" + tool + " )", timeout=timeout)
"""
#Tool - Not synchronized calls: atention to open/close only when state is Ready
def open_tool(self, tool=None):
if tool is None: tool = self.tool
return self.evaluate("open(" + tool + " )", timeout=3000)
self.evaluate(tool + ".gripper=true")
self.tool_open = True
#This function can timeout since it synchronizes move. Better check state before
#Better check state before otherwise it can freeze the communication
def close_tool(self, tool=None):
if tool is None: tool = self.tool
return self.evaluate("close(" + tool + " )", timeout=3000)
self.evaluate(tool + ".gripper=false")
self.tool_open = False
def is_tool_open(self, tool=None):
if tool is None: tool = self.tool
self.tool_open = robot.eval_bool(tool + ".gripper")
return self.tool_open
#Arm position
def herej(self):
@@ -521,6 +541,7 @@ class RobotTCP(TcpDevice, Stoppable):
self.speed = int(sts[3])
self.empty = sts[4] == "1"
self.settled = sts[5] == "1"
#TODO: add tool open
if cur_task is not None:
if int(sts[6]) < 0:
log("Task "+ str(cur_task) + " finished with code: " + str(sts[7]), False)
@@ -547,7 +568,8 @@ class RobotTCP(TcpDevice, Stoppable):
"settled": self.settled,
"task": cur_task,
"mode": self.working_mode,
"status": self.status
"status": self.status,
"open": self.tool_open
}, None)
if self.cartesian_motors_enabled:
for m in self.cartesian_motors:

View File

@@ -4,6 +4,7 @@
import traceback
from ch.psi.pshell.serial import TcpDevice
from ch.psi.pshell.modbus import ModbusTCP
import ch.psi.mxsc.Controller as Controller
run("setup/Layout")
@@ -60,6 +61,16 @@ def system_check(robot_move=True):
if not guiding_tool_park().read():
raise Exception("Guiding tool not parked")
def get_puck_elect_detection(segment, puck):
return str(Controller.getInstance().getPuck(str(segment).upper() + str(puck)).detection)
def get_puck_img_detection(segment, puck):
return str(Controller.getInstance().getPuck(str(segment).upper() + str(puck)).imageDetection)
def assert_puck_detected(segment, puck):
if get_puck_detection(segment, puck) != "Present":
raise Exception ("Puck " + str(segment).upper() + str(puck) + " not present")
def start_puck_detection():
run("tools/RestartPuckDetection")

View File

@@ -5,6 +5,8 @@ def get_dewar(segment, puck, sample, force=False):
#Initial checks
assertValidAddress(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()

View File

@@ -5,6 +5,8 @@ def mount(segment, puck, sample, force=False, read_dm=False):
start = time.time()
#Initial checks
assertValidAddress(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()

View File

@@ -5,6 +5,8 @@ def put_dewar(segment, puck, sample, force=False):
#Initial checks
assertValidAddress(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()

5
script/motion/recover.py Normal file
View File

@@ -0,0 +1,5 @@
def recover():
"""
"""
print "recover"

View File

@@ -11,6 +11,4 @@ def robot_recover():
#Enabling
enable_motion()
#barcode_reader.start_read(20.0)
robot.robot_recover()

View File

@@ -5,6 +5,8 @@ def unmount(segment, puck, sample, force=False):
#Initial checks
assertValidAddress(segment, puck, sample)
assert_puck_detected(segment, puck)
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()

View File

@@ -1,6 +1,6 @@
import ch.psi.pshell.imaging.MjpegSource as MjpegSource
MjpegSource2 = get_context().pluginManager.getDynamicClass("MjpegSource2")
add_device(MjpegSource2("gripper_cam", "http://129.129.110.114/axis-cgi/mjpg/video.cgi"), True)
gripper_cam.polling=100
#gripper_cam.monitored = True
add_device(MjpegSource("gripper_cam", "http://129.129.110.114/axis-cgi/mjpg/video.cgi"), True)
#gripper_cam.polling=1000
gripper_cam.monitored = True
show_panel(gripper_cam)