This commit is contained in:
@@ -2,11 +2,15 @@ TOOL_CALIBRATION = "tCalib"
|
||||
TOOL_SUNA= "tSuna"
|
||||
TOOL_DEFAULT= TOOL_SUNA
|
||||
|
||||
FRAME_TABLE = "fTable"
|
||||
|
||||
DESC_FAST = "mFast"
|
||||
DESC_SLOW = "mSlow"
|
||||
DESC_SCAN = "mScan"
|
||||
DESC_DEFAULT = DESC_FAST
|
||||
|
||||
AUX_SEGMENT = "X"
|
||||
|
||||
|
||||
DEFAULT_ROBOT_POLLING = 500
|
||||
TASK_WAIT_ROBOT_POLLING = 50
|
||||
@@ -22,8 +26,8 @@ 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", "moveCold", "movePark", "moveGonio","moveHeater", "moveScanner","moveHome"])
|
||||
self.set_known_points(["pPark", "pGonioHome", "pDewarWait", "pGonioGet", "pScanHome", "pHeaterHome", "pHeater", "pHeaterBottom", "pScanStop","pHelium", "pHome", "pCold"])
|
||||
self.set_tasks(["getDewar", "putDewar", "putGonio", "getGonio", "recover", "moveDewar", "moveCold", "movePark", "moveGonio","moveHeater", "moveScanner","moveHome", "moveAux"])
|
||||
self.set_known_points(["pPark", "pGonio", "pDewar", "pGonioG", "pScan", "pHeater", "pHeat", "pHeatB", "pScanStop","pHelium", "pHome", "pCold", "pAux"])
|
||||
self.setPolling(DEFAULT_ROBOT_POLLING)
|
||||
|
||||
def move_dewar(self):
|
||||
@@ -53,12 +57,12 @@ class RobotSC(RobotTCP):
|
||||
self.start_task('putDewar',segment, puck, sample, is_room_temp())
|
||||
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
|
||||
#self.assert_dewar()
|
||||
self.assert_cold
|
||||
self.assert_cold()
|
||||
|
||||
def put_gonio(self):
|
||||
pin_offset = get_pin_offset()
|
||||
pin_angle_offset = get_pin_angle_offset()
|
||||
self.start_task('putGonio', pin_offset, pin_angle_offset)
|
||||
self.start_task('putGonio', pin_offset)
|
||||
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
|
||||
self.assert_gonio()
|
||||
|
||||
@@ -68,6 +72,18 @@ class RobotSC(RobotTCP):
|
||||
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
|
||||
self.assert_gonio()
|
||||
|
||||
def get_aux(self, sample):
|
||||
self.assert_aux()
|
||||
self.start_task('getAuxiliary', sample)
|
||||
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
|
||||
self.assert_aux()
|
||||
|
||||
def put_aux(self, sample):
|
||||
self.assert_aux()
|
||||
self.start_task('putAuxiliary', sample)
|
||||
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
|
||||
self.assert_aux()
|
||||
|
||||
def move_scanner(self):
|
||||
self.start_task('moveScanner')
|
||||
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
|
||||
@@ -104,10 +120,15 @@ class RobotSC(RobotTCP):
|
||||
|
||||
|
||||
def robot_recover(self):
|
||||
self.start_task('robotRecover')
|
||||
self.start_task('recover')
|
||||
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
|
||||
self.assert_home()
|
||||
|
||||
def move_aux(self):
|
||||
self.start_task('moveAux')
|
||||
self.wait_task_finished(TASK_WAIT_ROBOT_POLLING)
|
||||
self.assert_aux()
|
||||
|
||||
def toSegmentNumber(self, segment):
|
||||
if is_string(segment):
|
||||
segment = ord(segment.upper()) - ord('A') +1
|
||||
@@ -158,25 +179,28 @@ class RobotSC(RobotTCP):
|
||||
return self.is_in_point("pHome")
|
||||
|
||||
def is_dewar(self):
|
||||
return self.is_in_point("pDewarWait")
|
||||
return self.is_in_point("pDewar")
|
||||
|
||||
def is_heater(self):
|
||||
return self.is_in_point("pHeater")
|
||||
return self.is_in_point("pHeat")
|
||||
|
||||
def is_heater_home(self):
|
||||
return self.is_in_point("pHeaterHome")
|
||||
return self.is_in_point("pHeater")
|
||||
|
||||
def is_heater_bottom(self):
|
||||
return self.is_in_point("pHeaterBottom")
|
||||
return self.is_in_point("pHeatB")
|
||||
|
||||
def is_gonio(self):
|
||||
return self.is_in_point("pGonioHome")
|
||||
return self.is_in_point("pGonio")
|
||||
|
||||
def is_helium(self):
|
||||
return self.is_in_point("pHelium")
|
||||
|
||||
def is_scanner(self):
|
||||
return self.is_in_point("pScanHome")
|
||||
return self.is_in_point("pScan")
|
||||
|
||||
def is_aux(self):
|
||||
return self.is_in_point("pAux")
|
||||
|
||||
#def is_scan_stop(self):
|
||||
# return self.is_in_point("pScanStop")
|
||||
@@ -186,16 +210,16 @@ class RobotSC(RobotTCP):
|
||||
return self.get_current_point() is not None
|
||||
|
||||
def assert_heater_home(self):
|
||||
self.assert_in_point("pHeaterHome")
|
||||
self.assert_in_point("pHeater")
|
||||
|
||||
def assert_cold(self):
|
||||
self.assert_in_point("pCold")
|
||||
|
||||
def assert_heater(self):
|
||||
self.assert_in_point("pHeater")
|
||||
self.assert_in_point("pHeat")
|
||||
|
||||
def assert_heater_bottom(self):
|
||||
self.assert_in_point("pHeaterBottom")
|
||||
self.assert_in_point("pHeatB")
|
||||
|
||||
def assert_park(self):
|
||||
self.assert_in_point("pPark")
|
||||
@@ -204,16 +228,19 @@ class RobotSC(RobotTCP):
|
||||
self.assert_in_point("pHome")
|
||||
|
||||
def assert_dewar(self):
|
||||
self.assert_in_point("pDewarWait")
|
||||
self.assert_in_point("pDewar")
|
||||
|
||||
def assert_gonio(self):
|
||||
self.assert_in_point("pGonioHome")
|
||||
self.assert_in_point("pGonio")
|
||||
|
||||
def assert_helium(self):
|
||||
self.assert_in_point("pHelium")
|
||||
|
||||
def assert_scanner(self):
|
||||
self.assert_in_point("pScanHome")
|
||||
self.assert_in_point("pScan")
|
||||
|
||||
def assert_aux(self):
|
||||
self.assert_in_point("pAux")
|
||||
|
||||
#def assert_scan_stop(self):
|
||||
# self.assert_in_point("pScanStop")
|
||||
@@ -236,6 +263,7 @@ else:
|
||||
|
||||
robot.set_default_desc(DESC_DEFAULT)
|
||||
robot.default_speed = 20
|
||||
robot.set_frame(FRAME_DEFAULT)
|
||||
robot.set_tool(TOOL_DEFAULT)
|
||||
robot.setPolling(DEFAULT_ROBOT_POLLING)
|
||||
|
||||
|
||||
@@ -69,7 +69,20 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
def get_tool(self):
|
||||
return self.tool
|
||||
|
||||
def set_frame(self, frame):
|
||||
self.frame = frame
|
||||
self.evaluate("tcp_curframe=" + frame)
|
||||
if self.cartesian_motors_enabled:
|
||||
self.update()
|
||||
self.set_motors_enabled(True)
|
||||
self.waitCacheChange(5000)
|
||||
|
||||
def get_frame(self):
|
||||
return self.frame
|
||||
|
||||
def set_default_frame(self):
|
||||
self.set_frame(FRAME_DEFAULT)
|
||||
|
||||
def assert_tool(self, tool=None):
|
||||
if tool is None:
|
||||
if self.tool is None:
|
||||
@@ -470,15 +483,18 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
def distance_p(self, pnt1, pnt2):
|
||||
return self.eval_float("distance(" + pnt1 + ", " + pnt2 + ")")
|
||||
|
||||
def compose(self, pnt, frame = FRAME_DEFAULT, trsf = "tcp_t"):
|
||||
def compose(self, pnt, frame = None, trsf = "tcp_t"):
|
||||
if frame is None: frame = self.frame
|
||||
return self.eval_pnt("compose(" + pnt + ", " + frame + ", " + trsf + ")")
|
||||
|
||||
def here(self, tool=None, frame=FRAME_DEFAULT):
|
||||
def here(self, tool=None, frame=None):
|
||||
if tool is None: tool = self.tool
|
||||
if frame is None: frame = self.frame
|
||||
return self.eval_pnt("here(" + tool + ", " + frame + ")")
|
||||
|
||||
def joint_to_point(self, tool=None, frame=FRAME_DEFAULT, joint="tcp_j"):
|
||||
def joint_to_point(self, tool=None, frame=None, joint="tcp_j"):
|
||||
if tool is None: tool = self.tool
|
||||
if frame is None: frame = self.frame
|
||||
return self.eval_pnt("jointToPoint(" + tool + ", " + frame + ", " + joint +")")
|
||||
|
||||
def point_to_joint(self, tool=None, initial_joint="tcp_j", point="tcp_p"):
|
||||
@@ -486,7 +502,8 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
if self.eval_bool("pointToJoint(" + tool + ", " + initial_joint + ", " + point +", j)"):
|
||||
return self.get_jnt()
|
||||
|
||||
def position(self, point, frame=FRAME_DEFAULT):
|
||||
def position(self, point, frame=None):
|
||||
if frame is None: frame = self.frame
|
||||
return self.eval_trf("position(" + point + ", " + frame + ")")
|
||||
|
||||
#Profile
|
||||
@@ -715,14 +732,15 @@ class RobotTCP(TcpDevice, Stoppable):
|
||||
for m in self.joint_motors:
|
||||
m.initialize()
|
||||
#Alignment
|
||||
def align(self, point = None, frame = FRAME_DEFAULT, desc = None):
|
||||
def align(self, point = None, frame = None, desc = None):
|
||||
if frame is None: frame = self.frame
|
||||
self.assert_tool()
|
||||
if desc is None: desc = self.default_desc
|
||||
if point is None:
|
||||
self.get_cartesian_pos()
|
||||
else:
|
||||
self.set_pnt(point)
|
||||
np=self.eval_trf('align(tcp_p.trsf, ' + FRAME_DEFAULT + '.trsf)')
|
||||
np=self.eval_trf('align(tcp_p.trsf, ' + frame + '.trsf)')
|
||||
self.set_pnt(np)
|
||||
self.movej("tcp_p", self.tool, desc)
|
||||
#TODO: The first command is not executed (but receive a move id)
|
||||
|
||||
Reference in New Issue
Block a user