if pause_reason == 'User stop':
self.planner.stop()
+ self.planner.update_position()
self.ctrl.state.set('line', 0)
else: self.planner.restart()
def is_running(self): return self.planner.is_running()
- def get_config(self, mdi, with_limits, with_position = True):
+ def update_position(self):
+ self.planner.set_position(self.ctrl.state.get_position())
+
+
+ def get_config(self, mdi, with_limits):
state = self.ctrl.state
config = self.ctrl.config
# TODO junction deviation & accel
}
- if with_position: cfg['position'] = state.get_position()
-
if with_limits:
minLimit = state.get_soft_limit_vector('tn', -math.inf)
maxLimit = state.get_soft_limit_vector('tm', math.inf)
self.planner = gplan.Planner()
self.planner.set_resolver(self._get_var_cb)
self.planner.set_logger(self._log_cb, 1, 'LinePlanner:3')
+ self.update_position()
self.cmdq.clear()
self.reset_times()
self.ctrl.state.reset()
# Copy state for thread
state = self.ctrl.state.snapshot()
- config = self.ctrl.mach.planner.get_config(False, False, False)
+ config = self.ctrl.mach.planner.get_config(False, False)
del config['default-units']
# Start planner thread