diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-07-22 15:38:13 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-07-22 15:42:18 -0400 |
commit | 589017a3d6de81a52c5a496a4b82ae202a4f990c (patch) | |
tree | c89f1a375a3d2285c235ee544ded0a06fdf6d2bb /klippy/stepper.py | |
parent | d3c27c514f763ce65a5fea7f6c17ecff49130721 (diff) | |
download | kutter-589017a3d6de81a52c5a496a4b82ae202a4f990c.tar.gz kutter-589017a3d6de81a52c5a496a4b82ae202a4f990c.tar.xz kutter-589017a3d6de81a52c5a496a4b82ae202a4f990c.zip |
stepper: Have caller calculate max jerk velocity
Allow the owner of the stepper object to cacluate the maximum step
jerk velocity. This is used to ensure there is no communication error
between mcu and host.
Disable checking of jerk velocity for extruder stepper motors.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/stepper.py')
-rw-r--r-- | klippy/stepper.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/klippy/stepper.py b/klippy/stepper.py index 5a05e910..7c8438fc 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -15,6 +15,7 @@ class PrinterStepper: self.inv_step_dist = 1. / self.step_dist self.max_velocity = config.getfloat('max_velocity') self.max_accel = config.getfloat('max_accel') + self.max_jerk = 0. self.homing_speed = config.getfloat('homing_speed', 5.0) self.homing_positive_dir = config.getboolean( @@ -26,6 +27,8 @@ class PrinterStepper: self.clock_ticks = None self.need_motor_enable = True + def set_max_jerk(self, max_jerk): + self.max_jerk = max_jerk def build_config(self): self.clock_ticks = self.printer.mcu.get_mcu_freq() max_error = self.config.getfloat('max_error', 0.000050) @@ -33,9 +36,10 @@ class PrinterStepper: step_pin = self.config.get('step_pin') dir_pin = self.config.get('dir_pin') - jc = 0.005 # XXX + jc = self.max_jerk / self.max_accel inv_max_step_accel = self.step_dist / self.max_accel - min_stop_interval = int((math.sqrt(inv_max_step_accel + jc**2) - jc) + min_stop_interval = int((math.sqrt(3.*inv_max_step_accel + jc**2) + - math.sqrt(inv_max_step_accel + jc**2)) * self.clock_ticks) - max_error min_stop_interval = max(0, min_stop_interval) mcu = self.printer.mcu |