fixed bug that lead galil to quit unexpectedly
This commit is contained in:
parent
e66208ca18
commit
0b774f25dd
@ -134,8 +134,10 @@ class GalilController(Controller):
|
|||||||
f"Expected return value of ':' but instead received {return_val}"
|
f"Expected return value of ':' but instead received {return_val}"
|
||||||
)
|
)
|
||||||
|
|
||||||
def is_axis_moving(self, axis_Id) -> bool:
|
def is_axis_moving(self, axis_Id, axis_Id_numeric) -> bool:
|
||||||
return bool(float(self.socket_put_and_receive(f"MG_BG{axis_Id}")))
|
is_moving = bool(float(self.socket_put_and_receive(f"MG_BG{axis_Id}")) != 0)
|
||||||
|
backlash_is_active = bool(float(self.socket_put_and_receive(f"MGbcklact[axis]")) != 0)
|
||||||
|
return bool(is_moving or backlash_is_active)
|
||||||
|
|
||||||
def is_thread_active(self, thread_id: int) -> bool:
|
def is_thread_active(self, thread_id: int) -> bool:
|
||||||
val = float(self.socket_put_and_receive(f"MG_XQ{thread_id}"))
|
val = float(self.socket_put_and_receive(f"MG_XQ{thread_id}"))
|
||||||
@ -254,9 +256,9 @@ class GalilReadbackSignal(GalilSignalRO):
|
|||||||
val = super().read()
|
val = super().read()
|
||||||
if self.parent.axis_Id_numeric == 2:
|
if self.parent.axis_Id_numeric == 2:
|
||||||
try:
|
try:
|
||||||
self.parent.device_manager.devices[
|
rt = self.parent.device_manager.devices[self.parent.rt]
|
||||||
self.parent.rt
|
if rt.enabled:
|
||||||
].obj.controller.set_rotation_angle(val[self.parent.name]["value"])
|
rt.obj.controller.set_rotation_angle(val[self.parent.name]["value"])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.warning("Failed to set RT value during readback.")
|
logger.warning("Failed to set RT value during readback.")
|
||||||
return val
|
return val
|
||||||
@ -306,6 +308,8 @@ class GalilSetpointSignal(GalilSignalBase):
|
|||||||
self.controller.socket_put_confirmed(f"ntarget={target_val:.3f}")
|
self.controller.socket_put_confirmed(f"ntarget={target_val:.3f}")
|
||||||
self.controller.socket_put_confirmed("movereq=1")
|
self.controller.socket_put_confirmed("movereq=1")
|
||||||
self.controller.socket_put_confirmed("XQ#NEWPAR")
|
self.controller.socket_put_confirmed("XQ#NEWPAR")
|
||||||
|
while self.controller.is_thread_active(0):
|
||||||
|
time.sleep(0.005)
|
||||||
else:
|
else:
|
||||||
raise GalilError("Not all axes are referenced.")
|
raise GalilError("Not all axes are referenced.")
|
||||||
|
|
||||||
@ -323,7 +327,7 @@ class GalilMotorIsMoving(GalilSignalRO):
|
|||||||
@threadlocked
|
@threadlocked
|
||||||
def _socket_get(self):
|
def _socket_get(self):
|
||||||
return (
|
return (
|
||||||
self.controller.is_axis_moving(self.parent.axis_Id)
|
self.controller.is_axis_moving(self.parent.axis_Id, self.parent.axis_Id_numeric)
|
||||||
or self.controller.is_thread_active(0)
|
or self.controller.is_thread_active(0)
|
||||||
or self.controller.is_thread_active(2)
|
or self.controller.is_thread_active(2)
|
||||||
)
|
)
|
||||||
@ -494,9 +498,10 @@ class GalilMotor(Device, PositionerBase):
|
|||||||
position,
|
position,
|
||||||
atol=self.tolerance,
|
atol=self.tolerance,
|
||||||
)
|
)
|
||||||
self._done_moving(success=success)
|
|
||||||
if not success:
|
if not success:
|
||||||
print(" stop")
|
print(" stop")
|
||||||
|
self._done_moving(success=success)
|
||||||
logger.info("Move finished")
|
logger.info("Move finished")
|
||||||
|
|
||||||
threading.Thread(target=move_and_finish, daemon=True).start()
|
threading.Thread(target=move_and_finish, daemon=True).start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user