Enable stage coordinate zeroing
This commit is contained in:
parent
2f4959885c
commit
3db99fee2f
6 changed files with 43 additions and 1 deletions
|
|
@ -74,6 +74,11 @@ class BaseStage(metaclass=ABCMeta):
|
|||
"""Make an absolute move to a position"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def zero_position(self):
|
||||
"""Set the current position to zero"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def close(self):
|
||||
"""Cleanly close communication with the stage"""
|
||||
|
|
|
|||
|
|
@ -96,5 +96,9 @@ class MockStage(BaseStage):
|
|||
self._position = list(final)
|
||||
logging.debug(f"New position: {self._position}")
|
||||
|
||||
def zero_position(self):
|
||||
"""Set the current position to zero"""
|
||||
self._position = [0, 0, 0]
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -147,6 +147,11 @@ class SangaStage(BaseStage):
|
|||
with self.lock:
|
||||
self.board.move_abs(final, **kwargs)
|
||||
|
||||
def zero_position(self):
|
||||
"""Set the current position to zero"""
|
||||
with self.lock:
|
||||
self.board.zero_position()
|
||||
|
||||
def close(self):
|
||||
"""Cleanly close communication with the stage"""
|
||||
if hasattr(self, "board"):
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class Sangaboard(ExtensibleSerialInstrument):
|
|||
|
||||
# These are the settings for the sangaboards serial port, and can usually be left as default.
|
||||
port_settings = {
|
||||
"baudrate": 115200,
|
||||
"baudrate": 115_200,
|
||||
"bytesize": EIGHTBITS,
|
||||
"parity": PARITY_NONE,
|
||||
"stopbits": STOPBITS_ONE,
|
||||
|
|
@ -215,6 +215,10 @@ class Sangaboard(ExtensibleSerialInstrument):
|
|||
"""De-energise the stepper motor coils"""
|
||||
self.query("release")
|
||||
|
||||
def zero_position(self):
|
||||
"""Set the current position to zero"""
|
||||
self.query("zero")
|
||||
|
||||
def move_abs(self, final, **kwargs):
|
||||
"""Make an absolute move to a position
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue