Estimate move duraction added to each stage class
This commit is contained in:
parent
f4d11b3c83
commit
7ed718cbae
3 changed files with 15 additions and 2 deletions
|
|
@ -249,8 +249,9 @@ class BaseStage(lt.Thing):
|
||||||
|
|
||||||
def _estimate_move_duration(self, displacement: Sequence[int]) -> float:
|
def _estimate_move_duration(self, displacement: Sequence[int]) -> float:
|
||||||
"""Calculate the expected duration of a move with the given displacement."""
|
"""Calculate the expected duration of a move with the given displacement."""
|
||||||
max_displacement = max(abs(d) for d in displacement)
|
raise NotImplementedError(
|
||||||
return max_displacement * 0.001 # This does not yet check the board's speed.
|
"StageThings must define their own _estimate_move_duration"
|
||||||
|
)
|
||||||
|
|
||||||
@lt.action
|
@lt.action
|
||||||
def jog(self, stop: bool = False, **kwargs: int) -> None:
|
def jog(self, stop: bool = False, **kwargs: int) -> None:
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,12 @@ class DummyStage(BaseStage):
|
||||||
self.moving = moving
|
self.moving = moving
|
||||||
return 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(
|
def _hardware_move_relative(
|
||||||
self,
|
self,
|
||||||
block_cancellation: bool = False,
|
block_cancellation: bool = False,
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,12 @@ class SangaboardThing(BaseStage):
|
||||||
self.moving = moving
|
self.moving = moving
|
||||||
return 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(
|
def _hardware_move_relative(
|
||||||
self,
|
self,
|
||||||
block_cancellation: bool = False,
|
block_cancellation: bool = False,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue