Fixing "stuck in jogging" bug.
This commit is contained in:
@@ -123,6 +123,12 @@ class Mach(Comm):
|
||||
if log['msg'] == 'Switch not found':
|
||||
self.estop()
|
||||
|
||||
def _end_cycle(self):
|
||||
if (self._get_cycle() != 'idle' and self._is_ready()
|
||||
and not self.planner.is_busy() and not super().is_active()):
|
||||
self.planner.position_change()
|
||||
self._set_cycle('idle')
|
||||
|
||||
def _update(self, update):
|
||||
# Detect motor faults
|
||||
for motor in range(4):
|
||||
@@ -138,11 +144,9 @@ class Mach(Comm):
|
||||
if state_changed and state == 'ESTOPPED':
|
||||
self.planner.reset(stop=False)
|
||||
|
||||
# Exit cycle if state changed to READY
|
||||
if (state_changed and self._get_cycle() != 'idle' and self._is_ready()
|
||||
and not self.planner.is_busy() and not super().is_active()):
|
||||
self.planner.position_change()
|
||||
self._set_cycle('idle')
|
||||
# Check if cycle has ended
|
||||
if state_changed:
|
||||
self._end_cycle()
|
||||
|
||||
# Planner stop
|
||||
if state == 'READY' and self.stopping:
|
||||
@@ -191,8 +195,13 @@ class Mach(Comm):
|
||||
|
||||
@overrides(Comm)
|
||||
def comm_next(self):
|
||||
if self.planner.is_running() and not self._is_holding():
|
||||
return self.planner.next()
|
||||
shouldFetch = self.planner.is_running() and not self._is_holding()
|
||||
cmd = self.planner.next() if shouldFetch else None
|
||||
|
||||
if cmd is None:
|
||||
self._end_cycle()
|
||||
|
||||
return cmd
|
||||
|
||||
@overrides(Comm)
|
||||
def comm_error(self):
|
||||
|
||||
Reference in New Issue
Block a user