This commit is contained in:
gac-S_Changer
2018-08-14 14:10:09 +02:00
parent 1709e91d0d
commit 016f0508fe
15 changed files with 216 additions and 32 deletions

View File

@@ -1,7 +1,7 @@
def home_fast_table():
caput ("SAR-EXPMX:ASYN.AOUT", "enable plc 1")
caput ("SAR-EXPMX1:ASYN.AOUT", "enable plc 1")
def get_fx_pos():
return caget("SAR-EXPMX:MOT_FX.RBV", 'f')
@@ -35,3 +35,9 @@ def set_cx_pos(pos):
return caput("SAR-EXPMX:MOT_CX.VAL", float(pos))
def set_mount_position():
set_fx_pos(0.0)
set_fy_pos(0.0)
set_ry_pos(0.0)
set_cz_pos(0.0)
set_cx_pos(0.0)

View File

@@ -23,7 +23,7 @@ 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", "pScanStop"])
self.set_known_points(["pHome", "pPark", "pDewarHome", "pGonioHome", "pDewarWait", "pGonioGet", "pScanHome", "pHeaterHome", "pHeater", "pHeaterBottom", "pScanStop","pHelium"])
self.setPolling(DEFAULT_ROBOT_POLLING)
def move_dewar(self):
@@ -161,6 +161,9 @@ class RobotSC(RobotTCP):
def is_gonio(self):
return self.is_in_point("pGonioHome")
def is_helium(self):
return self.is_in_point("pHelium")
def is_scanner(self):
return self.is_in_point("pScanHome")
@@ -194,7 +197,10 @@ class RobotSC(RobotTCP):
self.assert_in_point("pDewarWait")
def assert_gonio(self):
self.assert_in_point("pGonioHome")
self.assert_in_point("pGonioHome")
def assert_helium(self):
self.assert_in_point("pHelium")
def assert_scanner(self):
self.assert_in_point("pScanHome")

View File

@@ -108,7 +108,7 @@ class RobotTCP(TcpDevice, Stoppable):
def _sendReceive(self, msg_id, msg = "", timeout = None):
tx = self.header if (self.header != None) else ""
tx = tx + msg_id + " " + msg
if (len(tx)>127):
if (len(tx)>150):
raise Exception("Exceeded maximum message size")
self.getLogger().finer("TX = '" + str(tx)+ "'")
if (self.trailer != None): tx = tx + self.trailer
@@ -736,7 +736,7 @@ class RobotTCP(TcpDevice, Stoppable):
log("Failed starting : " + str(program) + str(args), False)
print "Failed starting : " + str(program) + str(args)
if self.exception_on_task_start_failure:
raise Exception("Cannot start task: " + program + + str(args))
raise Exception("Cannot start task: " + program + str(args))
log("Task started: " + str(program) + str(args) + " - status: " + str(status) + " (" + str(code) + ")", False)
self.current_task, self.current_task_ret = program, None

View File

@@ -1,6 +1,8 @@
###################################################################################################
# Procedure to detect the cover orientation
###################################################################################################
assert_imaging_enabled()
#Parameters
FRAMES_INTEGRATION = 3
@@ -27,7 +29,7 @@ smooth(ip)
#bandpass_filter(ip, 30, 1000)
edges(ip)
auto_threshold(ip, method = "MaxEntropy")
#binary_erode(ip, False)
#binary_erode(ip, True)
#binary_dilate(ip, True)
ip.getProcessor().erode(1, 255)
cx,cy = int(ip.width/2), int(ip.height/2)
@@ -80,7 +82,7 @@ if angle is not None:
#Plot the correlations values agains angle
if DEBUG:
p = plot(ydata, xdata=xdata)[0]
plot(ydata, xdata=xdata)
#Output results
if DEBUG:

View File

@@ -1,6 +1,8 @@
###################################################################################################
# Procedure to detect the puck light spots.
###################################################################################################
assert_imaging_enabled()
COVER_PRESENT = True
ROOM_TEMP = is_room_temp()

View File

@@ -9,8 +9,6 @@ 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/CoverDetection")
return position

View File

@@ -11,6 +11,37 @@ import ch.psi.pshell.core.Nameable as Nameable
run("setup/Layout")
###################################################################################################
# Configuration
###################################################################################################
def is_imaging_enabled():
setting = get_setting("ImagingEnabled")
return not (str(setting) == 'False')
def set_imaging_enabled(value):
set_setting("ImagingEnabled", True if value else False )
def assert_imaging_enabled():
if is_imaging_enabled() == False:
raise Exception ("Imaging is disabled")
#"unipuck", "minispine" or "mixed"
def set_puck_types(value):
set_setting("ImagingEnabled", True if value else False )
def get_puck_types():
setting = get_setting("ImagingEnabled")
if setting == "unipuck" or setting == "minispine":
return setting
return "mixed"
#In order to apply current config
set_imaging_enabled(is_imaging_enabled())
set_puck_types(get_puck_types())
###################################################################################################
# Scripted devices and pseudo-devices
###################################################################################################

View File

@@ -1,4 +1,4 @@
def put_gonio(segment, puck, sample, force=False):
def put_gonio(force=False):
"""
"""
print "put_gonio: ", force

View File

@@ -65,14 +65,15 @@ def _set_hexiposi(pos):
def visual_check_hexiposi(segment):
#if is_manual_mode(): ?
if hexiposi.moved:
#Clearing for image processing
if not robot.is_park():
print "Moving robot to park to clear camera view..."
robot.move_park()
assert_img_in_cover_pos(segment)
hexiposi.moved = False
if is_imaging_enabled():
#if is_manual_mode(): ?
if hexiposi.moved:
#Clearing for image processing
if not robot.is_park():
print "Moving robot to park to clear camera view..."
robot.move_park()
assert_img_in_cover_pos(segment)
hexiposi.moved = False
@@ -82,7 +83,7 @@ def wait_end_of_move():
time.sleep(0.01)
def move_home():
def move_to_home():
#robot.reset_motion("jHome")
robot.movej("pHome", robot.tool , DESC_SCAN)
wait_end_of_move()