Commit 338b0a2a authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

axis: check if ready for the movement in controller.

Check if an axis can move or not is now done in the controller.
parent 2a242c9d
...@@ -1725,16 +1725,8 @@ class Axis: ...@@ -1725,16 +1725,8 @@ class Axis:
self.__move_done_callback.set() self.__move_done_callback.set()
def _check_ready(self): def _check_ready(self):
initial_state = self.state if not self.controller.check_ready_to_move(self, self.state):
if not initial_state.READY and not initial_state.MOVING: raise RuntimeError("axis %s state is " "%r" % (self.name, str(self.state)))
# read state from hardware
initial_state = self.hw_state
self._update_settings(state=initial_state)
if not initial_state.READY:
raise RuntimeError(
"axis %s state is " "%r" % (self.name, str(initial_state))
)
@lazy_init @lazy_init
def move(self, user_target_pos, wait=True, relative=False, polling_time=None): def move(self, user_target_pos, wait=True, relative=False, polling_time=None):
......
...@@ -361,6 +361,17 @@ class Controller: ...@@ -361,6 +361,17 @@ class Controller:
def state(self, axis): def state(self, axis):
raise NotImplementedError raise NotImplementedError
def check_ready_to_move(self, axis, state):
"""
method to check if the axis can move with the current state
"""
if not state.READY and not state.MOVING:
# read state from hardware
state = axis.hw_state
axis._update_settings(state=state)
return state.READY
def get_info(self, axis): def get_info(self, axis):
raise NotImplementedError 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