Apply suggestions from code review of branch backlash-in-stage

Co-authored-by: Joe Knapper <joe.knapper@glasgow.ac.uk>
This commit is contained in:
Julian Stirling 2026-02-25 20:27:45 +00:00
parent 0527990282
commit 9ab7e50773

View file

@ -148,8 +148,8 @@ class BaseStage(lt.Thing):
"""The number of steps to elimate backlash. The sign sets the direction. """The number of steps to elimate backlash. The sign sets the direction.
A positive number sets the direction of the second move in a backlash correction. A positive number sets the direction of the second move in a backlash correction.
For example is z=200. If the previous move was more than +200 in z then no For example, consider z=200. If the previous move was more than +200 in z, no
correction is needed. If the last movement was negative then a move ov -200, correction is needed. If the last movement was negative then a move of -200,
followed by +200 will wipe out backlash. followed by +200 will wipe out backlash.
""" """
@ -167,7 +167,7 @@ class BaseStage(lt.Thing):
pos_before = dict(self.position) pos_before = dict(self.position)
self._hardware_update_position() self._hardware_update_position()
for axis in self._axis_names: for axis in self._axis_names:
# The state delta is should be 1 for a move equal to backlash steps. # The state delta should be 1 for a move equal to backlash steps.
# moving as this will move the state from 0 (fully disengaged) to # moving as this will move the state from 0 (fully disengaged) to
# 1, fully the other. # 1, fully the other.
delta = (self.position[axis] - pos_before[axis]) / self.backlash_steps[axis] delta = (self.position[axis] - pos_before[axis]) / self.backlash_steps[axis]
@ -339,7 +339,7 @@ class BaseStage(lt.Thing):
check_axes = ("z",) check_axes = ("z",)
case _: case _:
raise ValueError( raise ValueError(
f"Unknown backlash compensation method {self._axis_names}" f"Unknown backlash compensation method {backlash_compensation}"
) )
# Check the backlash state at the end of the move, no need to clip to range of # Check the backlash state at the end of the move, no need to clip to range of