This commit is contained in:
gac-S_Changer
2018-06-29 11:27:20 +02:00
parent 51858eb819
commit 4371d9c6d8
38 changed files with 379 additions and 61 deletions

View File

@@ -1,5 +1,5 @@
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|
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||100|
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

View File

@@ -1,3 +1,4 @@
MjpegSource2.java=enabled
MXSC-1.10.0.jar=enabled
LN2.java=enabled
Hexiposi.java=enabled

View File

@@ -1,4 +1,4 @@
#Thu Mar 01 15:25:39 CET 2018
#Wed Jun 27 10:48:14 CEST 2018
maxValue=NaN
minValue=NaN
offset=0.0
@@ -6,4 +6,5 @@ precision=-1
resolution=NaN
rotation=false
scale=1.0
sign_bit=0
unit=null

View File

@@ -1,4 +1,4 @@
#Mon Jun 18 11:16:55 CEST 2018
#Thu Jun 28 17:46:46 CEST 2018
flipHorizontally=false
flipVertically=false
grayscale=false

View File

@@ -1,5 +1,5 @@
#Tue Jun 19 16:41:20 CEST 2018
maxValue=0.4
#Wed Jun 27 09:59:11 CEST 2018
maxValue=1.0
minValue=0.0
offset=0.0
precision=2

View File

@@ -1,5 +1,5 @@
#Tue Jun 19 16:41:20 CEST 2018
maxValue=0.4
#Wed Jun 27 09:59:11 CEST 2018
maxValue=1.0
minValue=0.0
offset=0.0
precision=2

View File

@@ -1,5 +1,5 @@
#Tue Jun 19 16:41:20 CEST 2018
maxValue=0.4
#Wed Jun 27 09:59:11 CEST 2018
maxValue=1.0
minValue=0.0
offset=0.0
precision=2

View File

@@ -1,6 +1,6 @@
#Fri Jun 22 11:07:01 CEST 2018
holdingCurrent=10.0
#Wed Jun 27 10:45:31 CEST 2018
holdingCurrent=25.0
mountCurrent=35.0
remanenceCurrent=-10.0
restingCurrent=5.0
unmountCurrent=2.5
restingCurrent=10.0
unmountCurrent=5.0

View File

@@ -49,7 +49,7 @@
<Component id="panelRobot1" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="29" max="32767" attributes="0"/>
<EmptySpace pref="23" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -383,6 +383,7 @@
<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"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
@@ -390,6 +391,7 @@
<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"/>
<Component id="checkDatamatrix" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
@@ -418,7 +420,12 @@
<Component id="jLabel4" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="checkForce" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="2" attributes="0">
<Component id="jLabel5" alignment="2" min="-2" max="-2" attributes="0"/>
<Component id="checkDatamatrix" alignment="2" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -477,6 +484,16 @@
<Property name="text" type="java.lang.String" value="Sample:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="Read DM:"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="checkDatamatrix">
<Properties>
<Property name="horizontalTextPosition" type="int" value="10"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="buttonMovePark">

View File

@@ -114,6 +114,8 @@ public class Expert extends Panel {
jLabel2 = new javax.swing.JLabel();
spinnerSegment = new javax.swing.JSpinner();
jLabel3 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
checkDatamatrix = new javax.swing.JCheckBox();
buttonMovePark = new javax.swing.JButton();
buttonHomingHexiposi = new javax.swing.JButton();
buttonMoveHome = new javax.swing.JButton();
@@ -309,6 +311,10 @@ public class Expert extends Panel {
jLabel3.setText("Sample:");
jLabel5.setText("Read DM:");
checkDatamatrix.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
@@ -319,13 +325,15 @@ public class Expert extends Panel {
.addComponent(jLabel3)
.addComponent(jLabel2)
.addComponent(jLabel1)
.addComponent(jLabel4))
.addComponent(jLabel4)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(checkForce)
.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(spinnerSegment, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(checkDatamatrix))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@@ -352,7 +360,11 @@ public class Expert extends Panel {
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel4)
.addComponent(checkForce))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
.addComponent(jLabel5)
.addComponent(checkDatamatrix))
.addGap(0, 0, 0))
);
buttonMovePark.setText("Move Park");
@@ -627,7 +639,7 @@ public class Expert extends Panel {
.addComponent(panelRobot, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(panelRobot1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(29, Short.MAX_VALUE))
.addContainerGap(23, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@@ -640,7 +652,8 @@ public class Expert extends Panel {
int puck = (Integer) spinnerPuck.getValue();
int sample = (Integer) spinnerSample.getValue();
String force = checkForce.isSelected() ? "True" : "False";
execute("mount('" + segment + "'," + puck + "," + sample + ", force=" + force + ")");
String readDatamatrix = checkDatamatrix.isSelected() ? "True" : "False";
execute("mount('" + segment + "'," + puck + "," + sample + ", force=" + force + ", read_dm=" + readDatamatrix + ")");
}//GEN-LAST:event_buttonMountActionPerformed
@@ -779,11 +792,13 @@ public class Expert extends Panel {
private javax.swing.JButton buttonReleasePsys;
private javax.swing.JToggleButton buttonStream;
private javax.swing.JButton buttonUnmount;
private javax.swing.JCheckBox checkDatamatrix;
private javax.swing.JCheckBox checkForce;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel2;

View File

@@ -37,6 +37,11 @@ public class LN2 extends Panel {
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onStateChange(State state, State former) {

Binary file not shown.

149
plugins/MjpegSource2.java Normal file
View File

@@ -0,0 +1,149 @@
import ch.psi.pshell.imaging.SourceBase;
import ch.psi.pshell.imaging.SourceConfig;
import ch.psi.pshell.imaging.Utils;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.logging.Level;
/**
* Image source receive frames from a mjpeg server.
*/
public class MjpegSource2 extends SourceBase {
final String url;
final boolean flushOnUpdate;
public MjpegSource2(String name, String url) {
this(name, url, false);
}
public MjpegSource2(String name, String url, boolean flushOnUpdate) {
super(name, new SourceConfig());
this.url = url;
this.flushOnUpdate = flushOnUpdate;
}
InputStream stream;
@Override
protected void doInitialize() throws IOException, InterruptedException {
super.doInitialize();
URL aux = new URL(url);
stream = aux.openStream();
// if (!stream.markSupported()) {
stream = new BufferedInputStream(stream);
// }
}
Thread monitoredThread;
@Override
protected void doSetMonitored(boolean value) {
if (value && (monitoredThread == null)) {
monitoredThread = new Thread(() -> {
try {
while (true) {
try {
doUpdate();
Thread.sleep(1);
} catch (IOException ex) {
getLogger().log(Level.FINE, null, ex);
}
}
} catch (InterruptedException ex) {
return;
}
});
monitoredThread.setDaemon(true);
monitoredThread.start();
} else if (!value && (monitoredThread != null)) {
monitoredThread.interrupt();
monitoredThread = null;
}
}
final byte[] START_OF_FRAME = {(byte) 0xFF, (byte) 0xD8};
final byte[] END_OF_FRAME = {(byte) 0xFF, (byte) 0xD9};
final int MAX_FRAME_SIZE = 512 * 1024;
@Override
protected void doUpdate() throws IOException, InterruptedException {
byte[] data = null;
if (stream != null) {
if (flushOnUpdate) {
flush();
}
try {
data = readData();
} catch (EOFException ex) {
//Try to reopen stream
doInitialize();
data = readData();
}
}
if (data == null) {
pushImage(null);
} else {
BufferedImage img = Utils.newImage(data);
pushImage(img);
}
}
byte[] readData() throws IOException {
if (stream != null) {
stream.mark(MAX_FRAME_SIZE);
int startOfFrame = waitBytes(START_OF_FRAME) - START_OF_FRAME.length;
if (startOfFrame >= 0) {
int endOfFrame = waitBytes(END_OF_FRAME);
if (endOfFrame >= 0) {
stream.reset();
stream.skip(startOfFrame);
int length = endOfFrame - END_OF_FRAME.length;
byte[] data = new byte[length];
stream.read(data, 0, length);
return data;
}
}
}
return null;
}
int waitBytes(byte[] data) throws IOException {
int index = 0;
int dataPos = 0;
while (true) {
int ret = stream.read();
if (ret < 0) {
throw new EOFException();
}
byte value = (byte) ret;
if (value == data[dataPos]) {
dataPos++;
if (dataPos == data.length) {
return (index + 1);
}
} else {
dataPos = 0;
}
index++;
if (index >= MAX_FRAME_SIZE) {
return -1;
}
}
}
public void flush() throws IOException {
//stream.skip(stream.available());
//TODO: Skipping won't make the current image to be displayed
stream.close();
stream = new URL(url).openStream();
if (!stream.markSupported()) {
stream = new BufferedInputStream(stream);
}
}
}

View File

@@ -4,6 +4,9 @@ class BarcodeReader(DeviceBase):
def doInitialize(self):
self.disable()
self.readout = None
self.processing = False
self.task_callable=None
def enable(self):
microscan_cmd.write("<H>")
@@ -17,6 +20,7 @@ class BarcodeReader(DeviceBase):
self.state.assertReady()
try:
self.setState(State.Busy)
microscan.flush()
ret = microscan.waitString(int(timeout * 1000))
self.setCache(ret, None)
return ret
@@ -31,17 +35,38 @@ class BarcodeReader(DeviceBase):
def read(self,timeout=1.0):
initial = self.state
if initial == State.Disabled:
self.enable()
if self.processing:
raise Exception("Ongoing read operation")
self.processing = True
try:
return self.get()
finally:
initial = self.state
if initial == State.Disabled:
self.disable()
self.enable()
try:
return self.get(timeout)
finally:
if initial == State.Disabled:
self.disable()
finally:
self.processing = False
def _read_task(self, timeout):
global readout
self.readout = self.read(timeout)
return self.readout
def start_read(self, timeout=1.0):
self.readout = None
self.task_callable = fork((self._read_task, (timeout,)))
def get_readout(self):
return self.readout
def wait_readout(self):
if self.task_callable is not None:
join(self.task_callable)
self.task_callable = None
return self.readout
add_device(BarcodeReader("barcode_reader"), force = True)

View File

@@ -19,12 +19,11 @@ simulation = False
joint_forces = False
class RobotSC(RobotTCP):
def __init__(self, name, server, timeout = 1000, retries = 1):
RobotTCP.__init__(self, name, server, timeout, retries)
self.set_tasks(["getDewar", "putDewar", "putGonio", "getGonio", "robotRecover", "moveDewar", "movePark", "moveGonio","moveHeater", "moveScanner"])
self.set_known_points(["pHome", "pPark", "pDewarHome", "pGonioHome", "pDewarWait", "pGonioGet", "pScanHome", "pHeaterHome", "pHeater", "pHeaterBottom"])
self.set_known_points(["pHome", "pPark", "pDewarHome", "pGonioHome", "pDewarWait", "pGonioGet", "pScanHome", "pHeaterHome", "pHeater", "pHeaterBottom", "pScanStop"])
self.setPolling(DEFAULT_ROBOT_POLLING)
def move_dewar(self):
@@ -60,6 +59,16 @@ class RobotSC(RobotTCP):
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
self.assert_scanner()
def move_scanner(self):
self.start_task('moveScanner')
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
self.assert_scanner()
#def do_scan(self):
# self.start_task('doScan')
# self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
# self.assert_scan_stop()
def move_gonio(self):
self.start_task('moveGonio')
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
@@ -156,6 +165,9 @@ class RobotSC(RobotTCP):
def is_scanner(self):
return self.is_in_point("pScanHome")
#def is_scan_stop(self):
# return self.is_in_point("pScanStop")
def is_cleared(self):
#return self.is_home() or self.is_park() or self.is_dewar() or self.is_dewar_home()
return self.get_current_point() is not None
@@ -187,9 +199,15 @@ class RobotSC(RobotTCP):
def assert_scanner(self):
self.assert_in_point("pScanHome")
#def assert_scan_stop(self):
# self.assert_in_point("pScanStop")
def assert_cleared(self):
if not self.is_cleared():
raise Exception("Robot not in cleared position")
raise Exception("Robot not in cleared position")
def wait_ready(self):
robot.waitState(State.Ready, 1000) #robot.state.assertReady()
if simulation:
#add_device(RobotSC("robot","129.129.126.92:1000"),force = True)
@@ -234,9 +252,4 @@ if joint_forces:
add_device(jf4(), force = True)
add_device(jf5(), force = True)
add_device(jf6(), force = True)
add_device(jfc(), force = True)
"""
add_device(jfc(), force = True)

View File

@@ -3,6 +3,7 @@ import threading
FRAME_DEFAULT = "world"
FLANGE = "flange"
MAX_NUMBER_PARAMETERS = 20
run("devices/RobotMotors")
@@ -129,7 +130,7 @@ class RobotTCP(TcpDevice, Stoppable):
def execute(self, command, *args, **kwargs):
timeout = None if (kwargs is None) or (not kwargs.has_key("timeout")) else kwargs["timeout"]
msg = str(command)
if len(args)>10:
if len(args)>MAX_NUMBER_PARAMETERS:
raise Exception("Exceeded maximum number of parameters")
for i in range(len(args)):
msg += (self.cmd_separator if (i==0) else self.array_separator) + str(args[i])
@@ -671,7 +672,7 @@ class RobotTCP(TcpDevice, Stoppable):
#for task in tasks:
# if self.get_task_status(task)[0]>=0:
# raise Exception("Ongoing high-level task: " + task)
ts = robot.get_tasks_status(*tasks)
ts = self.get_tasks_status(*tasks)
for i in range(len(ts)):
if ts[i] > 0:
raise Exception("Ongoing high-level task: " + tasks[i])

View File

@@ -10,7 +10,7 @@ class SmartMagnet(DeviceBase):
}))
def doInitialize(self):
DeviceBase.doInitialize(self)
super(SmartMagnet, self).doInitialize()
self.get_current()
def set_current(self, current):
@@ -93,7 +93,7 @@ class SmartMagnet(DeviceBase):
def set_remanence_current(self):
self.set_current(self.config.getFieldValue("remanenceCurrent"))
def set_default_current():
def set_default_current(self):
if self.is_mounted():
self.set_holding_current()
else:

View File

@@ -43,6 +43,7 @@ run("motion/move_park")
run("motion/move_scanner")
run("motion/dry")
run("motion/homing_hexiposi")
run("motion/robot_recover")
run("imgproc/Utils")
run("tools/Math")
@@ -129,6 +130,8 @@ except:
print >> sys.stderr, traceback.format_exc()
#gripper_cam.paused = True
###################################################################################################
# Global variables
###################################################################################################

View File

@@ -34,7 +34,7 @@ def dry(heat_time, speed):
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()

View File

@@ -7,7 +7,7 @@ def get_dewar(segment, puck, sample, force=False):
assertValidAddress(segment, puck, sample)
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
hexiposi.assert_homed()

View File

@@ -6,7 +6,7 @@ def get_gonio(force=False):
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()

View File

@@ -5,7 +5,7 @@ def homing_hexiposi():
#Initial checks
robot.assert_no_task()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
#location = robot.get_current_point()

View File

@@ -1,4 +1,4 @@
def mount(segment, puck, sample, force=False):
def mount(segment, puck, sample, force=False, read_dm=False):
"""
"""
print "mount: ", segment, puck, sample, force
@@ -7,7 +7,7 @@ def mount(segment, puck, sample, force=False):
assertValidAddress(segment, puck, sample)
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
hexiposi.assert_homed()
@@ -29,8 +29,17 @@ def mount(segment, puck, sample, force=False):
robot.move_dewar()
robot.get_dewar(segment, puck, sample)
if read_dm:
barcode_reader.start_read(10.0)
robot.move_scanner()
robot.move_gonio()
if read_dm:
dm = barcode_reader.get_readout()
print "Datamatrix: " , dm
smart_magnet.set_mount_current()
try:
robot.put_gonio()

View File

@@ -6,7 +6,7 @@ def move_dewar():
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()

View File

@@ -6,7 +6,7 @@ def move_gonio():
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()

View File

@@ -6,7 +6,7 @@ def move_heater():
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()

View File

@@ -6,7 +6,7 @@ def move_home():
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()

View File

@@ -6,7 +6,7 @@ def move_park():
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()

View File

@@ -6,13 +6,21 @@ def move_scanner():
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
#Enabling
enable_motion()
enable_motion()
#barcode_reader.start_read(20.0)
if not robot.is_scanner():
robot.move_scanner()
#robot.do_scan()
#dm = barcode_reader.get_readout()
dm = barcode_reader.read(0.5)
print "Datamatrix: " , dm
#print "Datamatrix: " , barcode_reader.wait_readout()

View File

@@ -7,7 +7,7 @@ def put_dewar(segment, puck, sample, force=False):
assertValidAddress(segment, puck, sample)
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
hexiposi.assert_homed()

View File

@@ -6,7 +6,7 @@ def put_gonio(segment, puck, sample, force=False):
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()

View File

@@ -0,0 +1,16 @@
def robot_recover():
"""
"""
print "robot_recover"
#Initial checks
robot.assert_no_task()
robot.reset_motion()
robot.wait_ready()
#Enabling
enable_motion()
#barcode_reader.start_read(20.0)
robot.robot_recover()

View File

@@ -7,11 +7,15 @@ def unmount(segment, puck, sample, force=False):
assertValidAddress(segment, puck, sample)
robot.assert_no_task()
robot.reset_motion()
robot.state.assertReady()
robot.wait_ready()
robot.assert_cleared()
#robot.assert_in_known_point()
hexiposi.assert_homed()
if smart_magnet.check_mounted(idle_time=0.25, timeout = 1.0) == False:
raise Exception("No pin detected on gonio")
#Enabling
enable_motion()
@@ -25,6 +29,11 @@ def unmount(segment, puck, sample, force=False):
if not robot.is_gonio():
robot.move_gonio()
robot.get_gonio()
robot.move_dewar()
robot.put_dewar(segment, puck, sample)
smart_magnet.set_unmount_current()
try:
robot.get_gonio()
robot.move_dewar()
robot.put_dewar(segment, puck, sample)
finally:
smart_magnet.set_default_current()

4
script/test/TestBugPcAPI Normal file
View File

@@ -0,0 +1,4 @@
while True:
img.initialize()
img.waitNext(10000)
time.sleep(2.0)

View File

@@ -0,0 +1,30 @@
import ch.psi.pshell.prosilica.Prosilica as Prosilica
import ch.psi.pshell.device.Camera as Camera
add_device(Prosilica("img", 25001, "PacketSize=1522;PixelFormat=Mono8;BinningX=1;BinningY=1;RegionX=300;RegionY=200;Width=1000;Height=1000;MulticastEnable=Off"), True)
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.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()
show_panel(img)
#while True:
# img.initialize()
# img.waitNext(1000)
# time.sleep(0.1)

View File

@@ -0,0 +1,6 @@
import ch.psi.pshell.imaging.MjpegSource as MjpegSource
MjpegSource2 = get_context().pluginManager.getDynamicClass("MjpegSource2")
add_device(MjpegSource2("gripper_cam", "http://129.129.110.114/axis-cgi/mjpg/video.cgi"), True)
gripper_cam.polling=100
#gripper_cam.monitored = True
show_panel(gripper_cam)

View File

@@ -0,0 +1,4 @@
while True:
img.initialize()
img.waitNext(1000)
time.sleep(0.1)

View File

@@ -4,3 +4,5 @@ CMD= "sudo systemctl stop puck_detection.service;sudo systemctl start puck_detec
ret = run("tools/SshExec")
set_return(ret)
puck_detection.initialize()