From 73c56d4e00917643b259273b3f2b7f121d7276d9 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Fri, 5 Jan 2018 01:22:11 -0800 Subject: [PATCH] Implemented pause --- src/py/bbctrl/Cmd.py | 3 ++- src/py/bbctrl/Planner.py | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/py/bbctrl/Cmd.py b/src/py/bbctrl/Cmd.py index f0067e2..32107ba 100644 --- a/src/py/bbctrl/Cmd.py +++ b/src/py/bbctrl/Cmd.py @@ -34,10 +34,11 @@ def encode_axes(axes): def line_number(line): return '#ln=%d' % line -def line(id, target, exitVel, maxJerk, times): +def line(id, target, exitVel, maxAccel, maxJerk, times): cmd = '#id=%u\nl' % id cmd += encode_float(exitVel) + cmd += encode_float(maxAccel) cmd += encode_float(maxJerk) cmd += encode_axes(target) diff --git a/src/py/bbctrl/Planner.py b/src/py/bbctrl/Planner.py index 2695a49..f396ec9 100644 --- a/src/py/bbctrl/Planner.py +++ b/src/py/bbctrl/Planner.py @@ -21,7 +21,7 @@ class Planner(): axis = 'xyzabc'[int(vars.get('%dan' % i))] axis2motor[axis] = i - def get_vector(name, scale): + def get_vector(name, scale = 1): v = {} for axis in 'xyzabc': if axis in axis2motor: @@ -41,9 +41,10 @@ class Planner(): # Planner config self.config = { "start": start, - "max-vel": get_vector('vm', 1), + "max-vel": get_vector('vm'), + "max-accel": get_vector('am'), "max-jerk": get_vector('jm', 1000000), - # TODO max-accel and junction deviation & accel + # TODO junction deviation & accel } log.info('Planner config: ' + json.dumps(self.config)) @@ -60,7 +61,8 @@ class Planner(): if type == 'line': return Cmd.line(block['id'], block['target'], block['exit-vel'], - block['max-jerk'], block['times']) + block['max-accel'], block['max-jerk'], + block['times']) if type == 'ln': return Cmd.line_number(block['line']) if type == 'tool': return Cmd.tool(block['tool']) -- 2.27.0