diff --git a/config/plugins.properties b/config/plugins.properties index e9e96d2..864a15d 100644 --- a/config/plugins.properties +++ b/config/plugins.properties @@ -1,4 +1,4 @@ -Expert.java=enabled +Expert.java=disabled MXSC-1.9.0.jar=enabled RobotPanel.java=enabled Wayne.java=disabled diff --git a/devices/dewar_level.properties b/devices/dewar_level.properties index dd9a525..098b613 100644 --- a/devices/dewar_level.properties +++ b/devices/dewar_level.properties @@ -1,4 +1,4 @@ -#Thu Mar 01 16:16:41 CET 2018 +#Mon Apr 23 09:19:43 CEST 2018 offset=-25.81632 precision=2 scale=0.003888 diff --git a/devices/led_level.properties b/devices/led_level.properties new file mode 100644 index 0000000..a187950 --- /dev/null +++ b/devices/led_level.properties @@ -0,0 +1,8 @@ +#Mon Apr 23 08:19:24 CEST 2018 +maxValue=NaN +minValue=NaN +offset=0.0 +precision=-1 +resolution=NaN +scale=1.0 +unit=null diff --git a/plugins/MXSC-1.9.0.jar b/plugins/MXSC-1.9.0.jar index e128542..aa965bb 100644 Binary files a/plugins/MXSC-1.9.0.jar and b/plugins/MXSC-1.9.0.jar differ diff --git a/plugins/NewJPanel.form b/plugins/NewJPanel.form new file mode 100644 index 0000000..538bd90 --- /dev/null +++ b/plugins/NewJPanel.form @@ -0,0 +1,142 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plugins/NewJPanel.java b/plugins/NewJPanel.java new file mode 100644 index 0000000..2a646e1 --- /dev/null +++ b/plugins/NewJPanel.java @@ -0,0 +1,221 @@ + +import ch.psi.pshell.device.Device; +import ch.psi.pshell.device.DeviceAdapter; +import ch.psi.utils.State; +import java.awt.Color; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author gac-S_Changer + */ +public class NewJPanel extends javax.swing.JPanel { + + /** + * Creates new form NewJPanel + */ + public NewJPanel() { + initComponents(); + + + ((Device) getDevice("hexiposi")).addListener(new DeviceAdapter() { + @Override + public void onStateChanged(Device device, State state, State former) { + updateHexiposiState(state); + } + }); + updateHexiposiState(((Device) getDevice("hexiposi")).getState()); + + ((Device) getDevice("air_pressure_ok")).addListener(new DeviceAdapter() { + @Override + public void onValueChanged(Device device, Object value, Object former) { + updateAirPressure(value); + } + }); + updateAirPressure(((Device) getDevice("air_pressure_ok")).take()); + + ((Device) getDevice("n2_pressure_ok")).addListener(new DeviceAdapter() { + @Override + public void onValueChanged(Device device, Object value, Object former) { + updateN2Pressure(value); + } + }); + updateN2Pressure(((Device) getDevice("n2_pressure_ok")).take()); + + ((Device) getDevice("feedback_local_safety")).addListener(new DeviceAdapter() { + @Override + public void onValueChanged(Device device, Object value, Object former) { + updateLocalSafety(value); + } + }); + updateLocalSafety(((Device) getDevice("feedback_local_safety")).take()); + + ((Device) getDevice("feedback_psys_safety")).addListener(new DeviceAdapter() { + @Override + public void onValueChanged(Device device, Object value, Object former) { + updatePsysSafety(value); + } + }); + updatePsysSafety(((Device) getDevice("feedback_psys_safety")).take()); + } + + void updateHexiposiState(State state){ + ledLidControlActive.setColor(state.isInitialized() ? Color.GREEN : Color.BLACK ); + ledLidInitialized.setColor((state.isNormal()&& state !=State.Disabled) ? Color.GREEN : Color.BLACK); + } + + void updateAirPressure(Object value){ + if ((value == null) || !(value instanceof Boolean)){ + ledAirPressure.setColor(Color.BLACK); + } else if ((Boolean)value){ + ledAirPressure.setColor(Color.GREEN); + } else { + ledAirPressure.setColor(Color.RED); + } + } + + void updateN2Pressure(Object value){ + if ((value == null) || !(value instanceof Boolean)){ + ledN2Pressure.setColor(Color.BLACK); + } else if ((Boolean)value){ + ledN2Pressure.setColor(Color.GREEN); + } else { + ledN2Pressure.setColor(Color.RED); + } + } + + void updateLocalSafety(Object value){ + if ((value == null) || !(value instanceof Boolean)){ + ledLocalSafety.setColor(Color.BLACK); + } else if ((Boolean)value){ + ledLocalSafety.setColor(Color.GREEN); + } else { + ledLocalSafety.setColor(Color.RED); + } + } + + void updatePsysSafety(Object value){ + if ((value == null) || !(value instanceof Boolean)){ + ledPsysSafety.setColor(Color.BLACK); + } else if ((Boolean)value){ + ledPsysSafety.setColor(Color.GREEN); + } else { + ledPsysSafety.setColor(Color.RED); + } + } + + /** + * 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") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jPanel11 = new javax.swing.JPanel(); + ledAirPressure = new ch.psi.pshell.swing.Led(); + jLabel15 = new javax.swing.JLabel(); + jLabel16 = new javax.swing.JLabel(); + ledN2Pressure = new ch.psi.pshell.swing.Led(); + jLabel19 = new javax.swing.JLabel(); + ledLocalSafety = new ch.psi.pshell.swing.Led(); + jLabell20 = new javax.swing.JLabel(); + ledPsysSafety = new ch.psi.pshell.swing.Led(); + + jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("System Status")); + + jLabel15.setText("Air Pressure"); + + jLabel16.setText("N2 Pressure"); + + jLabel19.setText("Local Safety"); + + jLabell20.setText("Psys Safety"); + + javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11); + jPanel11.setLayout(jPanel11Layout); + jPanel11Layout.setHorizontalGroup( + jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel11Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel11Layout.createSequentialGroup() + .addComponent(ledAirPressure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel15)) + .addGroup(jPanel11Layout.createSequentialGroup() + .addComponent(ledN2Pressure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel16)) + .addGroup(jPanel11Layout.createSequentialGroup() + .addComponent(ledLocalSafety, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel19)) + .addGroup(jPanel11Layout.createSequentialGroup() + .addComponent(ledPsysSafety, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabell20))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel11Layout.setVerticalGroup( + jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel11Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ledAirPressure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel15)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ledN2Pressure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel16)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ledLocalSafety, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel19)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ledPsysSafety, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabell20))) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 400, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(142, 142, 142) + .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(143, 143, 143))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(84, 84, 84) + .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(84, 84, 84))) + ); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel15; + private javax.swing.JLabel jLabel16; + private javax.swing.JLabel jLabel19; + private javax.swing.JLabel jLabell20; + private javax.swing.JPanel jPanel11; + private ch.psi.pshell.swing.Led ledAirPressure; + private ch.psi.pshell.swing.Led ledLocalSafety; + private ch.psi.pshell.swing.Led ledN2Pressure; + private ch.psi.pshell.swing.Led ledPsysSafety; + // End of variables declaration//GEN-END:variables +} diff --git a/script/calibration/ScanRZ.py b/script/calibration/ScanRZ.py index 9cd8de8..ac10b5a 100644 --- a/script/calibration/ScanRZ.py +++ b/script/calibration/ScanRZ.py @@ -1,26 +1,31 @@ +#Imports import plotutils from mathutils import fit_gaussian, Gaussian -RANGE = [180.0,-180.0] +#Parameters +RANGE = [-120.0,120.0] STEP = 5.0 LATENCY = 0.005 RELATIVE = False - -robot.set_tool(TOOL_DEFAULT) - +#Enabling and checking +#enable_power() +#system_check() robot.enable() + + +#Body +robot.set_tool(TOOL_DEFAULT) move_to_laser() - - - - - - - -robot.set_joint_motors_enabled(True) +#robot.set_joint_motors_enabled(True) +robot.set_motors_enabled(True) +robot_rz.move(0.0) +robot.set_motors_enabled(True) ret = lscan(robot_rz, ue.readable, RANGE[0], RANGE[1], STEP, latency = LATENCY, relative = RELATIVE, range = "auto", title = "Scan2") +#Cleanup + + diff --git a/script/calibration/ScanY.py b/script/calibration/ScanY.py index 7e25fc9..8793019 100644 --- a/script/calibration/ScanY.py +++ b/script/calibration/ScanY.py @@ -9,7 +9,7 @@ if d<0: if d>20: raise Exception ("Should be near the laser position to perform the scan") -RANGE = [-1.5, 1.5] +RANGE = [-2.0, 2.0] #[-1.5, 1.5] STEP = 0.02 Z_OFFSET = 0 #-1.0 LATENCY = 0.025 diff --git a/script/calibration/ToolCalibration2.py b/script/calibration/ToolCalibration2.py index d146173..b90289e 100644 --- a/script/calibration/ToolCalibration2.py +++ b/script/calibration/ToolCalibration2.py @@ -2,13 +2,17 @@ import plotutils from mathutils import fit_gaussian, Gaussian -robot.assert_tool(TOOL_CALIBRATION) +#robot.assert_tool(TOOL_CALIBRATION) +#cal_tool = TOOL_DEFAULT +cal_tool = TOOL_CALIBRATION + +robot.set_tool(cal_tool) robot.enable() -robot.set_motors_enabled(True) -robot.set_joint_motors_enabled(True) move_to_laser() +robot.set_motors_enabled(True) +robot.set_joint_motors_enabled(True) initial_pos = robot.get_cartesian_pos() robot.enable() @@ -52,7 +56,7 @@ robot.set_pnt(robot.get_cartesian_pos(), "pTemp") robot.set_trsf([off_x, 0,0,0,0,0]) c=robot.compose("pTemp", "fTable", "tcp_t" ) robot.set_pnt(c, "pTemp") -robot.movel("pTemp", TOOL_CALIBRATION, DESC_SCAN, sync=True) +robot.movel("pTemp", cal_tool, DESC_SCAN, sync=True) pos2 = robot.get_cartesian_pos() @@ -66,10 +70,17 @@ print "Position 2: ", pos2 xoff = (pos2[0]-pos1[0])/2 yoff = (pos2[1]-pos1[1])/2 -print "Offset: ", [xoff, yoff] +#print "Offset: ", [xoff, yoff] t=robot.get_tool_trsf(TOOL_DEFAULT) -t[0]=-xoff -t[1]=yoff +t[0]=xoff +t[1]=-yoff +print "Offset: ", [t[0], t[1]] robot.set_tool_trsf(t, TOOL_DEFAULT) +robot.set_tool(TOOL_DEFAULT) +d = robot.get_distance_to_pnt("pLaser") +if d