diff --git a/config/config.properties b/config/config.properties index b95ee3a..f2b87fd 100644 --- a/config/config.properties +++ b/config/config.properties @@ -1,4 +1,4 @@ -#Thu Jan 24 14:24:44 CET 2019 +#Tue Feb 05 08:51:03 CET 2019 autoSaveScanData=true commandExecutionEvents=false createSessionFiles=true @@ -13,7 +13,7 @@ depthDimension=0 hostName=null instanceName=X06SA logDaysToLive=30 -logLevel=Finer +logLevel=Fine logLevelConsole=Off logPath={logs}/{date}_{time} notificationLevel=null diff --git a/config/settings.properties b/config/settings.properties index b384c6a..81386ef 100644 --- a/config/settings.properties +++ b/config/settings.properties @@ -1,10 +1,12 @@ -#Thu Jan 24 14:40:47 CET 2019 +#Tue Feb 05 15:50:04 CET 2019 barcode_reader_scan_pucks=false -dry_mount_counter=0 -dry_timestamp=1.548326732257E9 +dry_mount_counter=5 +dry_timestamp=1.549363107489E9 force_dry_mount_count=20 force_dry_timeout=0 imaging_enabled=false led_level=0.0 +mounted_sample_position=E53 +pin_offset=0.0 puck_types=true room_temperature_enabled=false diff --git a/devices/A1.properties b/devices/A1.properties new file mode 100644 index 0000000..ffc6cf1 --- /dev/null +++ b/devices/A1.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:22:35 CET 2019 +detection=Both +disabled=true diff --git a/devices/A2.properties b/devices/A2.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/A2.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/A3.properties b/devices/A3.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/A3.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/A4.properties b/devices/A4.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/A4.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/A5.properties b/devices/A5.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/A5.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/B1.properties b/devices/B1.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/B1.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/B2.properties b/devices/B2.properties new file mode 100644 index 0000000..e9ea95f --- /dev/null +++ b/devices/B2.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:30:50 CET 2019 +detection=Both +disabled=false diff --git a/devices/B3.properties b/devices/B3.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/B3.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/B4.properties b/devices/B4.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/B4.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/B5.properties b/devices/B5.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/B5.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/C1.properties b/devices/C1.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/C1.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/C2.properties b/devices/C2.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/C2.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/C3.properties b/devices/C3.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/C3.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/C4.properties b/devices/C4.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/C4.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/C5.properties b/devices/C5.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/C5.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/D1.properties b/devices/D1.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/D1.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/D2.properties b/devices/D2.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/D2.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/D3.properties b/devices/D3.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/D3.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/D4.properties b/devices/D4.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/D4.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/D5.properties b/devices/D5.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/D5.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/E1.properties b/devices/E1.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/E1.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/E2.properties b/devices/E2.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/E2.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/E3.properties b/devices/E3.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/E3.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/E4.properties b/devices/E4.properties new file mode 100644 index 0000000..8d60a33 --- /dev/null +++ b/devices/E4.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:52:26 CET 2019 +detection=Both +disabled=false diff --git a/devices/E5.properties b/devices/E5.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/E5.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/F1.properties b/devices/F1.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/F1.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/F2.properties b/devices/F2.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/F2.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/F3.properties b/devices/F3.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/F3.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/F4.properties b/devices/F4.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/F4.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/F5.properties b/devices/F5.properties new file mode 100644 index 0000000..81154ea --- /dev/null +++ b/devices/F5.properties @@ -0,0 +1,3 @@ +#Tue Feb 05 15:17:58 CET 2019 +detection=Both +disabled=false diff --git a/devices/smart_magnet.properties b/devices/smart_magnet.properties index 04f7166..b74c530 100644 --- a/devices/smart_magnet.properties +++ b/devices/smart_magnet.properties @@ -1,8 +1,8 @@ -#Fri Jan 18 11:16:24 CET 2019 -holdingCurrent=40.0 +#Tue Feb 05 11:22:07 CET 2019 +holdingCurrent=50.0 mountCurrent=20.0 remanenceCurrent=-10.0 -restingCurrent=20.0 +restingCurrent=30.0 reverseCurrent=-10.0 reverseTime=0.4 unmountCurrent=20.0 diff --git a/devices/smc_current.properties b/devices/smc_current.properties index aa71f58..9d9ba17 100644 --- a/devices/smc_current.properties +++ b/devices/smc_current.properties @@ -1,5 +1,5 @@ -#Tue Jun 19 16:41:20 CEST 2018 -maxValue=50.0 +#Wed Jan 30 11:33:15 CET 2019 +maxValue=70.0 minValue=-50.0 offset=0.0 precision=2 diff --git a/plugins/MXSC-1.10.0.jar b/plugins/MXSC-1.10.0.jar index 065c111..992d5bb 100644 Binary files a/plugins/MXSC-1.10.0.jar and b/plugins/MXSC-1.10.0.jar differ diff --git a/plugins/PuckDetectionPanel.form b/plugins/PuckDetectionPanel.form index 9d644a4..550d155 100644 --- a/plugins/PuckDetectionPanel.form +++ b/plugins/PuckDetectionPanel.form @@ -116,12 +116,19 @@ + + + + + - + + + @@ -173,6 +180,14 @@ + + + + + + + + diff --git a/plugins/PuckDetectionPanel.java b/plugins/PuckDetectionPanel.java index e36c4db..1326665 100644 --- a/plugins/PuckDetectionPanel.java +++ b/plugins/PuckDetectionPanel.java @@ -78,6 +78,7 @@ public class PuckDetectionPanel extends DevicePanel { jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); table = new javax.swing.JTable(); + buttonConfigure = new javax.swing.JButton(); deviceStatePanel1 = new ch.psi.pshell.swing.DeviceStatePanel(); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Raspberry Pi ")); @@ -186,6 +187,13 @@ public class PuckDetectionPanel extends DevicePanel { }); jScrollPane1.setViewportView(table); + buttonConfigure.setText("Configure"); + buttonConfigure.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonConfigureActionPerformed(evt); + } + }); + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( @@ -194,11 +202,17 @@ public class PuckDetectionPanel extends DevicePanel { .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addContainerGap()) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonConfigure) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 274, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 282, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(buttonConfigure) .addContainerGap()) ); @@ -236,9 +250,24 @@ public class PuckDetectionPanel extends DevicePanel { execute("start_puck_detection()", false); }//GEN-LAST:event_buttonPuckDetStartActionPerformed + private void buttonConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigureActionPerformed + try { + if (table.getSelectedRow()<0){ + throw new Exception("Select a puck"); + } + String name = table.getModel().getValueAt(table.getSelectedRow(), 0).toString(); + Puck puck = getDevice().getPuck(name); + DevicePanel.showConfigEditor(this, puck, true, false); + } catch (Exception ex) { + showException(ex); + } + + }//GEN-LAST:event_buttonConfigureActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton buttonConfigure; private javax.swing.JButton buttonPuckDetCheck; private javax.swing.JButton buttonPuckDetStart; private javax.swing.JButton buttonPuckDetStop; diff --git a/plugins/SmartMagnetPanel.form b/plugins/SmartMagnetPanel.form index f9de056..432e7bd 100644 --- a/plugins/SmartMagnetPanel.form +++ b/plugins/SmartMagnetPanel.form @@ -18,10 +18,9 @@ - - - - + + + @@ -33,6 +32,8 @@ + + @@ -171,7 +172,7 @@ - + @@ -183,7 +184,11 @@ - + + + + + @@ -194,7 +199,9 @@ - + + + @@ -205,16 +212,72 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/SmartMagnetPanel.java b/plugins/SmartMagnetPanel.java index 2108837..2bfd831 100644 --- a/plugins/SmartMagnetPanel.java +++ b/plugins/SmartMagnetPanel.java @@ -5,8 +5,12 @@ import ch.psi.pshell.swing.DevicePanel; import ch.psi.pshell.core.Context; import ch.psi.utils.State; import java.awt.Color; +import java.io.IOException; import java.lang.reflect.Method; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.script.ScriptException; /** * @@ -30,38 +34,37 @@ public class SmartMagnetPanel extends DevicePanel { this.startTimer(1000, 100); } - @Override - protected void onTimer(){ - Color color = Color.RED; - try{ - if (Context.getInstance().evalLineBackground("in_mount_position").equals(Boolean.TRUE)){ - color = Color.GREEN; - } - } catch (Exception ex){ - } - ledMountPosition.setColor(color); - } - @Override protected void onDeviceStateChanged(State state, State former) { switch(state){ + case Paused: + ledSupressed.setColor(Color.ORANGE); + ledStatus.setColor(Color.GREEN); + ledMounted.setColor(Color.RED); + break; case Ready: + ledSupressed.setColor(Color.BLACK); ledStatus.setColor(Color.GREEN); ledMounted.setColor(Color.GREEN); break; case Busy: + ledSupressed.setColor(Color.BLACK); ledStatus.setColor(Color.GREEN); ledMounted.setColor(Color.ORANGE); break; case Fault: + ledSupressed.setColor(Color.RED); ledStatus.setColor(Color.RED); ledMounted.setColor(Color.RED); break; default: + ledSupressed.setColor(Color.BLACK); ledStatus.setColor(Color.BLACK); ledMounted.setColor(Color.BLACK); break; } + buttonSupressOn.setEnabled((state==State.Ready) || (state == State.Busy)); + buttonSupressOff.setEnabled(state == State.Paused); } @Override @@ -89,7 +92,11 @@ public class SmartMagnetPanel extends DevicePanel { panelCurrent = new ch.psi.pshell.swing.ProcessVariablePanel(); jPanel2 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); - ledMountPosition = new ch.psi.pshell.swing.Led(); + ledSupressed = new ch.psi.pshell.swing.Led(); + buttonSupressOn = new javax.swing.JButton(); + buttonSupressOff = new javax.swing.JButton(); + jPanel3 = new javax.swing.JPanel(); + buttonConfiguration = new javax.swing.JButton(); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Status")); @@ -164,12 +171,26 @@ public class SmartMagnetPanel extends DevicePanel { panelCurrent.setBorder(javax.swing.BorderFactory.createTitledBorder("Current")); panelCurrent.setDeviceName("smc_current"); - jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Gonio")); + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Supress")); jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); - jLabel2.setText("Mount Position:"); + jLabel2.setText("Supressed:"); - ledMountPosition.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N + ledSupressed.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N + + buttonSupressOn.setText("On"); + buttonSupressOn.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonSupressOnActionPerformed(evt); + } + }); + + buttonSupressOff.setText("Off"); + buttonSupressOff.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonSupressOffActionPerformed(evt); + } + }); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); @@ -179,16 +200,51 @@ public class SmartMagnetPanel extends DevicePanel { .addContainerGap() .addComponent(jLabel2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ledMountPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ledSupressed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonSupressOn) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonSupressOff) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); + + jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonSupressOff, buttonSupressOn}); + jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(jLabel2) - .addComponent(ledMountPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(ledSupressed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(buttonSupressOn) + .addComponent(buttonSupressOff)) + .addContainerGap()) + ); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Configuration")); + + buttonConfiguration.setText("Configuration"); + buttonConfiguration.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonConfigurationActionPerformed(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(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonConfiguration) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addComponent(buttonConfiguration) .addContainerGap()) ); @@ -198,9 +254,9 @@ public class SmartMagnetPanel extends DevicePanel { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panelState, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(panelCurrent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(panelCurrent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -211,21 +267,51 @@ public class SmartMagnetPanel extends DevicePanel { .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) + .addGap(0, 0, 0) .addComponent(panelState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); }// //GEN-END:initComponents + private void buttonSupressOnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSupressOnActionPerformed + try { + Context.getInstance().evalLineBackground("smart_magnet.set_supress(True)"); + } catch (Exception ex) { + Logger.getLogger(SmartMagnetPanel.class.getName()).log(Level.SEVERE, null, ex); + } + }//GEN-LAST:event_buttonSupressOnActionPerformed + + private void buttonSupressOffActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSupressOffActionPerformed + try { + Context.getInstance().evalLineBackground("smart_magnet.set_supress(False)"); + } catch (Exception ex) { + Logger.getLogger(SmartMagnetPanel.class.getName()).log(Level.SEVERE, null, ex); + } + }//GEN-LAST:event_buttonSupressOffActionPerformed + + private void buttonConfigurationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigurationActionPerformed + try { + this.showConfigEditor(true, false); + } catch (Exception ex) { + Logger.getLogger(SmartMagnetPanel.class.getName()).log(Level.SEVERE, null, ex); + } + }//GEN-LAST:event_buttonConfigurationActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton buttonConfiguration; + private javax.swing.JButton buttonSupressOff; + private javax.swing.JButton buttonSupressOn; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel5; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; - private ch.psi.pshell.swing.Led ledMountPosition; + private javax.swing.JPanel jPanel3; private ch.psi.pshell.swing.Led ledMounted; private ch.psi.pshell.swing.Led ledStatus; + private ch.psi.pshell.swing.Led ledSupressed; private ch.psi.pshell.swing.ProcessVariablePanel panelCurrent; private ch.psi.pshell.swing.DeviceValuePanel panelCurrentRb; private javax.swing.JPanel panelPowerCtr; diff --git a/script/devices/Hexiposi.py b/script/devices/Hexiposi.py index 7c7c452..dbe248a 100644 --- a/script/devices/Hexiposi.py +++ b/script/devices/Hexiposi.py @@ -117,7 +117,7 @@ class Hexiposi(DiscretePositionerBase): self.update() def is_in_position(self, pos): - return take() == pos + return self.take() == pos def assert_in_position(self, pos): @@ -128,6 +128,10 @@ class Hexiposi(DiscretePositionerBase): if self.homed == False: raise Exception ("Hexiposi is not homed") + def assert_in_known_position(self): + self.get_status() + if self.rback == 'Unknown': + raise Exception("Hexiposi is in an unknown position, please home.") #def isReady(self): # self.get_status() diff --git a/script/devices/SmartMagnet.py b/script/devices/SmartMagnet.py index 29e70b7..8039798 100644 --- a/script/devices/SmartMagnet.py +++ b/script/devices/SmartMagnet.py @@ -31,8 +31,9 @@ class SmartMagnet(DeviceBase): return smc_magnet_status.read() def assert_status(self): - if self.get_status() == False: - raise Exception("Smart Magnet is in faulty status.") + pass + #if self.get_status() == False: + # raise Exception("Smart Magnet is in faulty status.") def is_mounted(self): self.assert_status() @@ -72,7 +73,9 @@ class SmartMagnet(DeviceBase): def doUpdate(self): try: - if self.is_mounted(): + if self.get_supress(): + self.setState(State.Paused) + elif self.is_mounted(): self.setState(State.Busy) else: self.setState(State.Ready) @@ -104,15 +107,18 @@ class SmartMagnet(DeviceBase): return self.get_current() == self.config.getFieldValue("restingCurrent") - #Setting resting current to better detect sample - def enforce_sample_detection(self): + def apply_reverse(self): reverse_wait = float(self.config.getFieldValue("reverseTime")) if reverse_wait >0: self.set_reverse_current() time.sleep(reverse_wait) + + #Setting resting current to better detect sample + def apply_resting(self): if not self.is_resting_current(): self.set_resting_current() - time.sleep(0.2) + + add_device(SmartMagnet("smart_magnet"), force = True) diff --git a/script/local.py b/script/local.py index 2110c3d..d709fad 100644 --- a/script/local.py +++ b/script/local.py @@ -149,6 +149,8 @@ def system_check(robot_move=True): raise Exception("Air pressure is not ok") if not n2_pressure_ok.read(): raise Exception("N2 pressure is not ok") + hexiposi.assert_in_known_position() + if robot_move: if not feedback_local_safety.read(): raise Exception("Local safety not released") @@ -165,9 +167,15 @@ def system_check_msg(): return "Ok" except: return sys.exc_info()[1] - + +def get_puck_dev(segment, puck): + if type(segment) is int: + segment = chr( ord('A') + (segment-1)) + + return Controller.getInstance().getPuck(str(segment).upper() + str(puck)) + def get_puck_elect_detection(segment, puck): - return str(Controller.getInstance().getPuck(str(segment).upper() + str(puck)).detection) + return str(get_puck_dev(segment, puck).detection) def get_puck_img_detection(segment, puck): return str(Controller.getInstance().getPuck(str(segment).upper() + str(puck)).imageDetection) @@ -198,6 +206,18 @@ def get_detected_pucks(): ret.append(str(p.getName())) return ret +def get_pucks_info(): + ret = [] + for i in range(30): + p = BasePlate.getPucks()[i] + name = p.getName() + det = str(p.getDetection()) + barcode = "" if p.getId() is None else p.getId() + + ret.append({"puckAddress": name, "puckState": det, "puckBarcode":barcode}) + return json.dumps(ret) + + ################################################################################################### # Device initialization ################################################################################################### @@ -253,6 +273,12 @@ if is_imaging_enabled(): except: print >> sys.stderr, traceback.format_exc() +#TODO: The Smart Magnet keeps moving sample if detecting is enabled +# Detection keeps disabled unless during moount/unmount +try: + smart_magnet.set_supress(True) +except: + print >> sys.stderr, traceback.format_exc() #gripper_cam.paused = True ################################################################################################### diff --git a/script/motion/homing_hexiposi.py b/script/motion/homing_hexiposi.py index 3b91519..5c99f9e 100644 --- a/script/motion/homing_hexiposi.py +++ b/script/motion/homing_hexiposi.py @@ -12,5 +12,7 @@ def homing_hexiposi(): set_status("Homing hexiposi") hexiposi.move_home() - hexiposi.waitState(State.Ready,-1) + hexiposi.waitState(State.Ready,-1) + hexiposi.move_pos(1) + \ No newline at end of file diff --git a/script/motion/mount.py b/script/motion/mount.py index 9ce9b2c..b49673f 100644 --- a/script/motion/mount.py +++ b/script/motion/mount.py @@ -7,13 +7,13 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) global mount_sample_id, mount_sample_detected print "mount: ", segment, puck, sample, force - start = time.time() - + start = time.time() + #time.sleep(2) is_aux = (segment == AUX_SEGMENT) #ZACH - #needs_chilling = not is_aux and (not robot.is_cold()) - #needs_drying = is_aux and robot.is_cold() + needs_chilling = not is_aux and (not robot.is_cold()) + needs_drying = is_aux and robot.is_cold() puck_address = get_puck_address(puck) if puck_address is None: @@ -47,17 +47,21 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) try: #ZACH - #if needs_chilling: - # robot.move_cold() - # time.sleep(30.0) + if needs_chilling: + robot.move_cold() + time.sleep(30.0) - smart_magnet.enforce_sample_detection() + if smart_magnet.get_supress() == True: + smart_magnet.set_supress(False) + time.sleep(0.2) + #To better dectect sample + smart_magnet.apply_resting() if smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) == True: if auto_unmount and (get_setting("mounted_sample_position") is not None): - unmount(force = True) + #auto_unmount set to true so detection remains enabled + unmount(force = True, auto_unmount = True) else: - raise Exception("Pin detected on gonio") - + raise Exception("Pin detected on gonio") set_status("Mounting: " + str(segment) + str(puck) + str(sample)) #location = robot.get_current_point() @@ -65,8 +69,9 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) enable_motion() #ZACH - #if needs_drying: - # dry(wait_cold=-1) + # a room temp pin is being mounted but the gripper is cold + if needs_drying: + dry(wait_cold=-1) # move to park after dry if is_aux: if not robot.is_aux(): @@ -85,9 +90,7 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) robot.get_dewar(segment, puck, sample) - - set_setting("mounted_sample_position", get_sample_name(segment, puck, sample)) - + if read_dm: barcode_reader.start_read(10.0) robot.move_scanner() @@ -100,12 +103,11 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) print "Datamatrix: " , mount_sample_id else: mount_sample_id = None - - smart_magnet.set_mount_current() + robot.put_gonio() - + try: dry_mount_count = int(get_setting("dry_mount_counter")) except: @@ -117,18 +119,21 @@ def mount(segment, puck, sample, force=False, read_dm=False, auto_unmount=False) else: robot.move_cold() - mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) - #TODO: Should do on finally? - update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id) - if mount_sample_detected == False: - raise Exception("No pin detected on gonio") + mount_sample_detected = smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) + update_samples_info_sample_mount(get_puck_name(segment, puck), sample, mount_sample_detected, mount_sample_id) + if mount_sample_detected == False: + raise Exception("No pin detected on gonio") + - if is_force_dry(): - smart_magnet.set_default_current() - print "Auto dry" - log("Starting auto dry", False) - dry() + if is_force_dry(): + smart_magnet.set_default_current() + print "Auto dry" + log("Starting auto dry", False) + set_exec_pars(then = "dry()") + + set_setting("mounted_sample_position", get_sample_name(segment, puck, sample)) return [mount_sample_detected, mount_sample_id] finally: smart_magnet.set_default_current() + smart_magnet.set_supress(True) diff --git a/script/motion/recover.py b/script/motion/recover.py index d372a46..06b628e 100644 --- a/script/motion/recover.py +++ b/script/motion/recover.py @@ -40,7 +40,7 @@ def get_dist_to_segment(segment): l = Line3D(v1, v2, 0.01) d = l.distance(v) - pj = get_pojection_at_line(segment) + pj = get_projection_at_line(segment) d1, d2 = v1.distance(v), v2.distance(v) dp1, dp2 = v1.distance(pj), v2.distance(pj) @@ -61,7 +61,7 @@ def is_on_segment(segment): #print "Current robot position " + str(p) + " on segment " + str(segment) + " - distance=" + str(d) return True -def get_pojection_at_line(segment): +def get_projection_at_line(segment): tolerance = segment[2] p1, p2 = robot.get_pnt(segment[0]), robot.get_pnt(segment[1]) p = get_robot_position() @@ -91,7 +91,7 @@ def move_to_segment(segment): tolerance = segment[2] p = get_robot_position() v = Vector3D(p[0], p[1], p[2]) - lv = get_pojection_at_line(segment) + lv = get_projection_at_line(segment) dlv = lv.distance(v) if dlv> (tolerance + 0.1): raise Exception( "Error moving from " + str(p) + " to segment - distance=" + str(dlv)) diff --git a/script/motion/tools.py b/script/motion/tools.py index efdd5f9..3cb76ef 100644 --- a/script/motion/tools.py +++ b/script/motion/tools.py @@ -140,6 +140,8 @@ def assert_valid_address(segment, puck, sample): raise Exception ("Invalid puck") if sample<=0 or sample >16: raise Exception ("Invalid sample") + if get_puck_dev(segment, puck).isDisabled(): + raise Exception ("Puck is disabled") def assert_valid_sample(sample): if sample<=0 or sample >16: diff --git a/script/motion/unmount.py b/script/motion/unmount.py index 495c2e5..45065d8 100644 --- a/script/motion/unmount.py +++ b/script/motion/unmount.py @@ -1,7 +1,12 @@ -def unmount(segment = None, puck = None, sample = None, force=False): +def unmount(segment = None, puck = None, sample = None, force=False, auto_unmount = False): """ """ - print "unmount: ", segment, puck, sample, force + print "unmount: ", segment, puck, sample, force + + #ZACH + is_aux = (segment == AUX_SEGMENT) + needs_chilling = not is_aux and (not robot.is_cold()) + needs_drying = is_aux and robot.is_cold() if (segment is None) or (puck is None) or (sample is None): pos = get_setting("mounted_sample_position") @@ -9,10 +14,11 @@ def unmount(segment = None, puck = None, sample = None, force=False): raise Exception("Mounted sample position is not defined") segment, puck , sample = pos[0:1], int(pos[1]), int(pos[2:]) print "Mounted sample position: ", segment, puck , sample - is_aux = (segment == AUX_SEGMENT) #Initial checks + print "assert valid address" assert_valid_address(segment, puck, sample) + print "asser puck detected" assert_puck_detected(segment, puck) if robot.simulated: @@ -20,23 +26,33 @@ def unmount(segment = None, puck = None, sample = None, force=False): update_samples_info_sample_unmount(get_puck_name(segment, puck), sample) set_setting("mounted_sample_position", None) return - + + print "assert no task" robot.assert_no_task() + print "reset motion" robot.reset_motion() + print "wait ready" robot.wait_ready() + print "assert cleared" robot.assert_cleared() #robot.assert_in_known_point() + print "assert homed" hexiposi.assert_homed() + print "assert mount pos" assert_mount_position() set_status("Umounting: " + str(segment) + str(puck) + str(sample)) try: - if not force: - smart_magnet.enforce_sample_detection() - if smart_magnet.check_mounted(idle_time=0.5, timeout = 3.0) == False: - raise Exception("No pin detected on gonio") + if smart_magnet.get_supress() == True: + smart_magnet.set_supress(False) + time.sleep(0.2) + + smart_magnet.apply_resting() + if not force: + if smart_magnet.check_mounted(idle_time=0.5, timeout = 3.0) == False: + raise Exception("No pin detected on gonio") #Enabling enable_motion() @@ -46,16 +62,24 @@ def unmount(segment = None, puck = None, sample = None, force=False): if not force: visual_check_hexiposi(segment) - + if needs_chilling: + robot.move_cold() + time.sleep(30.) + else: + if needs_drying: + dry(wait_cold=-1) #location = robot.get_current_point() if not robot.is_gonio(): robot.move_gonio() - smart_magnet.set_unmount_current() - + #smart_magnet.set_unmount_current() + robot.get_gonio() + #smart_magnet.apply_reverse() + #smart_magnet.apply_resting() + if is_aux: robot.move_aux() robot.put_aux( sample) @@ -66,5 +90,6 @@ def unmount(segment = None, puck = None, sample = None, force=False): robot.put_dewar(segment, puck, sample) set_setting("mounted_sample_position", None) finally: - smart_magnet.set_default_current() - + if not auto_unmount: + smart_magnet.set_default_current() + smart_magnet.set_supress(True) diff --git a/script/test/then.py b/script/test/then.py new file mode 100644 index 0000000..fcbe1bb --- /dev/null +++ b/script/test/then.py @@ -0,0 +1,3 @@ +time.sleep(3.0) + +set_exec_pars(then = "time.sleep(5.0)") \ No newline at end of file