This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
img=ch.psi.pshell.prosilica.Prosilica|25001 "PacketSize=1522;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=300;RegionY=200;Width=1000;Height=1000;MulticastEnable=Off"|||false
|
||||
gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://129.129.110.114/axis-cgi/mjpg/video.cgi||-1|
|
||||
microscan=ch.psi.pshell.serial.TcpDevice|129.129.110.200:2001|||
|
||||
microscan_cmd=ch.psi.pshell.serial.TcpDevice|129.129.110.200:2003|||
|
||||
gripper_cam=ch.psi.pshell.imaging.MjpegSource|http://axis-accc8e9cc87b.psi.ch/axis-cgi/mjpg/video.cgi?camera=1||-1|
|
||||
microscan=ch.psi.pshell.serial.TcpDevice|MicroHAWK38C528:2001|||
|
||||
microscan_cmd=ch.psi.pshell.serial.TcpDevice|MicroHAWK38C528:2003|||
|
||||
ue=LaserUE|COM4|||false
|
||||
#robot=RobotTcp|127.0.0.1:1000|||
|
||||
#onewire=ch.psi.pshell.serial.TcpDevice|129.129.126.83:5000|||
|
||||
puck_detection=ch.psi.mxsc.PuckDetection|tell-raspberrypi:5556|||
|
||||
#robot_modbus=ch.psi.pshell.modbus.ModbusTCP|129.129.126.100:502|||
|
||||
#onewire=ch.psi.pshell.serial.TcpDevice|129.129.126.83:5000|||
|
||||
#robot=RobotTcp|127.0.0.1:1000|||
|
||||
#$robot_modbus=ch.psi.pshell.modbus.ModbusTCP|129.129.126.100:502|||
|
||||
#jf1=ch.psi.pshell.modbus.AnalogInput|robot_modbus 0||100|
|
||||
#jf2=ch.psi.pshell.modbus.AnalogInput|robot_modbus 1||100|
|
||||
#jf3=ch.psi.pshell.modbus.AnalogInput|robot_modbus 2||100|
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Tue Jun 19 16:41:20 CEST 2018
|
||||
#Wed Aug 08 14:23:54 CEST 2018
|
||||
offset=-25.81632
|
||||
precision=2
|
||||
scale=0.003888
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Thu Jun 14 10:54:07 CEST 2018
|
||||
#Wed Aug 08 11:53:16 CEST 2018
|
||||
colormap=Grayscale
|
||||
colormapAutomatic=false
|
||||
colormapMax=18.133
|
||||
@@ -9,16 +9,16 @@ grayscale=false
|
||||
invert=false
|
||||
rescaleFactor=1.0
|
||||
rescaleOffset=0.0
|
||||
roiHeight=872
|
||||
roiWidth=869
|
||||
roiX=74
|
||||
roiHeight=-1
|
||||
roiWidth=-1
|
||||
roiX=0
|
||||
roiY=0
|
||||
rotation=17.93079800677477
|
||||
rotation=0.0
|
||||
rotationCrop=true
|
||||
scale=1.0
|
||||
spatialCalOffsetX=-435.0
|
||||
spatialCalOffsetY=-436.0
|
||||
spatialCalScaleX=0.540300793168967
|
||||
spatialCalScaleY=0.5385447475747382
|
||||
spatialCalOffsetX=NaN
|
||||
spatialCalOffsetY=NaN
|
||||
spatialCalScaleX=NaN
|
||||
spatialCalScaleY=NaN
|
||||
spatialCalUnits=mm
|
||||
transpose=false
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Fri Jun 29 16:49:51 CEST 2018
|
||||
#Wed Aug 08 14:23:56 CEST 2018
|
||||
maxValue=0.4
|
||||
minValue=0.0
|
||||
offset=0.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Fri Jun 29 16:49:51 CEST 2018
|
||||
#Wed Aug 08 14:23:56 CEST 2018
|
||||
maxValue=0.4
|
||||
minValue=0.0
|
||||
offset=0.0
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#Fri Jun 29 16:49:51 CEST 2018
|
||||
#Wed Aug 08 14:23:56 CEST 2018
|
||||
maxValue=0.4
|
||||
minValue=0.0
|
||||
offset=0.0
|
||||
|
||||
Binary file not shown.
@@ -18,27 +18,36 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="ledLidControlActive" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ledKnownPosition" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textPosition" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="ledLidInitialized" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ledValidSegment" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
|
||||
<Component id="textSegment" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace pref="96" max="32767" attributes="0"/>
|
||||
<Component id="buttonInitHexiposi" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="136" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="buttonAbort" linkSize="1" min="-2" pref="73" max="-2" attributes="0"/>
|
||||
<Component id="buttonRecover" linkSize="1" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="144" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="116" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -47,44 +56,66 @@
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="ledLidControlActive" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="ledKnownPosition" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textPosition" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="ledLidInitialized" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="ledValidSegment" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel7" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="textSegment" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="buttonInitHexiposi" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonRecover" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="buttonAbort" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="ch.psi.pshell.swing.Led" name="ledLidControlActive">
|
||||
<Component class="ch.psi.pshell.swing.Led" name="ledKnownPosition">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel6">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Known position"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="ch.psi.pshell.swing.Led" name="ledLidInitialized">
|
||||
<Component class="ch.psi.pshell.swing.Led" name="ledValidSegment">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel7">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Valid segment"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonInitHexiposi">
|
||||
<Component class="javax.swing.JButton" name="buttonRecover">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Recover"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRecoverActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonAbort">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Abort"/>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonInitHexiposiActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAbortActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textPosition">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="textSegment">
|
||||
<Properties>
|
||||
<Property name="editable" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -13,6 +15,7 @@ public class Recovery extends Panel {
|
||||
|
||||
public Recovery() {
|
||||
initComponents();
|
||||
startTimer(3000, 200);
|
||||
}
|
||||
|
||||
//Overridable callbacks
|
||||
@@ -23,83 +26,80 @@ public class Recovery extends Panel {
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
updateButton();
|
||||
}
|
||||
|
||||
void updateButton(){
|
||||
buttonRecover.setEnabled((getContext().getState() == State.Ready) &&
|
||||
(!textSegment.getText().trim().isEmpty()) &&
|
||||
(textPosition.getText().trim().isEmpty()) );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecutedFile(String fileName, Object result) {
|
||||
}
|
||||
|
||||
//Callback to perform update - in event thread
|
||||
@Override
|
||||
protected void doUpdate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void execute(String statement){
|
||||
execute(statement, false);
|
||||
}
|
||||
|
||||
void execute(String statement, boolean background){
|
||||
execute(statement, background, false);
|
||||
}
|
||||
|
||||
void execute(String statement, boolean background, boolean showReturn){
|
||||
try {
|
||||
evalAsync(statement, background).handle((ret, ex) -> {
|
||||
if (ex != null){
|
||||
showException((Exception)ex);
|
||||
} else if (showReturn){
|
||||
SwingUtils.showMessage(getTopLevel(), "Return", String.valueOf(ret));
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
protected void onTimer() {
|
||||
try{
|
||||
List segment = (List) eval("get_current_segment()", true);
|
||||
ledValidSegment.setColor((segment == null) ? Color.RED : Color.GREEN);
|
||||
textSegment.setText((segment == null) ? "": segment.get(0) + "->" + segment.get(1) + " [" + segment.get(2) + "mm]");
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
System.out.println(ex);
|
||||
ledValidSegment.setColor(Color.BLACK);
|
||||
textSegment.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
void execute(String script, Object args){
|
||||
try {
|
||||
runAsync(script, args).handle((ret, ex) -> {
|
||||
if (ex != null){
|
||||
showException((Exception)ex);
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
try{
|
||||
String point = (String) eval("robot.get_current_point()", true);
|
||||
ledKnownPosition.setColor((point == null) ? Color.RED : Color.GREEN);
|
||||
textPosition.setText((point == null) ? "": point);
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
System.out.println(ex);
|
||||
ledKnownPosition.setColor(Color.BLACK);
|
||||
textPosition.setText("");
|
||||
}
|
||||
updateButton();
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
ledLidControlActive = new ch.psi.pshell.swing.Led();
|
||||
ledKnownPosition = new ch.psi.pshell.swing.Led();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
ledLidInitialized = new ch.psi.pshell.swing.Led();
|
||||
ledValidSegment = new ch.psi.pshell.swing.Led();
|
||||
jLabel7 = new javax.swing.JLabel();
|
||||
buttonInitHexiposi = new javax.swing.JButton();
|
||||
buttonRecover = new javax.swing.JButton();
|
||||
buttonAbort = new javax.swing.JButton();
|
||||
textPosition = new javax.swing.JTextField();
|
||||
textSegment = new javax.swing.JTextField();
|
||||
|
||||
jLabel6.setText("Known position");
|
||||
|
||||
jLabel7.setText("Valid segment");
|
||||
|
||||
buttonInitHexiposi.setText("Recover");
|
||||
buttonInitHexiposi.setEnabled(false);
|
||||
buttonInitHexiposi.addActionListener(new java.awt.event.ActionListener() {
|
||||
buttonRecover.setText("Recover");
|
||||
buttonRecover.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonInitHexiposiActionPerformed(evt);
|
||||
buttonRecoverActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonAbort.setText("Abort");
|
||||
buttonAbort.setEnabled(false);
|
||||
buttonAbort.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonAbortActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
textPosition.setEditable(false);
|
||||
|
||||
textSegment.setEditable(false);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -110,48 +110,98 @@ public class Recovery extends Panel {
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(ledLidControlActive, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(ledKnownPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel6))
|
||||
.addComponent(jLabel6)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(textPosition))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(ledLidInitialized, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(ledValidSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel7))))
|
||||
.addComponent(jLabel7)
|
||||
.addGap(16, 16, 16)
|
||||
.addComponent(textSegment)))
|
||||
.addGap(8, 8, 8))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap(96, Short.MAX_VALUE)
|
||||
.addComponent(buttonInitHexiposi)))
|
||||
.addContainerGap(116, Short.MAX_VALUE))
|
||||
.addContainerGap(136, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(buttonAbort, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonRecover))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 144, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonAbort, buttonRecover});
|
||||
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(ledLidControlActive, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel6))
|
||||
.addComponent(ledKnownPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel6)
|
||||
.addComponent(textPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(ledLidInitialized, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel7))
|
||||
.addComponent(ledValidSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel7)
|
||||
.addComponent(textSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(buttonInitHexiposi)
|
||||
.addComponent(buttonRecover)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(buttonAbort)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonInitHexiposiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonInitHexiposiActionPerformed
|
||||
private void buttonRecoverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRecoverActionPerformed
|
||||
try{
|
||||
this.showDevicePanel("hexiposi");
|
||||
buttonAbort.setEnabled(true);
|
||||
evalAsync("recover()", false).handle((ret, ex) -> {
|
||||
if (ex != null){
|
||||
showException((Exception)ex);
|
||||
} else {
|
||||
SwingUtils.showMessage(getTopLevel(), "Return", String.valueOf(ret));
|
||||
}
|
||||
buttonAbort.setEnabled(false);
|
||||
return ret;
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonInitHexiposiActionPerformed
|
||||
}//GEN-LAST:event_buttonRecoverActionPerformed
|
||||
|
||||
private void buttonAbortActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAbortActionPerformed
|
||||
try {
|
||||
abort();
|
||||
try{
|
||||
eval("robot.disable()", true);
|
||||
} catch (Exception ex){
|
||||
this.showException(ex);
|
||||
}
|
||||
try{
|
||||
eval("stop_task()", true);
|
||||
} catch (Exception ex){
|
||||
this.showException(ex);
|
||||
}
|
||||
try{
|
||||
eval("robot.reset_motion()", true);
|
||||
} catch (Exception ex){
|
||||
this.showException(ex);
|
||||
}
|
||||
} catch (InterruptedException ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonAbortActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonInitHexiposi;
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.JButton buttonRecover;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private ch.psi.pshell.swing.Led ledLidControlActive;
|
||||
private ch.psi.pshell.swing.Led ledLidInitialized;
|
||||
private ch.psi.pshell.swing.Led ledKnownPosition;
|
||||
private ch.psi.pshell.swing.Led ledValidSegment;
|
||||
private javax.swing.JTextField textPosition;
|
||||
private javax.swing.JTextField textSegment;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
||||
4
script/data/get_samples_info.py
Normal file
4
script/data/get_samples_info.py
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
|
||||
set_return(get_samples_info(as_json=False))
|
||||
23
script/data/samples.py
Normal file
23
script/data/samples.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import json
|
||||
import org.python.core.PyDictionary as PyDictionary
|
||||
|
||||
|
||||
samples_info = []
|
||||
|
||||
def set_samples_info(info):
|
||||
global samples_info
|
||||
if (is_string(info)):
|
||||
info = json.loads(info)
|
||||
if not is_list(info):
|
||||
raise Exception("Sample info must be a list (given object type is " + str(type(info)) + ")")
|
||||
#for sample in info:
|
||||
# if not (type(sample) is PyDictionary):
|
||||
# raise Exception("Sample info element must be a dictionary (given object type is " + str(type(sample)) + ")")
|
||||
samples_info = info
|
||||
return samples_info
|
||||
|
||||
|
||||
|
||||
def get_samples_info(as_json=True):
|
||||
global sample_info
|
||||
return json.dumps(samples_info) if as_json else samples_info
|
||||
4
script/data/set_samples_info.py
Normal file
4
script/data/set_samples_info.py
Normal file
@@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
|
||||
set_samples_info(args[0])
|
||||
@@ -127,7 +127,7 @@ class Hexiposi(DiscretePositionerBase):
|
||||
|
||||
|
||||
|
||||
#http://129.129.110.83:8002/hexiposi/get
|
||||
#http://myriotell:8002/hexiposi/get
|
||||
dev = Hexiposi("hexiposi", "myriotell:8002/hexiposi")
|
||||
|
||||
add_device(dev, True)
|
||||
|
||||
@@ -210,13 +210,19 @@ class RobotSC(RobotTCP):
|
||||
robot.waitState(State.Ready, 1000) #robot.state.assertReady()
|
||||
|
||||
if simulation:
|
||||
#add_device(RobotSC("robot","129.129.126.92:1000"),force = True)
|
||||
add_device(RobotSC("robot","129.129.110.81:1000"),force = True)
|
||||
add_device(RobotSC("robot","localhost:1000"),force = True)
|
||||
else:
|
||||
add_device(RobotSC("robot", "129.129.110.100:1000"), force = True)
|
||||
#add_device(RobotSC("robot", "129.129.243.120:1000"), force = True)
|
||||
#add_device(RobotSC("robot", "pcp068129.psi.ch:1000"), force = True)
|
||||
#add_device(RobotSC("robot", "saresb-cons-06.psi.ch:1000"), force = True)
|
||||
add_device(RobotSC("robot", "129.129.243.90:1000"), force = True)
|
||||
|
||||
|
||||
#robot.set_monitor_speed(20)
|
||||
robot.set_default_desc(DESC_DEFAULT)
|
||||
robot.default_speed = 20
|
||||
robot.set_tool(TOOL_DEFAULT)
|
||||
robot.setPolling(DEFAULT_ROBOT_POLLING)
|
||||
|
||||
|
||||
|
||||
class jf1(ReadonlyRegisterBase):
|
||||
|
||||
@@ -45,7 +45,8 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
self.frame = FRAME_DEFAULT
|
||||
self.polling_interval = 0.01
|
||||
self.reset = True
|
||||
self.default_tolerance = 10
|
||||
self.default_tolerance = 10
|
||||
self.default_speed = 100
|
||||
|
||||
self.task_start_retries = 3
|
||||
self.exception_on_task_start_failure = True #Tasks may start and be finished when checked
|
||||
@@ -68,8 +69,11 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
return self.tool
|
||||
|
||||
|
||||
def assert_tool(self, tool):
|
||||
if self.tool != tool:
|
||||
def assert_tool(self, tool=None):
|
||||
if tool is None:
|
||||
if self.tool is None:
|
||||
raise Exception("Tool is undefined")
|
||||
elif self.tool != tool:
|
||||
raise Exception("Invalid tool: " + self.tool)
|
||||
|
||||
def set_default_desc(self,default_desc):
|
||||
@@ -213,11 +217,13 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
|
||||
def get_tool_trsf(self, name=None):
|
||||
if name is None:
|
||||
self.assert_tool()
|
||||
name = self.tool
|
||||
return self.get_trsf(name+".trsf")
|
||||
|
||||
def set_tool_trsf(self, trsf, name=None):
|
||||
if name is None:
|
||||
self.assert_tool()
|
||||
name = self.tool
|
||||
self.set_trsf(trsf, name+".trsf")
|
||||
|
||||
@@ -275,9 +281,12 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
if (ret==-1): raise Exception("The robot is not in remote working mode")
|
||||
if (ret==-2): raise Exception("The monitor speed is under the control of the operator")
|
||||
if (ret==-3): raise Exception("The specified speed is not supported")
|
||||
|
||||
def set_default_speed(self):
|
||||
set_monitor_speed(self.default_speed)
|
||||
|
||||
def is_calibrated(self):
|
||||
return self.eval_bool("isCalibrated()")
|
||||
return self.eval_bool("isCalibrated()")
|
||||
|
||||
def save_program(self):
|
||||
ret = self.execute('save', timeout=5000)
|
||||
@@ -367,6 +376,10 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
def movej(self, joint_or_point, tool=None, desc=None, sync=False):
|
||||
if desc is None: desc = self.default_desc
|
||||
if tool is None: tool = self.tool
|
||||
#If joint_or_point is a list assumes ir is a point
|
||||
if not is_string(point):
|
||||
robot.set_pnt(joint_or_point , "tcp_p")
|
||||
joint_or_point = "tcp_p"
|
||||
ret = self.eval_int("movej(" + joint_or_point + ", " + tool + ", " + desc +")")
|
||||
if sync:
|
||||
self.wait_end_of_move()
|
||||
@@ -375,6 +388,9 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
def movel(self, point, tool=None, desc=None, sync=False):
|
||||
if desc is None: desc = self.default_desc
|
||||
if tool is None: tool = self.tool
|
||||
if not is_string(point):
|
||||
robot.set_pnt(point , "tcp_p")
|
||||
point = "tcp_p"
|
||||
ret = self.eval_int("movel(" + point + ", " + tool + ", " + desc +")")
|
||||
if sync:
|
||||
self.wait_end_of_move()
|
||||
@@ -588,13 +604,15 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
def get_flange_pos(self):
|
||||
return self.eval_pnt("jointToPoint(" +FLANGE + ", " + self.frame + ", herej())")
|
||||
|
||||
def get_cartesian_pos(self):
|
||||
def get_cartesian_pos(self):
|
||||
self.assert_tool()
|
||||
return self.eval_pnt("jointToPoint(" + self.tool + ", " + self.frame + ", herej())")
|
||||
#self.set_jnt(self.herej())
|
||||
#return self.joint_to_point(tool, frame)
|
||||
|
||||
def get_cartesian_destination(self):
|
||||
return self.here(self.tool, self.frame)
|
||||
self.assert_tool()
|
||||
return self.here(self.tool, self.frame)
|
||||
|
||||
def get_distance_to_pnt(self, name):
|
||||
#self.here(self.tool, self.frame) #???
|
||||
@@ -672,6 +690,7 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
m.initialize()
|
||||
#Alignment
|
||||
def align(self, point = None, frame = FRAME_DEFAULT, desc = None):
|
||||
self.assert_tool()
|
||||
if desc is None: desc = self.default_desc
|
||||
if point is None:
|
||||
self.get_cartesian_pos()
|
||||
|
||||
@@ -5,6 +5,7 @@ import traceback
|
||||
from ch.psi.pshell.serial import TcpDevice
|
||||
from ch.psi.pshell.modbus import ModbusTCP
|
||||
import ch.psi.mxsc.Controller as Controller
|
||||
import ch.psi.pshell.core.Nameable as Nameable
|
||||
|
||||
|
||||
run("setup/Layout")
|
||||
@@ -29,6 +30,7 @@ add_device(img.getCamera(), force = True)
|
||||
# Utility modules
|
||||
###################################################################################################
|
||||
|
||||
run("data/samples")
|
||||
run("motion/tools")
|
||||
run("motion/mount")
|
||||
run("motion/unmount")
|
||||
@@ -45,6 +47,7 @@ run("motion/move_scanner")
|
||||
run("motion/dry")
|
||||
run("motion/homing_hexiposi")
|
||||
run("motion/robot_recover")
|
||||
run("motion/recover")
|
||||
run("imgproc/Utils")
|
||||
run("tools/Math")
|
||||
|
||||
@@ -81,10 +84,6 @@ def check_puck_detection():
|
||||
def stop_puck_detection():
|
||||
run("tools/StopPuckDetection")
|
||||
|
||||
DEWAR_LEVEL_RT = 5.0
|
||||
|
||||
def is_room_temp():
|
||||
return dewar_level.read() <= DEWAR_LEVEL_RT
|
||||
|
||||
|
||||
###################################################################################################
|
||||
@@ -111,7 +110,7 @@ except:
|
||||
|
||||
try:
|
||||
robot.setPolling(DEFAULT_ROBOT_POLLING)
|
||||
robot.set_tool(TOOL_CALIBRATION)
|
||||
robot.set_tool(TOOL_DEFAULT)
|
||||
robot.set_motors_enabled(True)
|
||||
robot.set_joint_motors_enabled(True)
|
||||
except:
|
||||
@@ -143,6 +142,36 @@ except:
|
||||
|
||||
#gripper_cam.paused = True
|
||||
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Device monitoring
|
||||
###################################################################################################
|
||||
|
||||
DEWAR_LEVEL_RT = 5.0
|
||||
is_room_temperature = False
|
||||
|
||||
def is_room_temp():
|
||||
return is_room_temperature
|
||||
|
||||
|
||||
class DewarLevelListener (DeviceListener):
|
||||
def onValueChanged(self, device, value, former):
|
||||
global is_room_temperature
|
||||
if value is not None:
|
||||
is_room_temperature = value <= DEWAR_LEVEL_RT
|
||||
dewar_level_listener = DewarLevelListener()
|
||||
|
||||
for l in dewar_level.listeners:
|
||||
#if isinstance(l, DewarLevelListener): #Class changes...
|
||||
if Nameable.getShortClassName(l.getClass()) == "DewarLevelListener":
|
||||
dewar_level.removeListener(l)
|
||||
|
||||
dewar_level.addListener(dewar_level_listener)
|
||||
dewar_level_listener.onValueChanged(dewar_level, dewar_level.take(), None)
|
||||
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# Global variables
|
||||
###################################################################################################
|
||||
|
||||
@@ -1,5 +1,109 @@
|
||||
def recover():
|
||||
"""
|
||||
"""
|
||||
print "recover"
|
||||
import org.apache.commons.math3.geometry.euclidean.threed.Segment as Segment
|
||||
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D as Vector3D
|
||||
import org.apache.commons.math3.geometry.euclidean.threed.Line as Line3D
|
||||
|
||||
|
||||
known_segments = [ ("pHome", "pPark", 10), \
|
||||
("pHome", "pDewarHome", 10), \
|
||||
("pHome", "pGonioHome", 10), \
|
||||
("pHome", "pScanHome", 10), \
|
||||
("pHome", "pHeaterHome", 10), \
|
||||
("pDewarHome", "pDewarWait", 10), \
|
||||
("pGonioHome", "pGonioGet", 10), \
|
||||
("pHeaterHome", "pHeater", 10), \
|
||||
("pHeater", "pHeaterBottom", 10), \
|
||||
]
|
||||
|
||||
|
||||
def is_on_segment(segment):
|
||||
tolerance = segment[2]
|
||||
p1, p2 = robot.get_pnt(segment[0]), robot.get_pnt(segment[1])
|
||||
p = robot.get_cartesian_pos()
|
||||
v = Vector3D(p[0], p[1], p[2])
|
||||
v1 = Vector3D(p1[0], p1[1], p1[2])
|
||||
v2 = Vector3D(p2[0], p2[1], p2[2])
|
||||
l = Line3D(v1, v2, 0.01)
|
||||
|
||||
#Check if on segment
|
||||
d = l.distance(v)
|
||||
if d > tolerance:
|
||||
#print "Current robot position " + str(p) + " not on segment " + str(segment) + " - distance=" + str(d)
|
||||
return False
|
||||
|
||||
# Check if inside segment
|
||||
d1, d2 = v1.distance(v), v2.distance(v)
|
||||
if d1>d2:
|
||||
d1, d2 = d2, d1
|
||||
d1, d2 = d1, d2
|
||||
if d<(d1-tolerance) or d>(d2+tolerance):
|
||||
#print "Current robot position " + str(p) + " not on segment " + str((d1, d2)) + " of segment " + str(segment) + " - distance=" + str(d)
|
||||
return False
|
||||
#print "Current robot position " + str(p) + " on segment " + str(segment) + " - distance=" + str(d)
|
||||
return True
|
||||
|
||||
def get_current_segment():
|
||||
for segment in known_segments:
|
||||
if is_on_segment(segment):
|
||||
return segment
|
||||
return None
|
||||
|
||||
def move_to_segment(segment):
|
||||
tolerance = segment[2]
|
||||
p1, p2 = robot.get_pnt(segment[0]), robot.get_pnt(segment[1])
|
||||
p = robot.get_cartesian_pos()
|
||||
v = Vector3D(p[0], p[1], p[2])
|
||||
v1 = Vector3D(p1[0], p1[1], p1[2])
|
||||
v2 = Vector3D(p2[0], p2[1], p2[2])
|
||||
l = Line3D(v1, v2, 0.01)
|
||||
|
||||
a = l.getAbscissa(v)
|
||||
lv = l.pointAt(a)
|
||||
dlv = lv.distance(v)
|
||||
if dlv> (tolerance + 0.1):
|
||||
raise Exception( "Error moving from " + str(p) + " to segment - distance=" + str(dlv))
|
||||
d = [lv.x, lv.y, lv.z, p[3], p[4], p[5]]
|
||||
print "Moving from " + str(p) + " to segment " + str(segment) + " - distance=" + str(dlv) + " - dest=" + str(d)
|
||||
robot.movel(d, tool=None, desc=DESC_SLOW, sync=True)
|
||||
|
||||
|
||||
#Moves to first point of the segment ehich is safer, unless in the vicinity of the second
|
||||
def move_to_safest_point(segment, vicinity_tolerance = 100):
|
||||
d1, d2 = robot.get_distance_to_pnt(segment[0]), robot.get_distance_to_pnt(segment[1])
|
||||
if (d2<=d1) and (d2 <= vicinity_tolerance):
|
||||
robot.movel(segment[1], tool=None, desc=DESC_SLOW, sync=True)
|
||||
else:
|
||||
robot.movel(segment[0], tool=None, desc=DESC_SLOW, sync=True)
|
||||
#print "Recovered to point " + str(robot.get_current_point())
|
||||
|
||||
|
||||
def recover():
|
||||
#Initial checks
|
||||
robot.assert_no_task()
|
||||
robot.reset_motion()
|
||||
robot.wait_ready()
|
||||
|
||||
if robot.get_current_point() is not None:
|
||||
raise Exception("Robot is in known location")
|
||||
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
|
||||
is_on_known_segment = False
|
||||
for segment in known_segments:
|
||||
if is_on_segment(segment):
|
||||
#try:
|
||||
# robot.set_monitor_speed(5)
|
||||
is_on_known_segment = True
|
||||
move_to_segment(segment)
|
||||
move_to_safest_point(segment)
|
||||
return "Success recovering to point: " + str(robot.get_current_point())
|
||||
#finally:
|
||||
# robot.set_default_speed()
|
||||
if not is_on_known_segment:
|
||||
raise Exception("Robot is not in known segment")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ch.psi.pshell.imaging.MjpegSource as MjpegSource
|
||||
MjpegSource2 = get_context().pluginManager.getDynamicClass("MjpegSource2")
|
||||
add_device(MjpegSource("gripper_cam", "http://129.129.110.114/axis-cgi/mjpg/video.cgi"), True)
|
||||
add_device(MjpegSource("gripper_cam", "http://axis-accc8e9cc87b.psi.ch/axis-cgi/mjpg/video.cgi"), True)
|
||||
#gripper_cam.polling=1000
|
||||
gripper_cam.monitored = True
|
||||
show_panel(gripper_cam)
|
||||
23
script/test/TestEuclidean.py
Normal file
23
script/test/TestEuclidean.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import org.apache.commons.math3.geometry.euclidean.threed.Segment as Segment
|
||||
import org.apache.commons.math3.geometry.euclidean.threed.Vector3D as Vector3D
|
||||
import org.apache.commons.math3.geometry.euclidean.threed.Line as Line
|
||||
|
||||
|
||||
p = Vector3D(0, 0, 3)
|
||||
|
||||
p1 = Vector3D(0,0,0)
|
||||
p2 = Vector3D(0,1,1 )
|
||||
tolerance = 0.001
|
||||
|
||||
l = Line(p1, p2, tolerance)
|
||||
|
||||
|
||||
print l.distance(p)
|
||||
print p1.distance(p)
|
||||
print p2.distance(p)
|
||||
print "---"
|
||||
|
||||
print l.getAbscissa(p)
|
||||
print l.pointAt(l.getAbscissa(p))
|
||||
|
||||
#print l.closestPoint(Line(p, p, 0.01))
|
||||
@@ -2,8 +2,8 @@ import ch.psi.pshell.serial.TcpDevice as TcpDevice
|
||||
import ch.psi.pshell.serial.UdpDevice as UdpDevice
|
||||
|
||||
|
||||
microscan = TcpDevice("microscan", "129.129.126.200:2001")
|
||||
#microscan = UdpDevice("microscan", "129.129.126.200:2001")
|
||||
microscan = TcpDevice("microscan", "MicroHAWK38C528:2001")
|
||||
#microscan = UdpDevice("microscan", "MicroHAWK38C528:2001")
|
||||
microscan.initialize()
|
||||
|
||||
|
||||
|
||||
15
script/test/TestRecover.py
Normal file
15
script/test/TestRecover.py
Normal file
@@ -0,0 +1,15 @@
|
||||
print "Pos=" + str(robot.get_cartesian_pos())
|
||||
for p in robot.get_known_points():
|
||||
print p + " = " + str(get_pnt(p))
|
||||
|
||||
print "-------------"
|
||||
|
||||
for segment in known_segments:
|
||||
is_on_segment(segment)
|
||||
|
||||
print "-------------"
|
||||
for segment in known_segments:
|
||||
try:
|
||||
move_to_segment(segment)
|
||||
except:
|
||||
print sys.exc_info()[1]
|
||||
Reference in New Issue
Block a user