Skip to content

Commit

Permalink
Add home() function for stages
Browse files Browse the repository at this point in the history
  • Loading branch information
mmouchous-ledger committed Nov 13, 2023
1 parent 95cb3e5 commit b339aa1
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pystages/corvus.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ def calibrate(self):
while int(self.send_receive("{0} getcaldone".format(i + 1))) != 3:
time.sleep(0.1)

def home(self):
"""
Execute limit-switch move.
Take caution for collisions before calling this method !
"""
# Call for calibration
self.send("cal")

def move_relative(self, x, y, z):
"""
Move stage relative to current position.
Expand Down
7 changes: 7 additions & 0 deletions pystages/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def __init__(self):
w = QPushButton("Z-")
w.clicked.connect(self.bouton_moved)
grid.addWidget(w, 2, 3)
w = QPushButton("Home")
w.clicked.connect(self.home)
grid.addWidget(w, 2, 2)
vbox.addLayout(grid)

box = QHBoxLayout()
Expand Down Expand Up @@ -135,3 +138,7 @@ def bouton_moved(self):
pos[2] -= float(self.z_offset_sel.currentText())
self.stage.move_to(pos)
self.in_motion = False

def home(self):
if self.stage is None:
return
4 changes: 4 additions & 0 deletions pystages/m3fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,7 @@ def position(self, value: Vector):
@property
def is_moving(self) -> bool:
return bool(self.__get_closed_loop_status()[0] & 4)

def home(self):
"""Nothing specific for the M3FS for homing."""
pass
6 changes: 6 additions & 0 deletions pystages/smc100.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ def position(self, value: Vector):
commands.append(f"{addr}PA{position:.5f}")
self.link.send(None, "\r\n".join(commands))

def home(self):
"""
Perform home search.
"""
self.home_search()

def home_search(self):
"""
Perform home search.
Expand Down
6 changes: 6 additions & 0 deletions pystages/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,9 @@ def maximums(self, value: Optional[Vector]):
if value is not None:
self.check_dimension(value)
self._maximums = value

@property
@abstractmethod
def home(self):
"""Triggers a non-blocking homing command."""
...
4 changes: 4 additions & 0 deletions pystages/tic.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ def reset(self):
def exit_safe_start(self):
self.quick(TicCommand.EXIT_SAFE_START)

def home(self):
"""Triggers a Home command without blocking."""
self.go_home(TicDirection.REVERSE, False)

def go_home(self, direction: TicDirection, wait: bool = True):
"""
Run the homing procedure.
Expand Down

0 comments on commit b339aa1

Please sign in to comment.