More stable SmarGon movement
This commit is contained in:
@@ -188,17 +188,15 @@ class SmarGonAxis(PVPositioner):
|
||||
"""Move command that's masked by BEC"""
|
||||
return self.omove(position, wait, timeout, moved_cb)
|
||||
|
||||
def omove(self, position, wait=True, timeout=None, moved_cb=None):
|
||||
def omove(self, position, wait=True, timeout=2.0, moved_cb=None):
|
||||
"""Original move command without the BEC wrappers"""
|
||||
status = self.setpoint.set(position, settle_time=0.1)
|
||||
status = self.setpoint.set(position, settle_time=0.1).wait()
|
||||
if not wait:
|
||||
return status
|
||||
|
||||
status.wait()
|
||||
|
||||
def on_target(*, value, **_):
|
||||
distance = abs(value - position)
|
||||
print(distance)
|
||||
distance = abs(value - self.setpoint._value)
|
||||
print(f"[self.name] Distance: {distance}")
|
||||
return bool(distance < self._tol)
|
||||
|
||||
status = SubscriptionStatus(self.readback, on_target, timeout=timeout, settle_time=0.1)
|
||||
@@ -214,8 +212,14 @@ class SmarGonAxis(PVPositioner):
|
||||
with mutex:
|
||||
r = requests.get(cmd, timeout=1, **kwargs)
|
||||
except TimeoutError:
|
||||
with mutex:
|
||||
r = requests.get(cmd, timeout=1, **kwargs)
|
||||
try:
|
||||
time.sleep(0.05)
|
||||
with mutex:
|
||||
r = requests.get(cmd, timeout=0.5, **kwargs)
|
||||
except TimeoutError:
|
||||
time.sleep(0.05)
|
||||
with mutex:
|
||||
r = requests.get(cmd, timeout=0.5, **kwargs)
|
||||
if not r.ok:
|
||||
raise RuntimeError(
|
||||
f"[{self.name}] Error getting {address}; reply was {r.status_code} => {r.reason}"
|
||||
@@ -229,8 +233,14 @@ class SmarGonAxis(PVPositioner):
|
||||
with mutex:
|
||||
r = requests.put(cmd, timeout=1, **kwargs)
|
||||
except TimeoutError:
|
||||
with mutex:
|
||||
r = requests.put(cmd, timeout=1, **kwargs)
|
||||
try:
|
||||
time.sleep(0.05)
|
||||
with mutex:
|
||||
r = requests.put(cmd, timeout=0.5, **kwargs)
|
||||
except TimeoutError:
|
||||
time.sleep(0.05)
|
||||
with mutex:
|
||||
r = requests.put(cmd, timeout=0.5, **kwargs)
|
||||
if not r.ok:
|
||||
raise RuntimeError(
|
||||
f"[{self.name}] Error putting {address}; reply was {r.status_code} => {r.reason}"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from bec_widgets.cli.client_utils import BECGuiClient
|
||||
|
||||
|
||||
|
||||
def bl_check_beam():
|
||||
"""Check beamline status before scan"""
|
||||
return True
|
||||
|
||||
|
||||
def ascan(
|
||||
@@ -22,8 +24,8 @@ def ascan(
|
||||
--------
|
||||
ascan(dev.dccm_energy, 12,13, steps=21, exp_time=0.1, datasource=dev.dccm_xbpm)
|
||||
"""
|
||||
# if not bl_check_beam():
|
||||
# raise RuntimeError("Beamline is not in ready state")
|
||||
if not bl_check_beam():
|
||||
raise RuntimeError("Beamline is not in ready state")
|
||||
|
||||
# # GUI setup
|
||||
# # Get or create gui
|
||||
@@ -35,7 +37,7 @@ def ascan(
|
||||
# window = val.widget
|
||||
# window.clear_all()
|
||||
# if window is None:
|
||||
# window = gui.new("Current scan")
|
||||
# window = gui.new("CurrentScan")
|
||||
|
||||
# dock = window.add_dock(f"ScanDisplay {motor}")
|
||||
# plt1 = dock.add_widget('BECWaveformWidget')
|
||||
|
||||
Reference in New Issue
Block a user