Commit 287564fe authored by blissadm_ID31@bibhelm's avatar blissadm_ID31@bibhelm
Browse files

common/axis.py: rename home => home_search, add new `.home()` method

Homing is now a procedure that does the home search, then reads home
position from the motor controller, if possible, and finally moves
back to this home position. Optionally, a set position can be passed
to set the position on the axis at the end.
parent ea1e311d
......@@ -1469,7 +1469,7 @@ class Axis(AliasMixin, LogMixin):
self.stop()
@lazy_init
def home(self, switch=1, wait=True, polling_time=DEFAULT_POLLING_TIME):
def home_search(self, switch=1, wait=True, polling_time=DEFAULT_POLLING_TIME):
"""
Searches the home switch
......@@ -1504,6 +1504,24 @@ class Axis(AliasMixin, LogMixin):
def _wait_home(self, *args):
self._move_loop(ctrl_state_funct="home_state")
def home(
self,
switch=1,
set_position=None,
reset_dial=True,
polling_time=DEFAULT_POLLING_TIME,
):
self.home_search(switch)
try:
home_pos = self.controller.read_home_position(self)
except NotImplementedError:
home_pos = self.position
self.move(home_pos)
if set_position is not None:
self.position = set_position
if reset_dial:
self.dial = set_position
@lazy_init
def hw_limit(self, limit, wait=True, polling_time=DEFAULT_POLLING_TIME):
"""
......
......@@ -392,6 +392,9 @@ class Controller(LogMixin):
def home_state(self, axis):
raise NotImplementedError
def read_home_position(self, axis):
raise NotImplementedError
def limit_search(self, axis, limit):
raise NotImplementedError
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment