Estimate move duraction added to each stage class

This commit is contained in:
Julian Stirling 2026-02-13 17:05:24 +00:00
parent f4d11b3c83
commit 7ed718cbae
3 changed files with 15 additions and 2 deletions

View file

@ -249,8 +249,9 @@ class BaseStage(lt.Thing):
def _estimate_move_duration(self, displacement: Sequence[int]) -> float:
"""Calculate the expected duration of a move with the given displacement."""
max_displacement = max(abs(d) for d in displacement)
return max_displacement * 0.001 # This does not yet check the board's speed.
raise NotImplementedError(
"StageThings must define their own _estimate_move_duration"
)
@lt.action
def jog(self, stop: bool = False, **kwargs: int) -> None:

View file

@ -131,6 +131,12 @@ class DummyStage(BaseStage):
self.moving = moving
return moving
def _estimate_move_duration(self, displacement: Sequence[int]) -> float:
"""Calculate the expected duration of a move with the given displacement."""
max_displacement = max(abs(d) for d in displacement)
# This does not yet check the board's speed.
return max_displacement * self.step_time
def _hardware_move_relative(
self,
block_cancellation: bool = False,

View file

@ -137,6 +137,12 @@ class SangaboardThing(BaseStage):
self.moving = moving
return moving
def _estimate_move_duration(self, displacement: Sequence[int]) -> float:
"""Calculate the expected duration of a move with the given displacement."""
max_displacement = max(abs(d) for d in displacement)
# This does not yet check the board's speed.
return max_displacement * 0.001
def _hardware_move_relative(
self,
block_cancellation: bool = False,