Skip to content

Commit

Permalink
added backlash compensation in negative direction
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Briegel committed Aug 30, 2023
1 parent ccb1cac commit 1c87c17
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions python/lvmtan/BasdaMoccaTrajCluPythonServiceWorker.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ async def slewStart(
self.positive_direction = (traj[0][2] - traj[1][2]) < 0
U1_LOG(f"{traj} {self.positive_direction}")

backlashInSteps = self.backlashInSteps if self.positive_direction else -self.backlashInSteps

incencoder = self.service.getIncrementalEncoderPosition() - self.homeToIncEncOffset
devencoder = self.service.getDeviceEncoderPosition("STEPS")
Expand All @@ -342,7 +343,7 @@ async def slewStart(
self.service.setPosition(incencoder, "STEPS")

# I_LOG(f"field angle {position} steps")
self.service.moveAbsoluteStart(position - self.backlashInSteps, "STEPS")
self.service.moveAbsoluteStart(position - backlashInSteps, "STEPS")

while not self.service.moveAbsoluteCompletion().isDone():
await asyncio.sleep(0.5)
Expand All @@ -356,7 +357,7 @@ async def slewStart(
abs_positioning_compensation = position_current - position
U9_LOG(f"{traj} {abs_positioning_compensation}")

self.service.moveRelative(self.backlashInSteps + abs_positioning_compensation, "STEPS")
self.service.moveRelative(backlashInSteps + abs_positioning_compensation, "STEPS")

position_error = position_current - self.service.getDeviceEncoderPosition("STEPS")

Expand All @@ -365,9 +366,6 @@ async def slewStart(
command.warning(LostSteps=position_error)
raise LvmTanPositionError(position_error)




except Exception as e:
return command.fail(error=e)

Expand Down

0 comments on commit 1c87c17

Please sign in to comment.