mirror of https://github.com/Desuuuu/klipper.git
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>
This commit is contained in:
parent
d3c27c514f
commit
589017a3d6
|
@ -15,6 +15,8 @@ class CartKinematics:
|
|||
for n in steppers]
|
||||
self.stepper_pos = [0, 0, 0]
|
||||
def build_config(self):
|
||||
for stepper in self.steppers[:2]:
|
||||
stepper.set_max_jerk(0.005 * stepper.max_accel) # XXX
|
||||
for stepper in self.steppers:
|
||||
stepper.build_config()
|
||||
def set_position(self, newpos):
|
||||
|
|
|
@ -14,6 +14,7 @@ class PrinterExtruder:
|
|||
self.stepper_pos = 0
|
||||
def build_config(self):
|
||||
self.heater.build_config()
|
||||
self.stepper.set_max_jerk(9999999.9)
|
||||
self.stepper.build_config()
|
||||
def get_max_speed(self):
|
||||
return self.stepper.max_velocity, self.stepper.max_accel
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue