Commit 19fde2c7 authored by Yoann Sallaz Damaz's avatar Yoann Sallaz Damaz
Browse files

cc

parent d2f9e909
Pipeline #56257 canceled with stages
......@@ -89,6 +89,7 @@ class Actuator_Multiwago_Interlocked(Actuator):
return self.controller.get(self.key_cmd) == 0
def _force_in(self):
#self._check=False
super(Actuator,self).set_in()
def _force_out(self):
......
from bliss.config import static as static_config
import serial
#import serial
from time import sleep
from bliss.comm.serial import Serial
from bliss.comm.util import get_comm
# Following parameters cannot be done remotely
# FREQ: 0 (3.3Mhz)
......@@ -18,9 +20,12 @@ from time import sleep
class bac24(object):
def __init__(self, name, config, config_objects=None):
self._config_objects = config_objects
devport = config.get("serial")
#devport = config.get("serial")
#self.ser = serial.Serial(devport)
self.verbose = config.get("verbose")
self.ser = serial.Serial(devport)
self.ser = get_comm(config, timeout=2, eol=b"\r\n")
def send_and_read(self,cmd, nblines_to_read=1):
......@@ -98,6 +103,11 @@ class bac24(object):
# Set the offset to val
self.send_and_read(b"$AOFF%f;\r\n"%val)
def set_current_position(self, val_deg):
self.clearpos()
self.offset(val_deg*12800)
def clearpos(self):
# Set the position to 0
self.send_and_read(b"$ARAZPOS;\r\n")
......
......@@ -79,14 +79,6 @@ def acq_externalSingle(expo_s, step_deg, start_angle_deg, end_angle_deg):
umv(omega,0)
def opensh():
fastshut.open_manual()
def closesh():
fastshut.close_manual()
def pico_moyenne(seconde):
import tango
pico = tango.DeviceProxy('bm07/pico/oh')
......
......@@ -228,10 +228,13 @@ class grob_FIP(object):
self.kappa_collectsample = config["kappa_collectsample"]
self.x_collectsample = config["x_collectsample"]
self.y_collectsample = config["y_collectsample"]
self.y_collectsample_long = config["y_collectsample_long"]
self.z_collectsample = config["z_collectsample"]
self.xomega_collectsample = config["xomega_collectsample"]
self.zomega_collectsample = config["zomega_collectsample"]
self.need_y_long = False
#READ - Robot Memory
self.read_all_memory()
......@@ -267,6 +270,7 @@ class grob_FIP(object):
self.detfwd = self.config["detfwd"]
self.detcover = get_config().get(self.config["detcover"])
self.bstop1 = get_config().get(self.config["bstop1"])
self.backlight = get_config().get(self.config["backlight"])
self.cryoshort = get_config().get(self.config["cryoshort"])
self.cryolong = get_config().get(self.config["cryolong"])
self.dewar = get_config().get(self.config["dewar"])
......@@ -278,6 +282,13 @@ class grob_FIP(object):
self.fastshut = self.config["fastshut"]
self.real_device_init=True
def set_use_long_sample(self):
self.need_y_long = True
def set_use_normal_sample(self):
self.need_y_long = False
def _move_gonio(self, motor_list_first, target_list_first,
motor_list_next, target_list_next,
checkonly=False):
......@@ -292,7 +303,7 @@ class grob_FIP(object):
mot.move(target,wait=False)
notok=True
with gevent.Timeout(15,False):
with gevent.Timeout(60,False):
while notok:
allok=True
for mot,target in list(zip(motor_list,target_list)):
......@@ -323,16 +334,17 @@ class grob_FIP(object):
if not(self.SIMU) and not(checkonly):
self.dewar.open()
self.detcover.close()
self.detcover.force_close()
self.cryolong.down()
self.mca.remove()
self.bstop1.down()
self.dstop.down()
self.backlight.down()
self.cryoshort.up()
self.keyence.on()
self.fastshut.close_manual()
for retry in range(0,10):
for retry in range(0,60):
if self.SIMU:
return True
else:
......@@ -353,6 +365,11 @@ class grob_FIP(object):
else:
txt+="DStop down\t\t"+CRED+"[NOK]\n"+CEND
ok=False
if self.backlight.is_down():
txt+="Backlight down\t\t"+CGRE+"[OK]\n"+CEND
else:
txt+="Backlight down\t\t"+CRED+"[NOK]\n"+CEND
ok=False
if self.cryoshort.is_up():
txt+="Cryo Short up\t\t"+CGRE+"[OK]\n"+CEND
else:
......@@ -396,11 +413,12 @@ class grob_FIP(object):
self.mca.remove()
self.bstop1.up()
self.dstop.down()
self.backlight.down()
self.cryoshort.down()
self.keyence.off()
self.fastshut.close_manual()
for retry in range(0,10):
for retry in range(0,60):
if self.SIMU:
return True
else:
......@@ -421,6 +439,11 @@ class grob_FIP(object):
else:
txt+="DStop down\t\t"+CRED+"[NOK]\n"+CEND
ok=False
if self.backlight.is_down():
txt+="Backlight down\t\t"+CGRE+"[OK]\n"+CEND
else:
txt+="Backlight down\t\t"+CRED+"[NOK]\n"+CEND
ok=False
if self.cryoshort.is_down():
txt+="Cryo Short down\t\t"+CGRE+"[OK]\n"+CEND
else:
......@@ -451,20 +474,18 @@ class grob_FIP(object):
def move_motors_in_sample_mount_geo(self, checkonly=False):
self.init_real_device()
self.omega.velocity = 30
motor_list_first = [ self.omega, self.y]
target_list_first = [ self.omega_mountsample, self.y_mountsample]
motor_list_first = [ self.omega, self.y, self.detfwd]
target_list_first = [ self.omega_mountsample, self.y_mountsample, self.detfwd_mountsample]
motor_list_next = [ self.kappa,
self.x,
self.z,
self.xomega,
self.zomega,
self.detfwd]
self.zomega]
target_list_next = [self.kappa_mountsample,
self.x_mountsample,
self.z_mountsample,
self.xomega_mountsample,
self.zomega_mountsample,
self.detfwd_mountsample]
self.zomega_mountsample]
#first y and omega to be sure no collision
if self.SIMU:
return self.state_gonio == 2
......@@ -488,7 +509,11 @@ class grob_FIP(object):
self.xomega_collectsample,
self.zomega_collectsample]
motor_list_next = [ self.omega, self.y]
target_list_next = [ self.omega_collectsample, self.y_collectsample]
if self.need_y_long:
target_list_next = [ self.omega_collectsample, self.y_collectsample_long]
else:
target_list_next = [ self.omega_collectsample, self.y_collectsample]
#and by y and omega to be sure no collision
if self.SIMU :
......
from bliss.controllers.motor import CalcController
from bliss.common.logtools import *
from bm07 import inclino_FIP
#from bliss import global_map
#from bliss.controllers.tango_attr_as_counter import tango_attr_as_counter
from math import asin,sin
class bragg(CalcController):
def __init__(self, *args, **kwargs):
CalcController.__init__(self, *args, **kwargs)
......@@ -60,24 +59,3 @@ class bend_calc(CalcController):
return {"bend2":bend2, "bend1":bend1}
#class inclino(tango_attr_as_counter):
# def __init__(self, name, config):
# tango_attr_as_counter.__init__(self, name, config)
# self.offset = float(config.get("offset"))
# self.sign = float(config.get("sign"))
# def convert_func(self, raw_value):
# # reecriture de cette fonction pour prendre en compte le signe et l'offset
# """
# Apply to the <raw_value>:
# * conversion_factor
# * formatting
# """
# log_debug(self, "raw_value=%s", raw_value)
# attr_val = raw_value * self.conversion_factor
# formated_value = float(
# self.format_string % attr_val if self.format_string else attr_val
# )
# return self.sign*(formated_value-self.offset)
\ No newline at end of file
......@@ -961,3 +961,34 @@ def nrjcal_vYo2(eMin, eMax, eStep, tMoy):
txt+="%f %f %f %f %f\n"%(energy.position, beta.position, p0,counts[0], counts[0], counts[1])
print(txt)
def opensh():
fastshut.open_manual()
def closesh():
fastshut.close_manual()
def intmax():
detcover.force_close()
bstop1.down()
dstop_up_down.up()
fastshut.open_manual()
transmission.set(0.5)
mv(sl2ha,0.08)
mv(sl2va,0.06)
fastscan.gamma2_short.scan()
fastscan.alpha2_dstop.scan()
#initkhi2 = khi2.position
#fastscan.khi2_dstop.scan()
#finalkhi2 = khi2.position
#mvr(khi2,(finalkhi2-initkhi2)*0.)
#fastscan.gamma2_short.scan()
#initkhi2 = khi2.position
#fastscan.khi2_dstop.scan()
#finalkhi2 = khi2.position
#mvr(khi2,(finalkhi2-initkhi2)*0.)
#fastscan.gamma2_short.scan()
#fastscan.alpha2_dstop.scan()
fastshut.close_manual()
transmission.set(100)
slits_sample.A250()
\ No newline at end of file
from bliss.common.hook import MotionHook
from bliss import global_map
from bliss.setup_globals import *
class GonioSafety(MotionHook):
class SafetyError(Exception):
pass
def __init__(self):
super(GonioSafety, self).__init__()
def init(self):
pass
def pre_move(self, motion_list):
for motion in motion_list:
if motion.axis.disabled:
raise self.SafetyError(
f'Cannot move : {motion.axis.name} is disabled')
if motion.axis.name == "omega" and kappa.position > 10:
raise self.SafetyError(
f'Cannot move : possible collision due to kappa')
if motion.axis.name == "kappa" and (
not (omega.position > 120 and omega.position < 140)
and
not (omega.position > -10 and omega.position < 10)
):
raise self.SafetyError(
f'Cannot move : possible collision due to omega')
GonioSafetyHook = GonioSafety()
omega.motion_hooks.append(GonioSafetyHook)
kappa.motion_hooks.append(GonioSafetyHook)
\ No newline at end of file
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