Draft of new semantics
This commit is contained in:
parent
b39a0653f2
commit
19af98736d
13 changed files with 252 additions and 187 deletions
|
|
@ -14,7 +14,7 @@ class BaseStage(metaclass=ABCMeta):
|
|||
self.lock = StrictLock(timeout=5)
|
||||
|
||||
@abstractmethod
|
||||
def apply_settings(self, config: dict):
|
||||
def update_settings(self, config: dict):
|
||||
"""Update settings from a config dictionary"""
|
||||
pass
|
||||
|
||||
|
|
@ -29,12 +29,14 @@ class BaseStage(metaclass=ABCMeta):
|
|||
|
||||
@property
|
||||
@abstractmethod
|
||||
def status(self):
|
||||
"""The general state dictionary of the board.
|
||||
Should at least contain 'position', and 'board' keys.
|
||||
Note: A None/Null value for 'board' will disable stage
|
||||
movement in the OpenFlexure eV client software,
|
||||
"""
|
||||
def state(self):
|
||||
"""The general state dictionary of the board."""
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def configuration(self):
|
||||
"""The general stage configuration."""
|
||||
pass
|
||||
|
||||
@property
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import time
|
|||
import logging
|
||||
|
||||
|
||||
class MockStage(BaseStage):
|
||||
class MissingStage(BaseStage):
|
||||
def __init__(self, port=None, **kwargs):
|
||||
BaseStage.__init__(self)
|
||||
self._position = [0, 0, 0]
|
||||
|
|
@ -17,19 +17,17 @@ class MockStage(BaseStage):
|
|||
self.axis_names = ["x", "y", "z"] # Assume all sangaboards are 3 axis
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
def state(self):
|
||||
"""The general status dictionary of the board."""
|
||||
status = {
|
||||
"position": self.position_map,
|
||||
"board": None,
|
||||
"firmware": None,
|
||||
"version": None,
|
||||
}
|
||||
status = {"position": self.position_map}
|
||||
return status
|
||||
|
||||
def apply_settings(self, config: dict):
|
||||
"""Update settings from a config dictionary"""
|
||||
@property
|
||||
def configuration(self):
|
||||
return {}
|
||||
|
||||
def update_settings(self, config: dict):
|
||||
"""Update settings from a config dictionary"""
|
||||
# Set backlash. Expects a dictionary with axis labels
|
||||
if "backlash" in config:
|
||||
# Construct backlash array
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class SangaStage(BaseStage):
|
|||
"""Class managing serial communications with the motors for an Openflexure stage"""
|
||||
BaseStage.__init__(self)
|
||||
|
||||
self.port = port
|
||||
self.board = Sangaboard(port, **kwargs)
|
||||
|
||||
self._backlash = (
|
||||
|
|
@ -31,14 +32,17 @@ class SangaStage(BaseStage):
|
|||
self.axis_names = ["x", "y", "z"] # Assume all sangaboards are 3 axis
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
def state(self):
|
||||
"""The general status dictionary of the board."""
|
||||
status = {
|
||||
"position": self.position_map,
|
||||
return {"position": self.position_map}
|
||||
|
||||
@property
|
||||
def configuration(self):
|
||||
return {
|
||||
"port": self.port,
|
||||
"board": self.board.board,
|
||||
"firmware": self.board.firmware,
|
||||
}
|
||||
return status
|
||||
|
||||
@property
|
||||
def n_axes(self):
|
||||
|
|
@ -81,7 +85,7 @@ class SangaStage(BaseStage):
|
|||
else:
|
||||
self._backlash = np.array([int(blsh)] * self.n_axes, dtype=np.int)
|
||||
|
||||
def apply_settings(self, config: dict):
|
||||
def update_settings(self, config: dict):
|
||||
"""Update settings from a config dictionary"""
|
||||
|
||||
# Set backlash. Expects a dictionary with axis labels
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue