This commit is contained in:
gac-S_Changer
2018-05-22 16:07:56 +02:00
parent 5114bfaf3d
commit 05f982c86b
26 changed files with 595 additions and 221 deletions

View File

@@ -1,4 +1,4 @@
img=ch.psi.pshell.prosilica.Prosilica|25001 "PacketSize=1522"|||false
img=ch.psi.pshell.prosilica.Prosilica|25001 "PacketSize=1522;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=300;RegionY=200;Width=1000;Height=1000"|||false
microscan=ch.psi.pshell.serial.TcpDevice|129.129.126.200:2001|||
microscan_cmd=ch.psi.pshell.serial.TcpDevice|129.129.126.200:2003|||
ue=LaserUE|COM4|||false

View File

@@ -0,0 +1,11 @@
#Thu May 03 11:54:38 CEST 2018
disableCompression=false
keepListeningOnStop=false
mappingIncomplete=null
parallelHandlerProcessing=true
sendAwaitFirstMessage=false
sendBuildChannelConfig=null
sendStrategy=null
sendSyncTimeout=0
socketType=DEFAULT
validationInconsistency=null

View File

@@ -1,4 +1,4 @@
#Mon Apr 09 18:08:09 CEST 2018
#Mon May 07 14:51:31 CEST 2018
colormap=Grayscale
colormapAutomatic=false
colormapMax=18.133
@@ -9,16 +9,16 @@ grayscale=false
invert=false
rescaleFactor=1.0
rescaleOffset=0.0
roiHeight=-1
roiWidth=-1
roiX=0
roiY=0
rotation=0.0
roiHeight=867
roiWidth=875
roiX=65
roiY=55
rotation=17.927919762007235
rotationCrop=true
scale=1.0
spatialCalOffsetX=NaN
spatialCalOffsetY=NaN
spatialCalScaleX=NaN
spatialCalScaleY=NaN
spatialCalOffsetX=-438.0
spatialCalOffsetY=-434.0
spatialCalScaleX=0.5371114316839612
spatialCalScaleY=0.5416192705243328
spatialCalUnits=mm
transpose=false

View File

@@ -1,4 +1,4 @@
#Fri Mar 23 15:41:28 CET 2018
#Fri May 04 16:52:30 CEST 2018
maxValue=0.4
minValue=0.0
offset=0.0

View File

@@ -1,4 +1,4 @@
#Fri Mar 23 15:41:28 CET 2018
#Fri May 04 16:52:30 CEST 2018
maxValue=0.4
minValue=0.0
offset=0.0

View File

@@ -1,4 +1,4 @@
#Fri Mar 23 15:41:28 CET 2018
#Fri May 04 16:52:30 CEST 2018
maxValue=0.4
minValue=0.0
offset=0.0

View File

@@ -16,58 +16,60 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonMount" min="-2" pref="106" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Component id="checkFirst" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonMount" min="-2" pref="106" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Component id="checkFirst" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerSample" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPuck" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSegment" linkSize="2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="spinnerSample" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerPuck" linkSize="2" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSegment" linkSize="2" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="jPanel2" alignment="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonEnableAll" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="buttonReleasePsys" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonReleaseLocal" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" alignment="1" groupAlignment="0" max="-2" attributes="0">
<Component id="buttonEnableAll" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="buttonReleasePsys" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="buttonReleaseLocal" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="373" max="32767" attributes="0"/>
<EmptySpace pref="377" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonEnableAll" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonReleaseLocal" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonReleasePsys" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@@ -86,7 +88,7 @@
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="spinnerSample" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
<EmptySpace pref="175" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -163,12 +165,12 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="59" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="buttonEnable" linkSize="4" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="buttonDisable" linkSize="4" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="75" max="32767" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -219,5 +221,58 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonReleasePsysActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Hexiposi"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="buttonHomingHexiposi" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="buttonPositionsHexiposi" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="buttonHomingHexiposi" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="buttonPositionsHexiposi" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="24" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="buttonHomingHexiposi">
<Properties>
<Property name="text" type="java.lang.String" value="Homing"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonHomingHexiposiActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="buttonPositionsHexiposi">
<Properties>
<Property name="text" type="java.lang.String" value="Positions"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonPositionsHexiposiActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@@ -85,6 +85,9 @@ public class Expert extends Panel {
buttonDisable = new javax.swing.JButton();
buttonReleaseLocal = new javax.swing.JButton();
buttonReleasePsys = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
buttonHomingHexiposi = new javax.swing.JButton();
buttonPositionsHexiposi = new javax.swing.JButton();
buttonEnableAll.setText("Enable All");
buttonEnableAll.addActionListener(new java.awt.event.ActionListener() {
@@ -136,11 +139,11 @@ public class Expert extends Panel {
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(59, Short.MAX_VALUE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonEnable)
.addComponent(buttonDisable))
.addContainerGap(75, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonDisable, buttonEnable});
@@ -169,39 +172,76 @@ public class Expert extends Panel {
}
});
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Hexiposi"));
buttonHomingHexiposi.setText("Homing");
buttonHomingHexiposi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonHomingHexiposiActionPerformed(evt);
}
});
buttonPositionsHexiposi.setText("Positions");
buttonPositionsHexiposi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
buttonPositionsHexiposiActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(buttonHomingHexiposi)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPositionsHexiposi)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonHomingHexiposi)
.addComponent(buttonPositionsHexiposi))
.addContainerGap(24, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonMount, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(checkFirst)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerSample, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerPuck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonEnableAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonReleasePsys)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonReleaseLocal)))))
.addContainerGap(373, Short.MAX_VALUE))
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(buttonMount, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(checkFirst)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(spinnerSample, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerPuck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jPanel1, 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))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(buttonEnableAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(buttonReleasePsys)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(buttonReleaseLocal))))
.addContainerGap(377, Short.MAX_VALUE))
);
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jLabel1, jLabel2, jLabel3});
@@ -211,13 +251,15 @@ public class Expert extends Panel {
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addContainerGap()
.addComponent(buttonEnableAll)
.addGap(18, 18, 18)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonReleaseLocal)
.addComponent(buttonReleasePsys))
.addGap(18, 18, 18)
.addComponent(jPanel2, 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)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@@ -233,7 +275,7 @@ public class Expert extends Panel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(spinnerSample, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24))
.addContainerGap(175, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@@ -264,11 +306,21 @@ public class Expert extends Panel {
execute("release_psys()");
}//GEN-LAST:event_buttonReleasePsysActionPerformed
private void buttonHomingHexiposiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonHomingHexiposiActionPerformed
execute("hexiposi.move_home()");
}//GEN-LAST:event_buttonHomingHexiposiActionPerformed
private void buttonPositionsHexiposiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonPositionsHexiposiActionPerformed
this.showDevicePanel("hexiposi");
}//GEN-LAST:event_buttonPositionsHexiposiActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonDisable;
private javax.swing.JButton buttonEnable;
private javax.swing.JButton buttonEnableAll;
private javax.swing.JButton buttonHomingHexiposi;
private javax.swing.JButton buttonMount;
private javax.swing.JButton buttonPositionsHexiposi;
private javax.swing.JButton buttonReleaseLocal;
private javax.swing.JButton buttonReleasePsys;
private javax.swing.JCheckBox checkFirst;
@@ -276,6 +328,7 @@ public class Expert extends Panel {
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JSpinner spinnerPuck;
private javax.swing.JSpinner spinnerSample;
private javax.swing.JSpinner spinnerSegment;

Binary file not shown.

View File

@@ -16,25 +16,19 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="142" max="-2" attributes="0"/>
<Component id="jPanel11" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="143" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="163" max="-2" attributes="0"/>
<Component id="jPanel11" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="122" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="84" max="-2" attributes="0"/>
<Component id="jPanel11" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="84" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="85" max="-2" attributes="0"/>
<Component id="jPanel11" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="83" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>

View File

@@ -188,21 +188,17 @@ public class NewJPanel extends javax.swing.JPanel {
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)))
.addGroup(layout.createSequentialGroup()
.addGap(163, 163, 163)
.addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(122, 122, 122))
);
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)))
.addGroup(layout.createSequentialGroup()
.addGap(85, 85, 85)
.addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(83, 83, 83))
);
}// </editor-fold>//GEN-END:initComponents

15
script/LN2_Monitoring.scd Normal file
View File

@@ -0,0 +1,15 @@
[
[ [ true, "phase_separator_level", "Device", 1, 1, "102,204,255" ],
[ true, "filling_phase_separator", "Device", 1, 1, "51,255,255" ],
[ true, "filling_dewar", "Device", 1, 1, "0,0,102" ],
[ true, "dewar_level", "Device", 1, 1, "0,51,153" ],
[ true, "rim_heater_temp", "Device", 1, 1, "255,0,51" ] ],
[ [ "1", 0.0, 100.0, null, null, 1000000.0, false, null ],
[ "2", null, null, null, null, null, null, null ],
[ "3", null, null, null, null, null, null, null ],
[ "4", null, null, null, null, null, null, null ],
[ "5", null, null, null, null, null, null, null ] ],
[ [ ] ],
[ [ "", 20000, 100 ],
[ "", "" ] ]
]

View File

@@ -1,11 +1,11 @@
[
[ [ true, "phase_separator_level", "Device", 1, 1, "255,0,0" ],
[ true, "dewar_level", "Device", 1, 1, "0,0,255" ] ],
[ [ "1", 0.0, 100.0, null, null, 100000.0, true ],
[ "2", null, null, null, null, null, null ],
[ "3", null, null, null, null, null, null ],
[ "4", null, null, null, null, null, null ],
[ "5", null, null, null, null, null, null ] ],
[ [ "1", 0.0, 100.0, null, null, 100000.0, false, null ],
[ "2", null, null, null, null, null, null, null ],
[ "3", null, null, null, null, null, null, null ],
[ "4", null, null, null, null, null, null, null ],
[ "5", null, null, null, null, null, null, null ] ],
[ [ ] ],
[ [ "", 20000, 100 ],
[ "", "" ] ]

View File

@@ -76,11 +76,11 @@ class Hexiposi(DiscretePositionerBase):
self.val = val
self.move_pos(self.val)
#Workaround as state does not changes immediatelly
#if moving:
# try:
# self.waitState(State.Busy,1200)
# except:
# pass
if moving:
try:
self.waitState(State.Busy,1200)
except:
pass
#def isReady(self):
# self.get_status()
@@ -97,7 +97,7 @@ class Hexiposi(DiscretePositionerBase):
#http://129.129.110.83:8002/hexiposi/get
dev = Hexiposi("hexiposi", "129.129.110.83:8002/hexiposi")
dev = Hexiposi("hexiposi", "myriotell:8002/hexiposi")
add_device(dev, True)
hexiposi.polling=500

View File

@@ -24,14 +24,17 @@ class RobotSC(RobotTCP):
RobotTCP.__init__(self, name, server, timeout, retries)
self.setPolling(DEFAULT_ROBOT_POLLING)
def mount(self, puck, sample):
def mount(self, segment, puck, sample):
return self.execute('mount',segment, puck, sample)
def firstmount(self, puck, sample):
def firstmount(self, segment, puck, sample):
return self.execute('firstmount', segment, puck, sample)
def unmount(self, puck, sample):
def unmount(self, segment, puck, sample):
return self.execute('unmount',segment, puck, sample)
def robotRecover(self):
return self.execute('robotRecover')
def on_event(self,ev):
#print "EVT: " + ev

View File

@@ -45,7 +45,7 @@ def set_led_level(level):
def get_led_level():
level = get_setting("led_level")
return float(50 if level is None else level)
return float(0 if level is None else level)
def set_led_state(value):
"""
@@ -83,6 +83,7 @@ def set_led_range(room_temp = True):
led_ctrl_2.write(max_val)
if led_ctrl_3.read() > max_val:
led_ctrl_3.write(max_val)
set_led_level(get_led_level())
def is_led_room_temp():

View File

@@ -16,16 +16,48 @@ img.config.rotationCrop=True
"""
sensor_width,sensor_height = img.camera.getSensorSize()
img.camera.setROI(0, 0,sensor_width, sensor_height)
img.config.rotation=0
img.config.roiX,img.config.roiY, img.config.roiWidth,img.config.roiHeight =0,0,-1,-1
img.config.setCalibration(None)
img.camera.stop()
img.camera.start()
p = show_panel(img)
p.setMode(RendererMode.Fit)
ov_text = Text(Pen(java.awt.Color.GREEN.darker()), "", java.awt.Font("Verdana", java.awt.Font.PLAIN, 24), java.awt.Point(20,20))
ov_text.setFixed(True)
p.addOverlay(ov_text)
try:
#Find image center and Prosilica ROI
ov_text.update("Click on the center of the Dewar...")
p.refresh()
dc = p.waitClick(60000)
print dc
width, height = min(dc.x, sensor_width-dc.x)*2, min(dc.y, sensor_height-dc.y)*2
width, height = width - width%16, height - height%16
width, height = min(width,1000), min(height,1000)
print width, height
roi_x = int(dc.x- width/2)
roi_y = int(dc.y- height/2)
roi_w = int(width)
roi_h = int(height)
set_setting("roi_x", roi_x)
set_setting("roi_y", roi_y)
set_setting("roi_w", roi_w)
set_setting("roi_h", roi_h)
img.camera.setROI(roi_x, roi_y, width, height)
except:
img.camera.setROI(int(get_setting("roi_x")), int(get_setting("roi_y")), int(get_setting("roi_w")), int(get_setting("roi_h")))
finally:
img.camera.stop()
img.camera.start()
#Configure source
CC4 = (-129.9, -150)
CD5 = (129.9, -150)
CA5 = (-129.9, 150)
@@ -45,7 +77,8 @@ def rotate(x,y, degrees):
y = oy * math.cos(rotation) + ox * math.sin(rotation) + rh / 2;
return x,y
p.addOverlay(ov_text)
set_led_state(True)
try:
ov_text.update("Click on the center of C4 (19) position...")
p.refresh()
@@ -89,13 +122,14 @@ try:
roi_x, roi_y = int(rcx-roi_w/2), int(rcy-roi_h/2)
print a, sx, sy, roi_w, roi_h
img.config.rotation=-a
img.config.roiX,img.config.roiY, img.config.roiWidth,img.config.roiHeight = roi_x, roi_y, roi_w, roi_h
img.config.setCalibration(Calibration(sx, sy, -roi_w/2, -roi_h/2))
img.config.save()
finally:
set_led_state(False)
p.removeOverlay(ov_text)
img.refresh()

View File

@@ -0,0 +1,79 @@
###################################################################################################
# Procedure to detect the cover orientation
###################################################################################################
#Parameters
FRAMES_INTEGRATION = 3
STEP_SIZE = 2
POSITION_NAMES = [ 'A','B','C','D', 'E', 'F']
POSITION_ANGLES = [330, 30, 90, 150, 210, 270]
POSITION_TOLERANCE = 10
MINIMUM_CONFIDENCE = 10
DEBUG = True
PLOT = True
REFERENCE_IMG = "ref2"
#Load reference image
ref = load_image(str("{images}/cover/" + REFERENCE_IMG + ".png") , title="Line")
#Pre-process camera image
#ip = load_image("{images}/cover/Cover_000" + str(index) + ".png", title="Img")
ip = integrate_frames(FRAMES_INTEGRATION)
ip = grayscale(ip, True)
smooth(ip)
#bandpass_filter(ip, 30, 1000)
edges(ip)
auto_threshold(ip, method = "MaxEntropy")
cx,cy = int(ip.width/2), int(ip.height/2)
ip = sub_image(ip, cx-ref.width/2, cy-ref.height/2, ref.width, ref.height)
#Show ROI of pre-processed image
image_panel = show_panel(ip.bufferedImage)
#Calculate correlation between image and reference, rotating the reference from 0 to 360
import ch.psi.pshell.imaging.Utils.integrateVertically as integrateVertically
ydata = []
xdata = range (0,360,STEP_SIZE)
for i in xdata:
r = ref.duplicate()
r.getProcessor().setBackgroundValue(0.0)
r.getProcessor().rotate(float(i))
op = op_fft(ip, r, "correlate")
bi = op.getBufferedImage()
p = integrateVertically(bi)
ydata.append(sum(p))
#image_panel = show_panel(op.bufferedImage)
#time.sleep(0.001)
#Calculate angle of the highest correlation, and confidence level
peaks = estimate_peak_indexes(ydata, xdata, (min(ydata) + max(ydata))/2, 25.0)
peaks_x = map(lambda x:xdata[x], peaks)
peaks_y = map(lambda x:ydata[x], peaks)
confidence = None if len(peaks_x)<2 else int(((float(peaks_y[0])/peaks_y[1])-1) * 1000)
angle = (None if len(peaks_x)==0 else peaks_x[0])
#From angle and confidence level estimate hexiposi position
position = None
if angle is not None:
for i in range(len(POSITION_NAMES)):
if abs(POSITION_ANGLES[i] - angle) <= POSITION_TOLERANCE:
position = POSITION_NAMES[i]
#Plot the correlations values agains angle
if PLOT:
p = plot(ydata, xdata=xdata)[0]
#Output results
if DEBUG:
print "Peaks", peaks
print "Peak indexes: " + str(peaks_x)
print "Peak values: " + str(peaks_y)
print "Angle: " , angle
print "Position: " , position
print "Confifdence: " , confidence
#Set return value
set_return ([position, angle, confidence])

View File

@@ -2,77 +2,93 @@
# Procedure to detect the puck light spots.
###################################################################################################
COVER_PRESENT = True
ROOM_TEMP = False
room_temp = False
number_frames = 10
number_backgrounds = 10
if get_exec_pars().source == CommandSource.ui:
PLOT = None
RENDERER = None
TEXT = None
if COVER_PRESENT:
cover_position = hexiposi.readback.take()
if (cover_position is None) or (cover_position == "Unknown"):
raise Exception("Unknown cover position")
else:
block_id = cover_position.upper()[0]
else:
block_id = None
print "Block id: ", block_id
number_frames = 5 if ROOM_TEMP else 10
number_backgrounds = 5 if ROOM_TEMP else 10
minimum_size = 150
maximum_size = 1500
min_circ = 0.2
threshold_method = "MaxEntropy" if room_temp else "Default" #Apparently good for LN2: Default, Intermodes, IsoData, Otsu
threshold_method = "MaxEntropy" if ROOM_TEMP else "Default" #Apparently good for LN2: Default, Intermodes, IsoData, Otsu
threshold_method,threshold_range = "Manual", (0, 215)
exclude_edges = True
led_latency = 0.5 #0.1
set_led_range(room_temp)
img.backgroundEnabled=False
set_led_state(False)
time.sleep(0.1)
img.waitNext(100)
time.sleep(led_latency)
img.waitNext(2000)
background = average_frames(number_backgrounds)
#img.backgroundImage=background.bufferedImage
#img.captureBackground(1,0)
#show_panel(img.backgroundImage)
#img.backgroundEnabled = True
set_led_state(True)
time.sleep(0.1)
img.waitNext(100)
time.sleep(led_latency)
img.waitNext(2000)
image = average_frames(number_frames)
set_led_state(False)
op_image(image, background, "subtract", float_result=True, in_place=True)
renderer = show_panel(image.getBufferedImage())
renderer.clearOverlays()
if RENDERER is None:
RENDERER = show_panel(image.getBufferedImage())
else:
RENDERER.setImage(None, image.getBufferedImage(), None)
RENDERER.clearOverlays()
invert(image)
auto_threshold(image, method = threshold_method) #Tested ok: MaxEntropy, Triangle, Yen
#renderer = show_panel(image.getBufferedImage())
#binary_open(aux)
if threshold_method == "Manual":
threshold(image, threshold_range[0], threshold_range[1])
else:
auto_threshold(image, method = threshold_method) #Tested ok: MaxEntropy, Triangle, Yen
(r,output) = analyse_particles(image, minimum_size,maximum_size,
fill_holes = True, exclude_edges = exclude_edges, print_table=False,
output_image = "outlines", minCirc = min_circ
, maxCirc = 1.0)
points = ""
npoints = 0
x=[]
y=[]
points = []
for row in range (r.counter):
if in_roi(r.getValue("XM",row), r.getValue("YM",row)):
#x, y = int(r.getValue("XM", row))+roi[0], int(r.getValue("YM", row))+roi[1]
x.append(int(r.getValue("XM", row)))
y.append(int(r.getValue("YM", row)))
points = points + " (" + str(x[-1]) + ", " + str(y[-1]) + ")"
npoints = npoints + 1
renderer.addOverlay(Crosshairs(Pen(java.awt.Color.MAGENTA), java.awt.Point(x[-1],y[-1]), java.awt.Dimension(15,15)))
print str(npoints) + " - " + points
#print r
#print x
#print y
offset = int(math.sqrt(1000)/2)
cv = (min(x)-offset, min(y)-offset, max(x)+offset, max(y)+offset)
renderer.addOverlay(Rect(Pen(java.awt.Color.MAGENTA), java.awt.Point(cv[0], cv[1]), java.awt.Dimension(cv[2]-cv[0],cv[3]-cv[1])))
#show_panel(output.getBufferedImage())
#img.backgroundEnabled=False
x, y = int(r.getValue("XM", row)), int(r.getValue("YM", row))
cx, cy = img.getCalibration().convertToAbsoluteX(x), img.getCalibration().convertToAbsoluteY(y)
points.append([cx,cy])
RENDERER.addOverlay(Crosshairs(Pen(java.awt.Color.MAGENTA), java.awt.Point(x,y), java.awt.Dimension(15,15)))
#RENDERER.addOverlays(ovs)
clear_detection(block_id)
detect_pucks(points, block_id)
plot_base_plate(points, p=PLOT)
ret = get_puck_detection_dict(block_id)
if TEXT is not None:
TEXT.setText(str(ret))
set_return(ret)

View File

@@ -7,9 +7,17 @@
from ijutils import *
from ch.psi.pshell.imaging.Overlays import *
import ch.psi.pshell.imaging.Pen as Pen
import java.awt.Rectangle as Rectangle
def get_img_cover_pos():
[position, angle, confidence] = run("imgproc/CoverDetection2")
return position
def in_roi(x,y):
return math.hypot(x-roi_radius, y-roi_radius) < roi_radius
global roi_center, roi_radius, roi_border
return math.hypot(x-roi_center[0], y-roi_center[1]) < (roi_radius-roi_border)
def integrate(ips):
@@ -40,18 +48,26 @@ def integrate_frames(samples = 1):
return integrate(grab_frames(samples))
roi_center = (800, 600)
roi_center = (600, 600) #(800, 600)
roi_radius = 600
roi_border = 30
def get_roi():
return (roi_center[0] - roi_radius, roi_center[1] - roi_radius, 2* roi_radius, 2*roi_radius)
#roi_center = (img.output.width/2, img.output.height/2)
#roi_radius = min(roi_center[0], roi_center[1])
#return (roi_center[0] - roi_radius, roi_center[1] - roi_radius, 2* roi_radius, 2*roi_radius)
global roi_center, roi_radius
roi_center = (img.output.width/2, img.output.height/2)
roi_radius = min(roi_center[0], roi_center[1])
return (0,0,img.output.width, img.output.height)
def get_image():
roi = get_roi()
ip = load_image(img.image)
ret = sub_image(ip, roi[0], roi[1], roi[2], roi[3])
grayscale(ret, do_scaling=True)
#ip = load_image(img.output)
#ret = ip if (roi is None) else sub_image(ip, roi[0], roi[1], roi[2], roi[3])
#grayscale(ret, do_scaling=True)
ret = load_image(Utils.grayscale(img.output, Rectangle(roi[0], roi[1], roi[2], roi[3]) if (roi is not None) else None))
return ret
#def detect_pucks(ip):

View File

@@ -29,6 +29,8 @@ add_device(img.getCamera(), force = True)
###################################################################################################
run("motion/tools")
run("motion/mount")
run("motion/unmount")
run("imgproc/Utils")
run("tools/Math")
@@ -72,19 +74,21 @@ except:
try:
import ch.psi.pshell.device.Camera as Camera
img.camera.setColorMode(Camera.ColorMode.Mono)
img.camera.setDataType(Camera.DataType.UInt8)
#img.camera.setColorMode(Camera.ColorMode.Mono)
#img.camera.setDataType(Camera.DataType.UInt8)
img.camera.setGrabMode(Camera.GrabMode.Continuous)
img.camera.setTriggerMode(Camera.TriggerMode.Fixed_Rate)
img.camera.setExposure(50.00)
img.camera.setAcquirePeriod(200.00)
img.camera.setGain(0.0)
#img.camera.setROI(200, 0,1200,1200)
img.camera.setROI(300, 200,1000,1000)
"""
img.camera.setROI(300, 200,1000,1000)
img.config.rotation=17
img.config.rotationCrop=True
img.config.roiX,img.config.roiY, img.config.roiWidth,img.config.roiHeight = 50,50,900,900
"""
img.camera.setROI(int(get_setting("roi_x")), int(get_setting("roi_y")), int(get_setting("roi_w")), int(get_setting("roi_h")))
img.camera.stop()
img.camera.start()

16
script/motion/mount.py Normal file
View File

@@ -0,0 +1,16 @@
def mount(segment, puck, sample, unmount = False):
"""
"""
cmd = "firstmount" if unmount else "mount"
assertValidAddress(segment, puck, sample)
hexiposi.move(segment)
img_segment = get_img_cover_pos()
if img_segment != segment:
raise Excepton ("Image detection of cover does not match hexiposi: " + str(img_segment))
if type(segment) == str:
segment = ord(segment.upper()) - ord('A') +1
robot.start_task(cmd,segment, puck, sample)
#robot.mount(segment, puck, sample)

View File

@@ -68,6 +68,15 @@ def update_tool(tool=None, x_offset=0.0, y_offset=0.0, z_offset=0.0):
robot.set_tool_trsf(t, tool)
print "Updated " + (str(robot.tool) if (tool is None) else tool) + ": " + str(t)
robot.save_program()
def assertValidAddress(segment, puck, sample):
if type(segment) == str:
segment = ord(segment.upper()) - ord('A') +1
if segment<=0 or segment >6:
raise Excepton ("Invalid segment")
if puck<=0 or puck >5:
raise Excepton ("Invalid puck")
if sample<=0 or sample >16:
raise Excepton ("Invalid sample")

15
script/motion/unmount.py Normal file
View File

@@ -0,0 +1,15 @@
def unmount(segment, puck, sample):
"""
"""
assertValidAddress(segment, puck, sample)
hexiposi.move(segment)
img_segment = get_img_cover_pos()
if img_segment != segment:
raise Excepton ("Image detection of cover does not match hexiposi: " + str(img_segment))
if type(segment) == str:
segment = ord(segment.upper()) - ord('A') +1
robot.unmount(segment, puck, sample)

View File

@@ -11,6 +11,7 @@ DET_UNIPUCK = "unipuck"
DET_MINISPINE = "minispine"
DET_ERROR = "error"
DET_EMPTY = "empty"
DET_UNKNOWN = "unknown"
BLOCKS = ('A', 'B', 'C', 'D', 'E', 'F')
@@ -19,34 +20,34 @@ puck_layout = (
#Num Elm A0 Index A1 Uni Mini Center Angle Xuni Yuni Xmini=Xc Ymini==Yc
(1 , 'A', 0 , 1, 0.00 , 57.00 , 75.00 , 66.00 , 0.00 , 0.00 , 57.00 , 0.00 , 75.00 ),
(2 , 'A', 0 , 2, 0.00 , 132.00, 150.00, 141.00, 0.00 , 0.00 , 132.00 , 0.00 , 150.00 ),
(3 , 'A', 0 , 3, 19.11, 180.40, 198.40, 189.40, 19.11 , 59.06 , 170.46 , 64.95 , 187.47 ),
(4 , 'A', 0 , 4, 40.89, 180.40, 198.40, 189.40, 40.89 , 118.09 , 136.38 , 129.87 , 149.98 ),
(5 , 'A', 0 , 5, 30.00, 111.90, 129.90, 120.90, 30.00 , 55.95 , 96.91 , 64.95 , 112.50 ),
(6 , 'B', 60 , 1, 0.00 , 57.00 , 75.00 , 66.00 , 60.00 , 49.36 , 28.50 , 64.95 , 37.50 ),
(7 , 'B', 60 , 2, 0.00 , 132.00, 150.00, 141.00, 60.00 , 114.32 , 66.00 , 129.90 , 75.00 ),
(8 , 'B', 60 , 3, 19.11, 180.40, 198.40, 189.40, 79.11 , 177.15 , 34.08 , 194.83 , 37.48 ),
(9 , 'B', 60 , 4, 40.89, 180.40, 198.40, 189.40, 100.89, 177.15 , -34.08 , 194.83 , -37.48 ),
(10, 'B', 60 , 5, 30.00, 111.90, 129.90, 120.90, 90.00 , 111.90 , 0.00 , 129.90 , 0.00 ),
(11, 'C', 120, 1, 0.00 , 57.00 , 75.00 , 66.00 , 120.00, 49.36 , -28.50 , 64.95 , -37.50 ),
(12, 'C', 120, 2, 0.00 , 132.00, 150.00, 141.00, 120.00, 114.32 , -66.00 , 129.90 , -75.00 ),
(13, 'C', 120, 3, 19.11, 180.40, 198.40, 189.40, 139.11, 118.09 , -136.38, 129.87 , -149.98),
(14, 'C', 120, 4, 40.89, 180.40, 198.40, 189.40, 160.89, 59.06 , -170.46, 64.95 , -187.47),
(15, 'C', 120, 5, 30.00, 111.90, 129.90, 120.90, 150.00, 55.95 , -96.91 , 64.95 , -112.50),
(3 , 'F', 0 , 5, 19.11, 180.40, 198.40, 189.40, 19.11 , 59.06 , 170.46 , 64.95 , 187.47 ),
(4 , 'F', 0 , 4, 40.89, 180.40, 198.40, 189.40, 40.89 , 118.09 , 136.38 , 129.87 , 149.98 ),
(5 , 'F', 0 , 3, 30.00, 111.90, 129.90, 120.90, 30.00 , 55.95 , 96.91 , 64.95 , 112.50 ),
(6 , 'F', 60 , 1, 0.00 , 57.00 , 75.00 , 66.00 , 60.00 , 49.36 , 28.50 , 64.95 , 37.50 ),
(7 , 'F', 60 , 2, 0.00 , 132.00, 150.00, 141.00, 60.00 , 114.32 , 66.00 , 129.90 , 75.00 ),
(8 , 'E', 60 , 5, 19.11, 180.40, 198.40, 189.40, 79.11 , 177.15 , 34.08 , 194.83 , 37.48 ),
(9 , 'E', 60 , 4, 40.89, 180.40, 198.40, 189.40, 100.89, 177.15 , -34.08 , 194.83 , -37.48 ),
(10, 'E', 60 , 3, 30.00, 111.90, 129.90, 120.90, 90.00 , 111.90 , 0.00 , 129.90 , 0.00 ),
(11, 'E', 120, 1, 0.00 , 57.00 , 75.00 , 66.00 , 120.00, 49.36 , -28.50 , 64.95 , -37.50 ),
(12, 'E', 120, 2, 0.00 , 132.00, 150.00, 141.00, 120.00, 114.32 , -66.00 , 129.90 , -75.00 ),
(13, 'D', 120, 5, 19.11, 180.40, 198.40, 189.40, 139.11, 118.09 , -136.38, 129.87 , -149.98),
(14, 'D', 120, 4, 40.89, 180.40, 198.40, 189.40, 160.89, 59.06 , -170.46, 64.95 , -187.47),
(15, 'D', 120, 3, 30.00, 111.90, 129.90, 120.90, 150.00, 55.95 , -96.91 , 64.95 , -112.50),
(16, 'D', 180, 1, 0.00 , 57.00 , 75.00 , 66.00 , 180.00, 0.00 , -57.00 , 0.00 , -75.00 ),
(17, 'D', 180, 2, 0.00 , 132.00, 150.00, 141.00, 180.00, 0.00 , -132.00, 0.00 , -150.00),
(18, 'D', 180, 3, 19.11, 180.40, 198.40, 189.40, 199.11, -59.06 , -170.46, -64.95 , -187.47),
(19, 'D', 180, 4, 40.89, 180.40, 198.40, 189.40, 220.89, -118.09, -136.38, -129.87, -149.98),
(20, 'D', 180, 5, 30.00, 111.90, 129.90, 120.90, 210.00, -55.95 , -96.91 , -64.95 , -112.50),
(21, 'E', 240, 1, 0.00 , 57.00 , 75.00 , 66.00 , 240.00, -49.36 , -28.50 , -64.95 , -37.50 ),
(22, 'E', 240, 2, 0.00 , 132.00, 150.00, 141.00, 240.00, -114.32, -66.00 , -129.90, -75.00 ),
(23, 'E', 240, 3, 19.11, 180.40, 198.40, 189.40, 259.11, -177.15, -34.08 , -194.83, -37.48 ),
(24, 'E', 240, 4, 40.89, 180.40, 198.40, 189.40, 280.89, -177.15, 34.08 , -194.83, 37.48 ),
(25, 'E', 240, 5, 30.00, 111.90, 129.90, 120.90, 270.00, -111.90, 0.00 , -129.90, 0.00 ),
(26, 'F', 300, 1, 0.00 , 57.00 , 75.00 , 66.00 , 300.00, -49.36 , 28.50 , -64.95 , 37.50 ),
(27, 'F', 300, 2, 0.00 , 132.00, 150.00, 141.00, 300.00, -114.32, 66.00 , -129.90, 75.00 ),
(28, 'F', 300, 3, 19.11, 180.40, 198.40, 189.40, 319.11, -118.09, 136.38 , -129.87, 149.98 ),
(29, 'F', 300, 4, 40.89, 180.40, 198.40, 189.40, 340.89, -59.06 , 170.46 , -64.95 , 187.47 ),
(30, 'F', 300, 5, 30.00, 111.90, 129.90, 120.90, 330.00, -55.95 , 96.91 , -64.95 , 112.5 ),
(18, 'C', 180, 5, 19.11, 180.40, 198.40, 189.40, 199.11, -59.06 , -170.46, -64.95 , -187.47),
(19, 'C', 180, 4, 40.89, 180.40, 198.40, 189.40, 220.89, -118.09, -136.38, -129.87, -149.98),
(20, 'C', 180, 3, 30.00, 111.90, 129.90, 120.90, 210.00, -55.95 , -96.91 , -64.95 , -112.50),
(21, 'C', 240, 1, 0.00 , 57.00 , 75.00 , 66.00 , 240.00, -49.36 , -28.50 , -64.95 , -37.50 ),
(22, 'C', 240, 2, 0.00 , 132.00, 150.00, 141.00, 240.00, -114.32, -66.00 , -129.90, -75.00 ),
(23, 'B', 240, 5, 19.11, 180.40, 198.40, 189.40, 259.11, -177.15, -34.08 , -194.83, -37.48 ),
(24, 'B', 240, 4, 40.89, 180.40, 198.40, 189.40, 280.89, -177.15, 34.08 , -194.83, 37.48 ),
(25, 'B', 240, 3, 30.00, 111.90, 129.90, 120.90, 270.00, -111.90, 0.00 , -129.90, 0.00 ),
(26, 'B', 300, 1, 0.00 , 57.00 , 75.00 , 66.00 , 300.00, -49.36 , 28.50 , -64.95 , 37.50 ),
(27, 'B', 300, 2, 0.00 , 132.00, 150.00, 141.00, 300.00, -114.32, 66.00 , -129.90, 75.00 ),
(28, 'A', 300, 5, 19.11, 180.40, 198.40, 189.40, 319.11, -118.09, 136.38 , -129.87, 149.98 ),
(29, 'A', 300, 4, 40.89, 180.40, 198.40, 189.40, 340.89, -59.06 , 170.46 , -64.95 , 187.47 ),
(30, 'A', 300, 3, 30.00, 111.90, 129.90, 120.90, 330.00, -55.95 , 96.91 , -64.95 , 112.5 ),
)
###################################################################################################
@@ -61,12 +62,15 @@ class Puck:
self.center = center
self.led_uni = led_uni
self.led_mini = led_mini
self.detect = None
self.detect = DET_UNKNOWN
def __str__(self):
return "Number: " + str(self.id) + "\nBlock: " + str(self.block) + "\nIndex: " + str(self.index) + "\nAngle: " + str(self.angle) + \
"\nCenter: " + str(self.center) + "\nLed Unipuck: " + str(self.led_uni) + "\nLed Minispine: " + str(self.led_mini)
def get_name(self):
return str(self.block) + str(self.index)
def match(self, x, y):
if math.hypot(x-self.led_uni[0], y-self.led_uni[1]) <= LED_TOLERANCE:
return DET_UNIPUCK
@@ -168,14 +172,15 @@ def detect_pucks(point_list, id=None):
def clear_detection(block_id=None):
for puck in get_pucks(block_id):
puck.detect = DET_ERROR
puck.detect = DET_UNKNOWN
return get_puck_detection_dict(block_id)
def get_puck_detection(det_type, block_id=None):
ret = []
for puck in get_pucks(block_id):
if puck.detect == det_type:
ret.append(puck.id)
ret.append(puck)
return ret
def get_unipucks(block_id=None):
@@ -187,17 +192,51 @@ def get_minispines(block_id=None):
def get_empties(block_id=None):
return get_puck_detection(DET_EMPTY, block_id)
def get_unknowns(block_id=None):
return get_puck_detection(DET_UNKNOWN, block_id)
def get_det_errors(block_id=None):
return get_puck_detection(DET_ERROR, block_id)
def get_puck_detection_dict(block_id):
ret = {}
pucks = []
for puck in get_unipucks(block_id):
pucks.append(puck.get_name())
pucks.sort()
ret["Unipuck"] = pucks
pucks = []
for puck in get_minispines(block_id):
pucks.append(puck.get_name())
pucks.sort()
ret["Minispine"] = pucks
pucks = []
for puck in get_det_errors(block_id):
pucks.append(puck.get_name())
pucks.sort()
ret["Error"] = pucks
pucks = []
for puck in get_empties(block_id):
pucks.append(puck.get_name())
pucks.sort()
ret["Empty"] = pucks
pucks = []
for puck in get_unknowns(block_id):
pucks.append(puck.get_name())
pucks.sort()
ret["Unknown"] = pucks
return ret
###################################################################################################
#Plotting
###################################################################################################
from plotutils import *
def plot_base_plate(points = None, show_detect = True, title = None):
def plot_base_plate(points = None, show_detect = True, title = None, p = None):
colors = (Color.RED, Color.BLUE, Color.MAGENTA, Color(128,0,128), Color(0,128,0), Color(255,128,0))
p = plot(None, title=title)[0]
if p is None: p = plot(None, title=title)[0]
p.getAxis(p.AxisId.Y).setInverted(True)
plot_circle(p, 0, 0, PLATE_SIZE/2, width = 0, color = Color.GRAY, name = "Plate")
plot_point(p, 0, 0, size = 10, color = Color.GRAY, name = "Center")
#p.setLegendVisible(True)
@@ -206,10 +245,11 @@ def plot_base_plate(points = None, show_detect = True, title = None):
(ymin, ymax) = block.y_range
(xmin, ymin, xmax, ymax ) = block.roi
index = get_blocks().index(block)
r = plot_rectangle(p, xmin, ymin, xmax, ymax, width =1, color=colors[index], name = block.id)
r = plot_rectangle(p, xmin, ymin, xmax, ymax, width =0, color=colors[index], name = block.id)
#In the first time the plot shows, it takes some time for the color to be assigned
#while r.color is None:
# time.sleep(0.001)
if block.id in ('A', 'F'):
x, y = (xmin + xmax)/2, ymax + 5
elif block.id in ('C', 'D'):
@@ -218,9 +258,9 @@ def plot_base_plate(points = None, show_detect = True, title = None):
x, y = xmax + 5, (ymin + ymax)/2
elif block.id == 'E':
x, y = xmin - 5, (ymin + ymax)/2
p.addText(x,y, str(block.id), r.color)
for puck in get_pucks(block.id):
(xu, yu) = puck.led_uni
(xm, ym) = puck.led_mini
@@ -250,5 +290,3 @@ def plot_base_plate(points = None, show_detect = True, title = None):
plot_cross(p,point[0], point[1], size = 12, width = w, color = c, name = "P"+ str(points.index(point)))
#plot_point(p,point[0], point[1], size = 5, color = Color.BLACK, name = "Pc"+ str(points.index(point)))

View File

@@ -0,0 +1,19 @@
ca = []
aa = []
pa = []
#for i in range(6):
#index = i+1
for i in ['A', 'B', 'C', 'D', 'E', 'F']:
hexiposi.move(i)
[position, angle, confidence] = run("imgproc/CoverDetection2")
print [position, angle, confidence]
pa.append(position)
aa.append(angle)
ca.append(confidence)
print "---"
print "Position: " ,pa
print "Angle: " ,aa
print "Confidence: " ,ca, " mean: ", mean(ca)