This commit is contained in:
28
script/motion/get_dewar.py
Normal file
28
script/motion/get_dewar.py
Normal file
@@ -0,0 +1,28 @@
|
||||
def get_dewar(segment, puck, sample, force=False):
|
||||
"""
|
||||
"""
|
||||
print "get_dewar: ", segment, puck, sample, force
|
||||
|
||||
#Initial checks
|
||||
assertValidAddress(segment, puck, sample)
|
||||
robot.assert_no_task()
|
||||
robot.reset_motion()
|
||||
robot.state.assertReady()
|
||||
robot.assert_cleared()
|
||||
#robot.assert_in_known_point()
|
||||
hexiposi.assert_homed()
|
||||
#location = robot.get_current_point()
|
||||
|
||||
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
set_hexiposi(segment)
|
||||
|
||||
if not force:
|
||||
visual_check_hexiposi(segment)
|
||||
|
||||
if not robot.is_dewar():
|
||||
robot.move_dewar()
|
||||
|
||||
robot.get_dewar(segment, puck, sample)
|
||||
20
script/motion/get_gonio.py
Normal file
20
script/motion/get_gonio.py
Normal file
@@ -0,0 +1,20 @@
|
||||
def get_gonio(force=False):
|
||||
"""
|
||||
"""
|
||||
print "get_gonio: ", force
|
||||
|
||||
#Initial checks
|
||||
robot.assert_no_task()
|
||||
robot.reset_motion()
|
||||
robot.state.assertReady()
|
||||
robot.assert_cleared()
|
||||
#robot.assert_in_known_point()
|
||||
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
|
||||
if not robot.is_gonio():
|
||||
robot.move_gonio()
|
||||
|
||||
robot.get_gonio()
|
||||
15
script/motion/homing_hexiposi.py
Normal file
15
script/motion/homing_hexiposi.py
Normal file
@@ -0,0 +1,15 @@
|
||||
def homing_hexiposi():
|
||||
"""
|
||||
"""
|
||||
print "homing_hexiposi"
|
||||
|
||||
#Initial checks
|
||||
robot.assert_no_task()
|
||||
robot.state.assertReady()
|
||||
robot.assert_cleared()
|
||||
#robot.assert_in_known_point()
|
||||
#location = robot.get_current_point()
|
||||
|
||||
hexiposi.move_home()
|
||||
hexiposi.waitState(State.Ready,-1)
|
||||
|
||||
@@ -6,35 +6,25 @@ def mount(segment, puck, sample, force=False):
|
||||
#Initial checks
|
||||
assertValidAddress(segment, puck, sample)
|
||||
robot.assert_no_task()
|
||||
robot.reset_motion()
|
||||
robot.state.assertReady()
|
||||
robot.assert_cleared()
|
||||
|
||||
if hexiposi.homed == False:
|
||||
raise Exception ("Hexiposi is not homed")
|
||||
#robot.assert_in_known_point()
|
||||
hexiposi.assert_homed()
|
||||
#location = robot.get_current_point()
|
||||
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
set_hexiposi(segment)
|
||||
|
||||
|
||||
if not force:
|
||||
#Clearing for image processing
|
||||
robot.move_park()
|
||||
assert_img_in_cover_pos(segment)
|
||||
|
||||
location = robot.get_current_point()
|
||||
print "Location: " + location
|
||||
if not force:
|
||||
visual_check_hexiposi(segment)
|
||||
|
||||
robot.move_dewar_wait()
|
||||
try:
|
||||
robot.get_dewar(segment, puck, sample)
|
||||
except:
|
||||
#robot.move_dewar()
|
||||
raise
|
||||
|
||||
try:
|
||||
robot.put_gonio()
|
||||
except:
|
||||
#TODO: recover
|
||||
raise
|
||||
if not robot.is_dewar():
|
||||
robot.move_dewar()
|
||||
|
||||
robot.get_dewar(segment, puck, sample)
|
||||
robot.move_gonio()
|
||||
robot.put_gonio()
|
||||
robot.move_dewar()
|
||||
|
||||
28
script/motion/put_dewar.py
Normal file
28
script/motion/put_dewar.py
Normal file
@@ -0,0 +1,28 @@
|
||||
def put_dewar(segment, puck, sample, force=False):
|
||||
"""
|
||||
"""
|
||||
print "put_dewar: ", segment, puck, sample, force
|
||||
|
||||
#Initial checks
|
||||
assertValidAddress(segment, puck, sample)
|
||||
robot.assert_no_task()
|
||||
robot.reset_motion()
|
||||
robot.state.assertReady()
|
||||
robot.assert_cleared()
|
||||
#robot.assert_in_known_point()
|
||||
hexiposi.assert_homed()
|
||||
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
set_hexiposi(segment)
|
||||
|
||||
if not force:
|
||||
visual_check_hexiposi(segment)
|
||||
|
||||
#location = robot.get_current_point()
|
||||
|
||||
if not robot.is_dewar():
|
||||
robot.move_dewar()
|
||||
|
||||
robot.put_dewar(segment, puck, sample)
|
||||
18
script/motion/put_gonio.py
Normal file
18
script/motion/put_gonio.py
Normal file
@@ -0,0 +1,18 @@
|
||||
def put_gonio(segment, puck, sample, force=False):
|
||||
"""
|
||||
"""
|
||||
print "put_gonio: ", force
|
||||
|
||||
#Initial checks
|
||||
robot.assert_no_task()
|
||||
robot.reset_motion()
|
||||
robot.state.assertReady()
|
||||
robot.assert_cleared()
|
||||
#robot.assert_in_known_point()
|
||||
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
if not robot.is_gonio():
|
||||
robot.move_gonio()
|
||||
robot.put_gonio()
|
||||
@@ -34,7 +34,17 @@ def set_hexiposi(pos):
|
||||
set_status(None)
|
||||
else:
|
||||
hexiposi.move(pos)
|
||||
|
||||
|
||||
def visual_check_hexiposi(segment):
|
||||
#if robot.working_mode == "manual" ?
|
||||
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
|
||||
|
||||
|
||||
|
||||
def wait_end_of_move():
|
||||
@@ -88,12 +98,12 @@ def update_tool(tool=None, x_offset=0.0, y_offset=0.0, z_offset=0.0):
|
||||
|
||||
|
||||
def assertValidAddress(segment, puck, sample):
|
||||
if type(segment) == str:
|
||||
if is_string(segment):
|
||||
segment = ord(segment.upper()) - ord('A') +1
|
||||
if segment<=0 or segment >6:
|
||||
raise Excepton ("Invalid segment")
|
||||
raise Exception ("Invalid segment")
|
||||
if puck<=0 or puck >5:
|
||||
raise Excepton ("Invalid puck")
|
||||
raise Exception ("Invalid puck")
|
||||
if sample<=0 or sample >16:
|
||||
raise Excepton ("Invalid sample")
|
||||
raise Exception ("Invalid sample")
|
||||
|
||||
@@ -6,39 +6,25 @@ def unmount(segment, puck, sample, force=False):
|
||||
#Initial checks
|
||||
assertValidAddress(segment, puck, sample)
|
||||
robot.assert_no_task()
|
||||
robot.reset_motion()
|
||||
robot.state.assertReady()
|
||||
robot.assert_cleared()
|
||||
|
||||
if hexiposi.homed == False:
|
||||
raise Exception ("Hexiposi is not homed")
|
||||
#robot.assert_in_known_point()
|
||||
hexiposi.assert_homed()
|
||||
|
||||
#Enabling
|
||||
enable_motion()
|
||||
|
||||
set_hexiposi(segment)
|
||||
|
||||
if not force:
|
||||
#Clearing for image processing
|
||||
robot.move_park()
|
||||
assert_img_in_cover_pos(segment)
|
||||
if not force:
|
||||
visual_check_hexiposi(segment)
|
||||
|
||||
location = robot.get_current_point()
|
||||
#location = robot.get_current_point()
|
||||
|
||||
|
||||
try:
|
||||
robot.get_gonio()
|
||||
except:
|
||||
#TODO: recover
|
||||
raise
|
||||
|
||||
try:
|
||||
robot.move_dewar_wait()
|
||||
except:
|
||||
#TODO: recover
|
||||
raise
|
||||
|
||||
try:
|
||||
robot.put_dewar(segment, puck, sample)
|
||||
except:
|
||||
#robot.move_dewar()
|
||||
raise
|
||||
if not robot.is_gonio():
|
||||
robot.move_gonio()
|
||||
|
||||
robot.get_gonio()
|
||||
robot.move_dewar()
|
||||
robot.put_dewar(segment, puck, sample)
|
||||
|
||||
Reference in New Issue
Block a user