axis sync_hard and axis channel: bad state
Reported by @beteva
Session 1: Start a motion: roby => move => state MOVING + is_moving True + position updated/changing
(note: if motion started with wait=False, it is possible to do roby.sync_hard() without error
and it does not change the state (i.e still MOVING) )
def sync_hard(self):
"""Forces an axis synchronization with the hardware"""
self.settings.set("state", self.hw_state)
self._update_dial()
self._set_position = self.position
if self.closed_loop is not None:
self.closed_loop.sync_hard()
event.send(self, "sync_hard")
Session 2:
roby => once in motion from Session 1 => state MOVING + position updated (ok we can see roby in motion)
Do roby.sync_hard() => state is MOVING + is_moving, but in session 1( which initiated the move) state is READY + is_moving False.
In both sessions the position is still updated and changing (i.e the motor is really moving) => roby.stop() does not stop (because session2 think is not moving)
Executing roby.sync_hard() in session 1 before or after the one in session 2, does not change the state in both sessions
Actually if there is session X, where the motor is in MOVING state (no matter which session initiated the movement), executing sync_hard in session Y makes the motor state in session X READY, but the motor continues to move. In session Y the state is still MOVING.
Extra notes: If roby is already in motion from session1 when it is initialized in session2, roby become disabled ! Also, it seems important to be able in session 2 to call safely sync_hard() without knowing if motor is moving or not from another session.