This commit is contained in:
+34
-10
@@ -1,16 +1,40 @@
|
||||
def mount(segment, puck, sample, unmount = False):
|
||||
def mount(segment, puck, sample, force=False):
|
||||
"""
|
||||
"""
|
||||
cmd = "firstmount" if unmount else "mount"
|
||||
print "mount: ", segment, puck, sample, force
|
||||
|
||||
#Initial checks
|
||||
assertValidAddress(segment, puck, sample)
|
||||
robot.assert_no_task()
|
||||
robot.state.assertReady()
|
||||
robot.assert_cleared()
|
||||
|
||||
hexiposi.move(segment)
|
||||
if hexiposi.homed == False:
|
||||
raise Exception ("Hexiposi is not homed")
|
||||
|
||||
img_segment = get_img_cover_pos()
|
||||
if img_segment != segment:
|
||||
raise Excepton ("Image detection of cover does not match hexiposi: " + str(img_segment))
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
set_hexiposi(segment)
|
||||
|
||||
if type(segment) == str:
|
||||
segment = ord(segment.upper()) - ord('A') +1
|
||||
robot.start_task(cmd,segment, puck, sample)
|
||||
#robot.mount(segment, puck, sample)
|
||||
|
||||
if not force:
|
||||
#Clearing for image processing
|
||||
robot.move_park()
|
||||
assert_img_in_cover_pos(segment)
|
||||
|
||||
location = get_current_point()
|
||||
print "Location: " + location
|
||||
|
||||
robot.move_dewar()
|
||||
try:
|
||||
robot.get_dewar(segment, puck, sample)
|
||||
except:
|
||||
#robot.move_dewar()
|
||||
raise
|
||||
|
||||
try:
|
||||
robot.put_gonio()
|
||||
except:
|
||||
#TODO: recover
|
||||
raise
|
||||
|
||||
+29
-12
@@ -1,20 +1,39 @@
|
||||
POSITION_TOLERANCE = 50
|
||||
|
||||
def enable_power():
|
||||
def enable_motion():
|
||||
"""
|
||||
Check safety and enable arm power
|
||||
Check safety and enable arm power if in remote mode
|
||||
"""
|
||||
release_psys()
|
||||
time.sleep(0.1)
|
||||
if feedback_psys_safety.read() == False:
|
||||
raise Exception("Cannot enable power: check doors")
|
||||
if robot.working_mode != "manual":
|
||||
release_psys()
|
||||
time.sleep(0.1)
|
||||
if feedback_psys_safety.read() == False:
|
||||
raise Exception("Cannot enable power: check doors")
|
||||
|
||||
release_local()
|
||||
if feedback_local_safety.read() == False:
|
||||
raise Exception("Cannot enable power: check sample changer emergency stop button")
|
||||
time.sleep(0.25)
|
||||
if not robot.state.isNormal():
|
||||
raise Exception("Cannot enable power: robot state is " + str(robot.state))
|
||||
robot.enable()
|
||||
|
||||
if robot.working_mode == "manual":
|
||||
pass
|
||||
else:
|
||||
time.sleep(0.25)
|
||||
if not robot.state.isNormal():
|
||||
raise Exception("Cannot enable power: robot state is " + str(robot.state))
|
||||
robot.enable()
|
||||
|
||||
def set_hexiposi(pos):
|
||||
"""
|
||||
Set the hexiposi posiiton in remote mode, or wait for it to be set in manual mode
|
||||
"""
|
||||
if robot.working_mode == "manual":
|
||||
set_status("Move Hexiposi to position " + str(pos) + " ...")
|
||||
try:
|
||||
hexiposi.waitInPosition(pos, -1)
|
||||
finally:
|
||||
set_status(None)
|
||||
else:
|
||||
hexiposi.move(pos)
|
||||
|
||||
|
||||
|
||||
@@ -57,8 +76,6 @@ def move_to_laser():
|
||||
raise Exception ("Must be in home position to start move to laser")
|
||||
|
||||
|
||||
|
||||
|
||||
def update_tool(tool=None, x_offset=0.0, y_offset=0.0, z_offset=0.0):
|
||||
#Updating tool:
|
||||
t=robot.get_tool_trsf(tool)
|
||||
|
||||
@@ -1,15 +1,44 @@
|
||||
def unmount(segment, puck, sample):
|
||||
def unmount(segment, puck, sample, force=False):
|
||||
"""
|
||||
"""
|
||||
print "unmount: ", segment, puck, sample, force
|
||||
|
||||
#Initial checks
|
||||
assertValidAddress(segment, puck, sample)
|
||||
robot.assert_no_task()
|
||||
robot.state.assertReady()
|
||||
robot.assert_cleared()
|
||||
|
||||
hexiposi.move(segment)
|
||||
if hexiposi.homed == False:
|
||||
raise Exception ("Hexiposi is not homed")
|
||||
|
||||
img_segment = get_img_cover_pos()
|
||||
if img_segment != segment:
|
||||
raise Excepton ("Image detection of cover does not match hexiposi: " + str(img_segment))
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
if type(segment) == str:
|
||||
segment = ord(segment.upper()) - ord('A') +1
|
||||
set_hexiposi(segment)
|
||||
|
||||
robot.unmount(segment, puck, sample)
|
||||
if not force:
|
||||
#Clearing for image processing
|
||||
robot.move_park()
|
||||
assert_img_in_cover_pos(segment)
|
||||
|
||||
location = get_current_point()
|
||||
|
||||
|
||||
try:
|
||||
robot.get_gonio()
|
||||
except:
|
||||
#TODO: recover
|
||||
raise
|
||||
|
||||
try:
|
||||
robot.move_dewar()
|
||||
except:
|
||||
#TODO: recover
|
||||
raise
|
||||
|
||||
try:
|
||||
robot.pet_dewar(segment, puck, sample)
|
||||
except:
|
||||
#robot.move_dewar()
|
||||
raise
|
||||
Reference in New Issue
Block a user