diff --git a/devices/smart_magnet.properties b/devices/smart_magnet.properties index 5484332..12bff22 100644 --- a/devices/smart_magnet.properties +++ b/devices/smart_magnet.properties @@ -1,5 +1,5 @@ -#Wed Oct 03 14:07:43 CEST 2018 -holdingCurrent=50.0 +#Wed Oct 17 16:51:06 CEST 2018 +holdingCurrent=30.0 mountCurrent=10.0 remanenceCurrent=-10.0 restingCurrent=10.0 diff --git a/plugins/Commands.form b/plugins/Commands.form index 299aaee..70c71b4 100644 --- a/plugins/Commands.form +++ b/plugins/Commands.form @@ -16,193 +16,454 @@ - - - - - + - - - - - - - - - - - - + - - - - - - - - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -210,19 +471,9 @@ - - - - - - - - - - - - - + + + @@ -231,449 +482,321 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + - - - - - - - - - - - - - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/Commands.java b/plugins/Commands.java index cdb4482..f861b06 100644 --- a/plugins/Commands.java +++ b/plugins/Commands.java @@ -116,6 +116,8 @@ public class Commands extends Panel { // //GEN-BEGIN:initComponents private void initComponents() { + jTabbedPane1 = new javax.swing.JTabbedPane(); + tabCommands = new javax.swing.JPanel(); pnDry = new javax.swing.JPanel(); jLabel6 = new javax.swing.JLabel(); spinnerDryTime = new ch.psi.utils.swing.HorizontalSpinner(); @@ -140,6 +142,10 @@ public class Commands extends Panel { buttonScanPin = new javax.swing.JButton(); buttonScanPuck = new javax.swing.JButton(); checkAuxiliary = new javax.swing.JCheckBox(); + jPanel1 = new javax.swing.JPanel(); + buttonGripperScan = new javax.swing.JButton(); + buttonTrash = new javax.swing.JButton(); + tabAdvanced = new javax.swing.JPanel(); pnLowLevel = new javax.swing.JPanel(); buttonMovePark = new javax.swing.JButton(); buttonMoveCold = new javax.swing.JButton(); @@ -190,7 +196,7 @@ public class Commands extends Panel { .addGroup(pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(buttonDry, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ckeckParkOnDry)) - .addGap(18, 18, Short.MAX_VALUE) + .addGap(18, 25, Short.MAX_VALUE) .addGroup(pnDryLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel6) .addComponent(jLabel7)) @@ -373,6 +379,68 @@ public class Commands extends Panel { .addContainerGap()) ); + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Gripper")); + + buttonGripperScan.setText("Scan"); + buttonGripperScan.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonGripperScanActionPerformed(evt); + } + }); + + buttonTrash.setText("Trash"); + buttonTrash.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonTrashActionPerformed(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() + .addComponent(buttonGripperScan, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonTrash, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(buttonGripperScan) + .addComponent(buttonTrash)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout tabCommandsLayout = new javax.swing.GroupLayout(tabCommands); + tabCommands.setLayout(tabCommandsLayout); + tabCommandsLayout.setHorizontalGroup( + tabCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(tabCommandsLayout.createSequentialGroup() + .addGap(0, 0, 0) + .addGroup(tabCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(pnDry, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnTransfer, 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))) + ); + tabCommandsLayout.setVerticalGroup( + tabCommandsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(tabCommandsLayout.createSequentialGroup() + .addContainerGap() + .addComponent(pnDry, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, 0) + .addComponent(pnTransfer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + jTabbedPane1.addTab("Commands", tabCommands); + pnLowLevel.setBorder(javax.swing.BorderFactory.createTitledBorder("Low-level Motion Commands")); buttonMovePark.setText("Move Park"); @@ -487,7 +555,7 @@ public class Commands extends Panel { .addComponent(buttonGetGonio) .addComponent(buttonGetDewar, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(buttonGetAux, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 54, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE) .addGroup(pnLowLevelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(buttonPutDewar, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(buttonPutGonio, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -615,29 +683,41 @@ public class Commands extends Panel { .addContainerGap()) ); - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(pnDry, javax.swing.GroupLayout.PREFERRED_SIZE, 314, Short.MAX_VALUE) - .addComponent(pnMotion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnDatabase, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnLowLevel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pnTransfer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + javax.swing.GroupLayout tabAdvancedLayout = new javax.swing.GroupLayout(tabAdvanced); + tabAdvanced.setLayout(tabAdvancedLayout); + tabAdvancedLayout.setHorizontalGroup( + tabAdvancedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(tabAdvancedLayout.createSequentialGroup() + .addGap(0, 0, 0) + .addGroup(tabAdvancedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(pnMotion, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnDatabase, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pnLowLevel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(0, 0, 0)) ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(pnDry, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, 0) - .addComponent(pnTransfer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, 0) + tabAdvancedLayout.setVerticalGroup( + tabAdvancedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(tabAdvancedLayout.createSequentialGroup() + .addContainerGap() .addComponent(pnLowLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(pnDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(pnMotion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + + jTabbedPane1.addTab("Advanced", tabAdvanced); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); }// //GEN-END:initComponents @@ -770,6 +850,14 @@ public class Commands extends Panel { onStateChange(getState(), null); }//GEN-LAST:event_checkAuxiliaryActionPerformed + private void buttonGripperScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonGripperScanActionPerformed + execute("scan_gripper()"); + }//GEN-LAST:event_buttonGripperScanActionPerformed + + private void buttonTrashActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonTrashActionPerformed + execute("trash()"); + }//GEN-LAST:event_buttonTrashActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton buttonClearSampleDb; private javax.swing.JButton buttonDry; @@ -777,6 +865,7 @@ public class Commands extends Panel { private javax.swing.JButton buttonGetAux; private javax.swing.JButton buttonGetDewar; private javax.swing.JButton buttonGetGonio; + private javax.swing.JButton buttonGripperScan; private javax.swing.JButton buttonMount; private javax.swing.JButton buttonMoveAux; private javax.swing.JButton buttonMoveCold; @@ -793,6 +882,7 @@ public class Commands extends Panel { private javax.swing.JButton buttonResetPuckIds; private javax.swing.JButton buttonScanPin; private javax.swing.JButton buttonScanPuck; + private javax.swing.JButton buttonTrash; private javax.swing.JButton buttonUnmount; private javax.swing.JCheckBox checkAuxiliary; private javax.swing.JCheckBox checkDatamatrix; @@ -805,7 +895,9 @@ public class Commands extends Panel { private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; + private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel5; + private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JPanel pnDatabase; private javax.swing.JPanel pnDry; private javax.swing.JPanel pnLowLevel; @@ -816,5 +908,7 @@ public class Commands extends Panel { private javax.swing.JSpinner spinnerPuck; private javax.swing.JSpinner spinnerSample; private javax.swing.JSpinner spinnerSegment; + private javax.swing.JPanel tabAdvanced; + private javax.swing.JPanel tabCommands; // End of variables declaration//GEN-END:variables } diff --git a/script/devices/RobotSC.py b/script/devices/RobotSC.py index 1ec04f6..af57b8b 100644 --- a/script/devices/RobotSC.py +++ b/script/devices/RobotSC.py @@ -129,6 +129,18 @@ class RobotSC(RobotTCP): self.wait_task_finished(TASK_WAIT_ROBOT_POLLING) self.assert_aux() + def get_calibration_tool(self): + self.start_task('getCalTool') + self.wait_task_finished(TASK_WAIT_ROBOT_POLLING) + self.assert_scanner() + + def put_calibration_tool(self): + self.start_task('putCalTool') + self.wait_task_finished(TASK_WAIT_ROBOT_POLLING) + self.assert_scanner() + + + def toSegmentNumber(self, segment): if is_string(segment): segment = ord(segment.upper()) - ord('A') +1 diff --git a/script/devices/Wago.py b/script/devices/Wago.py index b176d5c..1ce7931 100644 --- a/script/devices/Wago.py +++ b/script/devices/Wago.py @@ -136,16 +136,6 @@ def set_air_stream(state): set_heater_chrono = None def monitor_heater_time(): - """ - """ - return valve_1.read() - - -def get_heater(): - """ - """ - return gripper_dryer.read() - time.sleep(0.5) try: while get_heater(): @@ -157,6 +147,13 @@ def get_heater(): except: print sys.exc_info() + +def get_heater(): + """ + """ + return gripper_dryer.read() + + def set_heater(state): """ """ diff --git a/script/local.py b/script/local.py index 2af1d40..dd0d54d 100644 --- a/script/local.py +++ b/script/local.py @@ -99,6 +99,7 @@ run("motion/put_aux") run("motion/dry") run("motion/trash") run("motion/homing_hexiposi") +run("motion/calibrate_tool") run("motion/scan_pin") run("motion/robot_recover") run("motion/recover") @@ -200,9 +201,6 @@ except: #gripper_cam.paused = True - - - ################################################################################################### # Device monitoring ################################################################################################### @@ -228,9 +226,17 @@ for l in dewar_level.listeners: dewar_level.addListener(dewar_level_listener) dewar_level_listener.onValueChanged(dewar_level, dewar_level.take(), None) - + + +class HexiposiListener (DeviceListener): + def onValueChanging(self, device, value, former): + robot.assert_cleared() + +hexiposi_listener = HexiposiListener() +hexiposi.addListener(hexiposi_listener) + ################################################################################################### # Global variables & application state ################################################################################################### diff --git a/script/motion/calibrate_tool.py b/script/motion/calibrate_tool.py index 9e47630..5303b87 100644 --- a/script/motion/calibrate_tool.py +++ b/script/motion/calibrate_tool.py @@ -12,7 +12,21 @@ def calibrate_tool(): #Enabling enable_motion() + + (detected, dm) = move_scanner() + + if detected: + print "Pin detected, trashing..." + trash() + (detected, dm) = move_scanner() + if detected: + raise Exception("Cannot trash pin") - if not robot.is_gonio(): - robot.move_gonio() - robot.put_gonio() + robot.open_tool() + robot.get_calibration_tool() + + run("calibration/ToolCalibration3") + + robot.put_calibration_tool() + + #robot.save_program() diff --git a/script/motion/dry.py b/script/motion/dry.py index 1f606ee..d3d97d3 100644 --- a/script/motion/dry.py +++ b/script/motion/dry.py @@ -1,6 +1,6 @@ -def dry(heat_time=30.0, speed=0.4, wait_cold = 30.0): +def dry(heat_time=30.0, speed=0.5, wait_cold = 30.0): """ heat_time (float): in seconds speed (float): % of nominal speed diff --git a/script/motion/scan_pin.py b/script/motion/scan_pin.py index 9355466..032f0ca 100644 --- a/script/motion/scan_pin.py +++ b/script/motion/scan_pin.py @@ -59,3 +59,32 @@ def scan_puck(segment, puck, force=False): for i in range(16): ret.append(scan_pin (segment, puck, i+1, force)) return ret + + +def scan_gripper(): + print "scan gripper" + #Initial checks + + robot.assert_no_task() + robot.reset_motion() + robot.wait_ready() + robot.assert_cleared() + #robot.assert_in_known_point() + + #Enabling + + set_status("Scanning gripper") + + enable_motion() + + (detected, dm) = move_scanner() + + robot.move_home() + + ret = "Empty" + if detected: + if (dm is None) or (len(dm.strip())==0): + ret = "Present" + else: + ret = str(dm) + return ret diff --git a/script/motion/tools.py b/script/motion/tools.py index b45f5ae..efdd5f9 100644 --- a/script/motion/tools.py +++ b/script/motion/tools.py @@ -45,6 +45,7 @@ def set_hexiposi(pos, force = False): """ Set the hexiposi position in remote mode, or wait for it to be set in manual mode """ + robot.assert_cleared() if force == False: if hexiposi.position == pos: return diff --git a/script/motion/trash.py b/script/motion/trash.py index d9c229d..96eee28 100644 --- a/script/motion/trash.py +++ b/script/motion/trash.py @@ -15,12 +15,17 @@ def trash(): robot.move_heater(to_bottom = False) robot.move_heater(to_bottom = True) - - for i in range(3): + + try: + for i in range(3): + robot.open_tool() + time.sleep(0.5) + robot.close_tool() + time.sleep(0.5) + finally: robot.open_tool() - time.sleep(1.0) - robot.close_tool() - + + robot.move_heater(to_bottom = False) robot.move_home()