Skip to content

Commit

Permalink
ENH: add edge detection
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasM2001 committed May 6, 2024
1 parent e84bb14 commit 5695595
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions basil/HL/mercury.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
from basil.HL.RegisterHardwareLayer import HardwareLayer

import time


class Mercury(HardwareLayer):
'''Driver for the Physiks Instruments Mercury Controller.
Expand Down Expand Up @@ -84,3 +86,27 @@ def abort(self, address=None):
def find_edge(self, n, address=None):
self._write_command("FE%d" % n, address)

def wait_pos(self, target,precision,address): #waits/prints position until desired precision is reached
print("Moving motore from:",self.get_position(address),"to" ,target) #absolute target
done=False
while done is False:
pos=self.get_position(address)
print("motor at",pos,"moving to",target)
if abs(pos-target)<= precision:
done=True
else:
time.sleep(0.5)
return pos

def wait_FE(self, address): #waits until motor stops moving
print(self.get_position(address),"Moving")
done=False
while done is False:
a=self.get_position(address)
time.sleep(1)
b=self.get_position(address)
if a == b:
done=True
else:
time.sleep(0.5)
return b

0 comments on commit 5695595

Please sign in to comment.