This commit is contained in:
gac-S_Changer
2018-06-22 11:09:37 +02:00
parent da06e0af71
commit 51858eb819
32 changed files with 621 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
img=ch.psi.pshell.prosilica.Prosilica|25001 "PacketSize=1522;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=300;RegionY=200;Width=1000;Height=1000"|||false
gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://129.129.110.114/axis-cgi/mjpg/video.cgi||100|
microscan=ch.psi.pshell.serial.TcpDevice|129.129.100.200:2001|||
microscan_cmd=ch.psi.pshell.serial.TcpDevice|129.129.100.200:2003|||
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
#robot=RobotTcp|127.0.0.1:1000|||
#onewire=ch.psi.pshell.serial.TcpDevice|129.129.126.83:5000|||
@@ -32,8 +32,15 @@ dewar_level_high_alarm=ch.psi.pshell.modbus.DigitalInput|wago 7||1000|
guiding_tool_park=ch.psi.pshell.modbus.DigitalInput|wago 8||1000|
air_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 9||1000|false
n2_pressure_ok=ch.psi.pshell.modbus.DigitalInput|wago 10||1000|
#spare_di_1=ch.psi.pshell.modbus.DigitalInput|wago 11|||
#spare_di_2=ch.psi.pshell.modbus.DigitalInput|wago 12|||
#spare_di_3=ch.psi.pshell.modbus.DigitalInput|wago 13|||
#spare_di_4=ch.psi.pshell.modbus.DigitalInput|wago 14|||
he_chamber_valve_1=ch.psi.pshell.modbus.DigitalInput|wago 15||1000|
he_chamber_valve_2=ch.psi.pshell.modbus.DigitalInput|wago 16||1000|
smc_magnet_status=ch.psi.pshell.modbus.DigitalInput|wago 17||1000|
smc_mounted_1=ch.psi.pshell.modbus.DigitalInput|wago 18||1000|
smc_mounted_2=ch.psi.pshell.modbus.DigitalInput|wago 19||1000|
relays=ch.psi.pshell.modbus.DigitalOutputArray|wago 0 16||1000|
release_local_safety=ch.psi.pshell.modbus.DigitalOutput|wago 0|||
release_psys_safety=ch.psi.pshell.modbus.DigitalOutput|wago 1|||
@@ -48,20 +55,20 @@ valve_2=ch.psi.pshell.modbus.DigitalOutput|wago 9|||
valve_3=ch.psi.pshell.modbus.DigitalOutput|wago 10|||
valve_4=ch.psi.pshell.modbus.DigitalOutput|wago 11|||
#spare_do_1=ch.psi.pshell.modbus.DigitalOutput|wago 12|||
#spare_do_2=ch.psi.pshell.modbus.DigitalOutput|wago 13|||
smc_sup_det=ch.psi.pshell.modbus.DigitalOutput|wago 13|||
#spare_do_3=ch.psi.pshell.modbus.DigitalOutput|wago 14|||
#spare_do_4=ch.psi.pshell.modbus.DigitalOutput|wago 15|||
phase_separator_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 0||10000|
dewar_level=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 1||10000|
rim_heater_temp=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 2||10000|
air_pressure=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 3||10000|
n2_pressure=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 4||10000|
#spare_ai_1=ch.psi.pshell.modbus.AnalogInput|wago 5|||
#spare_ai_2=ch.psi.pshell.modbus.AnalogInput|wago 6|||
#spare_ai_3=ch.psi.pshell.modbus.AnalogInput|wago 7|||
#spare_ai_1=ch.psi.pshell.modbus.AnalogInput|wago 3|||true
smc_current_rb=ch.psi.pshell.modbus.ReadonlyProcessVariable|wago 4||1000|
#spare_ai_3=ch.psi.pshell.modbus.AnalogInput|wago 5|||
#spare_ai_4=ch.psi.pshell.modbus.AnalogInput|wago 6|||
#spare_ai_5=ch.psi.pshell.modbus.AnalogInput|wago 7|||
led_ctrl_1=ch.psi.pshell.modbus.ProcessVariable|wago 0|||
led_ctrl_2=ch.psi.pshell.modbus.ProcessVariable|wago 1|||
led_ctrl_3=ch.psi.pshell.modbus.ProcessVariable|wago 2|||
#spare_ao_3=ch.psi.pshell.modbus.AnalogOutput|wago 3|||
smc_current=ch.psi.pshell.modbus.ProcessVariable|wago 3|||
#cam=ch.psi.pshell.epics.AreaDetector|MX-SAMCAM|||
#img_back=ch.psi.pshell.imaging.CameraSource|cam||-100|

View File

@@ -5,6 +5,8 @@ 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

View File

@@ -1,5 +1,6 @@
#Mon Apr 23 09:19:43 CEST 2018
#Tue Jun 19 16:41:20 CEST 2018
offset=-25.81632
precision=2
scale=0.003888
sign_bit=0
unit=%

View File

@@ -1,8 +1,9 @@
#Thu Jun 14 15:23:57 CEST 2018
maxValue=1.0
#Tue Jun 19 16:41:20 CEST 2018
maxValue=0.4
minValue=0.0
offset=0.0
precision=2
resolution=NaN
scale=3.0E-4
sign_bit=0
unit=V

View File

@@ -1,8 +1,9 @@
#Thu Jun 14 15:23:57 CEST 2018
maxValue=1.0
#Tue Jun 19 16:41:20 CEST 2018
maxValue=0.4
minValue=0.0
offset=0.0
precision=2
resolution=NaN
scale=3.0E-4
sign_bit=0
unit=V

View File

@@ -1,8 +1,9 @@
#Thu Jun 14 15:23:57 CEST 2018
maxValue=1.0
#Tue Jun 19 16:41:20 CEST 2018
maxValue=0.4
minValue=0.0
offset=0.0
precision=2
resolution=NaN
scale=3.0E-4
sign_bit=0
unit=V

View File

@@ -1,8 +1,9 @@
#Mon Apr 23 08:19:24 CEST 2018
#Tue Jun 19 16:41:24 CEST 2018
maxValue=NaN
minValue=NaN
offset=0.0
precision=-1
resolution=NaN
scale=1.0
sign_bit=0
unit=null

View File

@@ -1,5 +1,6 @@
#Thu Mar 01 15:21:07 CET 2018
#Tue Jun 19 16:41:20 CEST 2018
offset=-25.81632
precision=2
scale=0.003888
sign_bit=0
unit=%

View File

@@ -1,5 +1,6 @@
#Thu Mar 01 15:51:40 CET 2018
#Tue Jun 19 16:41:20 CEST 2018
offset=-25.81632
precision=2
scale=0.003888
sign_bit=0
unit=C

View File

@@ -1,4 +1,4 @@
#Tue Nov 28 17:23:41 CET 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=180.0
minValue=-180.0
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -1,4 +1,4 @@
#Tue Nov 28 17:23:45 CET 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=127.5
minValue=-127.5
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -1,4 +1,4 @@
#Tue Nov 28 17:23:40 CET 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=152.5
minValue=-152.5
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -1,4 +1,4 @@
#Tue Nov 28 17:23:44 CET 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=270.0
minValue=-270.0
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -1,4 +1,4 @@
#Tue Nov 28 17:23:42 CET 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=132.5
minValue=-122.5
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -1,4 +1,4 @@
#Tue Nov 28 17:23:43 CET 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=270.0
minValue=-270.0
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.1
rotation=false
scale=1.0
sign_bit=0
unit=deg

View File

@@ -1,4 +1,4 @@
#Thu Nov 23 17:23:52 CET 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=180.0
minValue=-180.0
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.05
rotation=true
scale=1.0
sign_bit=0
unit=deg

View File

@@ -1,4 +1,4 @@
#Thu Nov 23 17:23:32 CET 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=180.0
minValue=-180.0
offset=0.0
@@ -6,4 +6,5 @@ precision=-2
resolution=0.05
rotation=true
scale=1.0
sign_bit=0
unit=deg

View File

@@ -1,4 +1,4 @@
#Tue Nov 28 16:56:22 CET 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=360.0
minValue=-360.0
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.1
rotation=true
scale=1.0
sign_bit=0
unit=deg

View File

@@ -1,4 +1,4 @@
#Tue Sep 12 15:07:33 CEST 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=1000.0
minValue=-1000.0
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.05
rotation=false
scale=1.0
sign_bit=0
unit=mm

View File

@@ -1,4 +1,4 @@
#Tue Sep 12 15:07:33 CEST 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=1000.0
minValue=-1000.0
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.05
rotation=false
scale=1.0
sign_bit=0
unit=null

View File

@@ -1,4 +1,4 @@
#Tue Sep 12 15:07:32 CEST 2017
#Tue Jun 19 16:41:28 CEST 2018
maxValue=1000.0
minValue=-1000.0
offset=0.0
@@ -6,4 +6,5 @@ precision=2
resolution=0.05
rotation=false
scale=1.0
sign_bit=0
unit=null

View File

@@ -0,0 +1,6 @@
#Fri Jun 22 11:07:01 CEST 2018
holdingCurrent=10.0
mountCurrent=35.0
remanenceCurrent=-10.0
restingCurrent=5.0
unmountCurrent=2.5

View File

@@ -0,0 +1,9 @@
#Tue Jun 19 16:41:20 CEST 2018
maxValue=50.0
minValue=-50.0
offset=0.0
precision=2
resolution=NaN
scale=0.003
sign_bit=0
unit=mA

View File

@@ -0,0 +1,6 @@
#Tue Jun 19 16:45:06 CEST 2018
offset=0.0
precision=2
scale=0.003
sign_bit=15
unit=mA

View File

@@ -0,0 +1,14 @@
import ch.psi.pshell.device.DeviceConfig;
/**
*
*/
public class SmartMagnetConfig extends DeviceConfig{
public double holdingCurrent;
public double restingCurrent;
public double mountCurrent;
public double unmountCurrent;
public double remanenceCurrent;
}

View File

@@ -0,0 +1,169 @@
<?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="jPanel1" max="32767" attributes="0"/>
<Component id="panelState" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="panelCurrent" min="-2" max="-2" attributes="0"/>
<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" alignment="0" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
<Component id="panelCurrent" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="panelState" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<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="Status"/>
</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" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledStatus" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelPowerCtr" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel5" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="ledMounted" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel10" min="-2" pref="52" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="panelCurrentRb" min="-2" pref="173" max="-2" attributes="0"/>
</Group>
</Group>
<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="jLabel1" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledStatus" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="panelPowerCtr" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel5" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="ledMounted" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
<Component id="panelCurrentRb" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="ch.psi.pshell.swing.Led" name="ledStatus">
<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="jLabel1">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Status:"/>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="panelPowerCtr">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="150" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="23" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Mounted:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.Led" name="ledMounted">
<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="jLabel10">
<Properties>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" value="Current:"/>
</Properties>
</Component>
<Component class="ch.psi.pshell.swing.DeviceValuePanel" name="panelCurrentRb">
<Properties>
<Property name="deviceName" type="java.lang.String" value="smc_current_rb"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="ch.psi.pshell.swing.DeviceStatePanel" name="panelState">
</Component>
<Component class="ch.psi.pshell.swing.ProcessVariablePanel" name="panelCurrent">
<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="Current"/>
</Border>
</Property>
<Property name="deviceName" type="java.lang.String" value="smc_current"/>
</Properties>
</Component>
</SubComponents>
</Form>

View File

@@ -0,0 +1,185 @@
import ch.psi.pshell.device.Device;
import ch.psi.pshell.ui.App;
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;
/**
*
*/
public class SmartMagnetPanel extends DevicePanel {
/**
* Creates new form RobotPanel
*/
public SmartMagnetPanel() {
initComponents();
}
@Override
public void setDevice(Device device) {
super.setDevice(device);
if (device == null) {
}
panelState.setDevice(device);
}
@Override
protected void onDeviceStateChanged(State state, State former) {
switch(state){
case Ready:
ledStatus.setColor(Color.GREEN);
ledMounted.setColor(Color.BLACK);
break;
case Busy:
ledStatus.setColor(Color.GREEN);
ledMounted.setColor(Color.GREEN);
break;
case Fault:
ledStatus.setColor(Color.RED);
ledMounted.setColor(Color.RED);
break;
default:
ledStatus.setColor(Color.BLACK);
ledMounted.setColor(Color.BLACK);
break;
}
}
@Override
protected void onDeviceCacheChanged(Object value, Object former, long timestamp, boolean valueChange) {
}
/**
* 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() {
jPanel1 = new javax.swing.JPanel();
ledStatus = new ch.psi.pshell.swing.Led();
jLabel1 = new javax.swing.JLabel();
panelPowerCtr = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
ledMounted = new ch.psi.pshell.swing.Led();
jLabel10 = new javax.swing.JLabel();
panelCurrentRb = new ch.psi.pshell.swing.DeviceValuePanel();
panelState = new ch.psi.pshell.swing.DeviceStatePanel();
panelCurrent = new ch.psi.pshell.swing.ProcessVariablePanel();
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Status"));
ledStatus.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel1.setText("Status:");
javax.swing.GroupLayout panelPowerCtrLayout = new javax.swing.GroupLayout(panelPowerCtr);
panelPowerCtr.setLayout(panelPowerCtrLayout);
panelPowerCtrLayout.setHorizontalGroup(
panelPowerCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 150, Short.MAX_VALUE)
);
panelPowerCtrLayout.setVerticalGroup(
panelPowerCtrLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 23, Short.MAX_VALUE)
);
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel5.setText("Mounted:");
ledMounted.setFont(new java.awt.Font("SansSerif", 0, 18)); // NOI18N
jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
jLabel10.setText("Current:");
panelCurrentRb.setDeviceName("smc_current_rb");
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()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelPowerCtr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ledMounted, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelCurrentRb, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel1)
.addComponent(ledStatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(panelPowerCtr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel5)
.addComponent(ledMounted, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10)
.addComponent(panelCurrentRb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
panelCurrent.setBorder(javax.swing.BorderFactory.createTitledBorder("Current"));
panelCurrent.setDeviceName("smc_current");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
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.createSequentialGroup()
.addComponent(panelCurrent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.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)
.addGap(5, 5, 5)
.addComponent(panelCurrent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(panelState, 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 javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
private ch.psi.pshell.swing.Led ledMounted;
private ch.psi.pshell.swing.Led ledStatus;
private ch.psi.pshell.swing.ProcessVariablePanel panelCurrent;
private ch.psi.pshell.swing.DeviceValuePanel panelCurrentRb;
private javax.swing.JPanel panelPowerCtr;
private ch.psi.pshell.swing.DeviceStatePanel panelState;
// End of variables declaration//GEN-END:variables
}

View File

@@ -1,11 +1,48 @@
def enable_barcode_reader():
microscan_cmd.write("<H>")
def disable_barcode_reader():
microscan_cmd.write("<I>")
def read_barcode(timeout):
try:
return microscan.waitString(int(timeout * 1000))
except:
return None
class BarcodeReader(DeviceBase):
def doInitialize(self):
self.disable()
def enable(self):
microscan_cmd.write("<H>")
self.setState(State.Ready)
def disable(self):
microscan_cmd.write("<I>")
self.setState(State.Disabled)
def get(self,timeout=1.0):
self.state.assertReady()
try:
self.setState(State.Busy)
ret = microscan.waitString(int(timeout * 1000))
self.setCache(ret, None)
return ret
except:
self.setCache(None, None)
return None
finally:
self.setState(State.Ready)
def doUpdate(self):
self.get()
def read(self,timeout=1.0):
initial = self.state
if initial == State.Disabled:
self.enable()
try:
return self.get()
finally:
if initial == State.Disabled:
self.disable()
add_device(BarcodeReader("barcode_reader"), force = True)

View File

@@ -48,6 +48,12 @@ class Hexiposi(DiscretePositionerBase):
self.rback = rback
return self.status
def set_deadband(self, value = 0.1): #degrees
ret = self.get_response(requests.get(url=self.url+"setDeadband?deadband=" + str(value), timeout=self.timeout))
if ret["deadbandOutput"] == value:
return value
raise Excepiton("Error setting deadband: " + str(ret))
def move_pos(self, pos):
return self.get_response(requests.get(url=self.url+"set?pos=" + str(pos), timeout=self.timeout))

View File

@@ -0,0 +1,107 @@
class SmartMagnet(DeviceBase):
def __init__(self, name):
#DeviceBase.__init__(self, name, get_context().pluginManager.getDynamicClass("SmartMagnetConfig")())
DeviceBase.__init__(self, name, DeviceConfig({
"holdingCurrent":0.0,
"restingCurrent":0.0,
"mountCurrent":0.0,
"unmountCurrent":0.0,
"remanenceCurrent":0.0,
}))
def doInitialize(self):
DeviceBase.doInitialize(self)
self.get_current()
def set_current(self, current):
self.setCache(current, None)
smc_current.write(current)
def get_current(self):
cur = smc_current.read()
self.setCache(cur, None)
return cur
def get_current_rb(self):
self.assert_status()
return smc_current_rb.read()
def get_status(self):
return smc_magnet_status.read()
def assert_status(self):
if self.get_status() == False:
raise Exception("Smart Magnet is in faulty status.")
def is_mounted(self):
self.assert_status()
m1 = smc_mounted_1.read()
m2 = smc_mounted_2.read()
if m2==m1:
raise Exception("Smart Magnet has invalid detection.")
return m2
def set_supress(self, value):
smc_sup_det.write(value)
def get_supress(self):
return smc_sup_det.read()
def check_mounted(self, idle_time =1.0, timeout = -1):
self.assert_status()
start = time.time()
last = None
while True:
try:
det = self.is_mounted()
except:
det = None
if det != last:
settling_timestamp = time.time()
last = det
else:
if det is not None:
if (time.time()-settling_timestamp > idle_time):
return det
if timeout >= 0:
if (time.time() - start) > timeout:
raise Exception("Timeout waiting for Smart Magnet detection.")
time.sleep(0.01)
def doUpdate(self):
try:
if self.is_mounted():
self.setState(State.Busy)
else:
self.setState(State.Ready)
except:
self.setState(State.Fault)
def set_holding_current(self):
self.set_current(self.config.getFieldValue("holdingCurrent"))
def set_resting_current(self):
self.set_current(self.config.getFieldValue("restingCurrent"))
def set_mount_current(self):
self.set_current(self.config.getFieldValue("mountCurrent"))
def set_unmount_current(self):
self.set_current(self.config.getFieldValue("unmountCurrent"))
def set_remanence_current(self):
self.set_current(self.config.getFieldValue("remanenceCurrent"))
def set_default_current():
if self.is_mounted():
self.set_holding_current()
else:
self.set_resting_current()
add_device(SmartMagnet("smart_magnet"), force = True)
smart_magnet.polling = 1000
smart_magnet.set_default_current()

View File

@@ -14,7 +14,7 @@ run("setup/Layout")
###################################################################################################
for script in ["devices/RobotSC", "devices/Wago", "devices/BarcodeReader", "devices/LaserDistance", \
"devices/LedCtrl", "devices/HexiPosi"]:
"devices/LedCtrl", "devices/SmartMagnet", "devices/HexiPosi"]:
try:
run(script)
except:

View File

@@ -11,6 +11,10 @@ def mount(segment, puck, sample, force=False):
robot.assert_cleared()
#robot.assert_in_known_point()
hexiposi.assert_homed()
if smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) == True:
raise Exception("Pin detected on gonio")
#location = robot.get_current_point()
#Enabling
@@ -26,5 +30,12 @@ def mount(segment, puck, sample, force=False):
robot.get_dewar(segment, puck, sample)
robot.move_gonio()
robot.put_gonio()
robot.move_dewar()
smart_magnet.set_mount_current()
try:
robot.put_gonio()
robot.move_dewar()
if smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) == False:
raise Exception("No pin detected on gonio")
finally:
smart_magnet.set_default_current()