Start adding stage test and apply fixes to base class

This commit is contained in:
Julian Stirling 2025-08-01 16:01:59 +01:00
parent 7e5a455b75
commit 58e3b5dcbd
5 changed files with 183 additions and 5 deletions

View file

@ -88,18 +88,18 @@ class BaseStage(lt.Thing):
axis_direction = lt.ThingSetting(
initial_value={"x": 1, "y": 1, "z": 1},
model=Mapping[str, int],
readonly=True,
)
"""Used to convert coordinates between the program frame and the hardware frame."""
def _apply_axis_direction(
self, position: Sequence[int] | Mapping[str | int]
self, position: list[int] | tuple[int] | Mapping[str | int]
) -> list[int] | Mapping[str | int]:
if isinstance(position, Sequence):
position = [
if isinstance(position, (list, tuple)):
return [
pos * ax_dir
for pos, ax_dir in zip(position, self.axis_direction.values())
]
return dict(zip(self.axis_names, position))
if isinstance(position, Mapping):
try:
return {

View file

@ -36,6 +36,13 @@ class DummyStage(BaseStage):
def __exit__(self, _exc_type, _exc_value, _traceback):
"""Nothing to do when the Thing context manager is closed."""
axis_direction = lt.ThingSetting(
initial_value={"x": -1, "y": 1, "z": 1},
model=Mapping[str, int],
readonly=True,
)
"""Used to convert coordinates between the program frame and the hardware frame."""
def _hardware_move_relative(
self,
cancel: lt.deps.CancelHook,

View file

@ -69,6 +69,7 @@ class SangaboardThing(BaseStage):
axis_direction = lt.ThingSetting(
initial_value={"x": -1, "y": 1, "z": -1},
model=Mapping[str, int],
readonly=True,
)
"""Used to convert coordinates between the program frame and the hardware frame."""