GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit 53d7cf4f authored by bliss administrator's avatar bliss administrator

Added MR motors calibration - NEED TO BE TESTED

parent cc3d8977
......@@ -7,6 +7,7 @@ from bliss.common.axis import *
from bliss.common.cleanup import *
from bliss.setup_globals import *
from bliss.config.static import get_config
from bliss.common.session import get_current_session
global short_calibration
......@@ -160,7 +161,76 @@ def init_sy():
else:
print("init_sy --- Time end: "+str(time.time()-start)+ ' sec')
# search for SZ pos home switch and reset dial to 0
def init_mr_yrot():
yrot.limits=(-10000,10000)
######### LIMIT -
print("init_yrot --- Moving to hard limit - ")
start = time.time()
mv(yrot,yrot.sign*-999+yrot.offset)
time.sleep(1)
string="init_yrot --- Searching limit - ..."
print(string)
_status = yrot.state
while _status == "MOVING":
_status = yrot.state
print(string)
time.sleep(1)
print("init_yrot --- lim- found !\n")
# hardware synchronization
yrot.sync_hard()
_myposn = yrot.position
print("init_yrot --- Hard limit - value: %f" % (_myposn))
######### LIMIT +
print("init_yrot --- Moving to hard limit + ")
start = time.time()
mv(yrot,yrot.sign*999+yrot.offset)
time.sleep(1)
string="init_yrot --- Searching limit + ..."
print(string)
_status = yrot.state
while _status == "MOVING":
_status = yrot.state
print(string)
time.sleep(1)
print("init_yrot --- lim+ found !\n")
# hardware synchronization
yrot.sync_hard()
_myposp = yrot.position
print("init_yrot --- Hard limit + value: %f" % (_myposp))
mid = (_myposp - _myposn) / 2.0 + _myposn
print("init_yrot --- moving to middle position %f\n" % (mid))
umv(yrot,mid)
print("init_yrot --- reseting yrot to 0\n")
yrot.dial = 0
yrot.position = 0
slp = (_myposp - _myposn) / 2.0 - 0.05
print("init_yrot --- reseting yrot limits to hard limits +/ 0.05\n")
yrot.limits=(-slp,slp)
if time.time()-start >= 60:
print("init_yrot --- Time end: "+str((time.time()-start)/60) + ' min')
else:
print("init_yrot --- Time end: "+str(time.time()-start)+ ' sec')
# search for YROT pos and neg limits and reset dial to 0 in the middle of them.
def init_hr_yrot():
......@@ -234,6 +304,77 @@ def init_hr_yrot():
print("init_yrot --- Time end: "+str((time.time()-start)/60) + ' min')
else:
print("init_yrot --- Time end: "+str(time.time()-start)+ ' sec')
# search for YROT pos home switch and reset dial to 0
def init_mr_sz():
sz.limits=(-10000,10000)
######### LIMIT -
print("init_sz --- Moving to hard limit - ")
start = time.time()
mv(sz,sz.sign*-999+sz.offset)
time.sleep(1)
string="init_sz --- Searching limit - ..."
print(string)
_status = sz.state
while _status == "MOVING":
_status = sz.state
print(string)
time.sleep(1)
print("init_sz --- lim- found !\n")
# hardware synchronization
sz.sync_hard()
_myposn = sz.position
print("init_sz --- Hard limit - value: %f" % (_myposn))
######### LIMIT +
print("init_sz --- Moving to hard limit + ")
start = time.time()
mv(sz,sz.sign*999+sz.offset)
time.sleep(1)
string="init_sz --- Searching limit + ..."
print(string)
_status = sz.state
while _status == "MOVING":
_status = sz.state
print(string)
time.sleep(1)
print("init_sz --- lim+ found !\n")
# hardware synchronization
sz.sync_hard()
_myposp = sz.position
print("init_sz --- Hard limit + value: %f" % (_myposp))
mid = (_myposp - _myposn) / 2.0 + _myposn
print("init_sz --- moving to middle position %f\n" % (mid))
umv(sz,mid)
print("init_sz --- reseting sz to 0\n")
sz.dial = 0
sz.position = 0
slp = (_myposp - _myposn) / 2.0 - 0.05
print("init_sz --- reseting sz limits to hard limits +/ 0.05\n")
sz.limits=(-slp,slp)
if time.time()-start >= 60:
print("init_sz --- Time end: "+str((time.time()-start)/60) + ' min')
else:
print("init_sz --- Time end: "+str(time.time()-start)+ ' sec')
def init_hr_sz():
......@@ -331,12 +472,39 @@ def init_hr_z0():
print("init_z0 --- Time end: "+str(time.time()-start)+ ' sec')
# search for SROT pos home switch, go to user position and reset dial to 0
def init_srot():
def init_mr_srot():
srot.dial = 0
srot.position = 0
pos = get_config().get_config('SampleChanger')['positions'][0]['Hr']['calibration']['srot']
pos = 172.5
start=time.time()
srot.controller.home_search(srot,1,pos)
srot.sync_hard()
string="init_srot --- Searching home..."
print(string)
srot.controller.home_state(srot)
while "READY" not in srot.state:
srot.controller.home_state(srot)
print(string)
time.sleep(1)
print("init_srot --- moving srot to 0\n")
umv(srot,0)
if time.time()-start >= 60:
print("init_srot --- Time end: "+str((time.time()-start)/60) + ' min')
else:
print("init_srot --- Time end: "+str(time.time()-start)+ ' sec')
# search for SROT pos home switch, go to user position and reset dial to 0
def init_hr_srot():
srot.dial = 0
srot.position = 0
pos = 248
start=time.time()
srot.controller.home_search(srot,1,pos)
......@@ -360,8 +528,14 @@ def init_srot():
def calib_motors(*motors,short_calib=True):
all_calib = [init_sx,init_sy,init_hr_sz,init_hr_yrot,init_srot,init_hr_z0]
all_motors = [sx,sy,sz,yrot,srot,z0]
all_calib = [init_sx,init_sy]
all_motors = [sx,sy,sz,yrot,srot]
if get_current_session().name == 'HRTOMO':
all_calib += [init_hr_sz,init_hr_yrot,init_hr_srot,init_hr_z0]
all_motors.append(z0)
if get_current_session().name == 'MRTOMO':
all_calib += [init_mr_sz,init_mr_yrot,init_mr_srot]
global short_calibration
short_calibration = short_calib
if len(motors) > 0:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment