Skip to content

Commit fe5d73e

Browse files
Stage can move now both axes synchronously. move_to and move_by return when both axes are done
1 parent 7a60b40 commit fe5d73e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

microscope/controllers/asi.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,19 @@ def move_command(self, command: bytes) -> None:
341341
# other process to check position
342342
# self.get_command(command)
343343

344-
def move_by_relative_position(self, axis: int, delta: float) -> None:
344+
def move_by_relative_position(self, axis: int, delta: float, wait=True) -> None:
345345
"""Send a relative movement command to stated axis"""
346346
axis_name = self._axis_mapper[axis]
347347
self.move_command(bytes(f"MOVREL {axis_name}={str(delta)}", "ascii"))
348-
self.wait_for_motor_stop(axis)
348+
if wait:
349+
self.wait_for_motor_stop(axis)
349350

350-
def move_to_absolute_position(self, axis: int, pos: float) -> None:
351+
def move_to_absolute_position(self, axis: int, pos: float, wait=True) -> None:
351352
"""Send a relative movement command to stated axis"""
352353
axis_name = self._axis_mapper[axis]
353354
self.move_command(bytes(f"MOVE {axis_name}={str(pos)}", "ascii"))
354-
self.wait_for_motor_stop(axis)
355+
if wait:
356+
self.wait_for_motor_stop(axis)
355357

356358
def move_to_limit(self, axis: int, speed: int):
357359
axis_name = self._axis_mapper[axis]
@@ -571,6 +573,7 @@ def move_by(self, delta: typing.Mapping[str, float]) -> None:
571573
self._dev_conn.move_by_relative_position(
572574
int(axis_name),
573575
int(axis_delta),
576+
wait=False
574577
)
575578
self._dev_conn.wait_until_idle()
576579

@@ -581,6 +584,7 @@ def move_to(self, position: typing.Mapping[str, float]) -> None:
581584
self._dev_conn.move_to_absolute_position(
582585
int(axis_name),
583586
int(axis_position),
587+
wait=False
584588
)
585589
self._dev_conn.wait_until_idle()
586590

0 commit comments

Comments
 (0)