aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/delta.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-09-03 15:17:02 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-09-03 15:45:04 -0400
commit7a81bfc4a4651c913add10e34e7431513cf8a5f5 (patch)
tree7f3a40804dd52154d864cc71e7a120cddecf4725 /klippy/delta.py
parent0d13834293d0b5db2fc3407bd603dbfaa691402d (diff)
downloadkutter-7a81bfc4a4651c913add10e34e7431513cf8a5f5.tar.gz
kutter-7a81bfc4a4651c913add10e34e7431513cf8a5f5.tar.xz
kutter-7a81bfc4a4651c913add10e34e7431513cf8a5f5.zip
toolhead: Eliminate set_max_jerk() from kinematic classes
Allow the kinematic classes to query the max velocity, max accel, and max halt velocity from the toolhead class instead of having the toolhead class call into the kinematic classes with those values. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/delta.py')
-rw-r--r--klippy/delta.py20
1 files changed, 9 insertions, 11 deletions
diff --git a/klippy/delta.py b/klippy/delta.py
index fc796cd4..5533e83c 100644
--- a/klippy/delta.py
+++ b/klippy/delta.py
@@ -12,13 +12,11 @@ StepList = (0, 1, 2)
SLOW_RATIO = 3.
class DeltaKinematics:
- def __init__(self, printer, config):
- self.config = config
+ def __init__(self, toolhead, printer, config):
self.steppers = [stepper.PrinterHomingStepper(
printer, config.getsection('stepper_' + n), n)
for n in ['a', 'b', 'c']]
self.need_motor_enable = self.need_home = True
- self.max_velocity = self.max_z_velocity = self.max_accel = 0.
radius = config.getfloat('delta_radius', above=0.)
arm_length = config.getfloat('delta_arm_length', above=radius)
self.arm_length2 = arm_length**2
@@ -29,6 +27,14 @@ class DeltaKinematics:
logging.info(
"Delta max build height %.2fmm (radius tapered above %.2fmm)" % (
self.max_z, self.limit_z))
+ # Setup stepper max halt velocity
+ self.max_velocity, self.max_accel = toolhead.get_max_velocity()
+ self.max_z_velocity = config.getfloat(
+ 'max_z_velocity', self.max_velocity,
+ above=0., maxval=self.max_velocity)
+ max_xy_halt_velocity = toolhead.get_max_axis_halt(self.max_accel)
+ for s in self.steppers:
+ s.set_max_jerk(max_xy_halt_velocity, self.max_accel)
# Determine tower locations in cartesian space
angles = [config.getsection('stepper_a').getfloat('angle', 210.),
config.getsection('stepper_b').getfloat('angle', 330.),
@@ -52,14 +58,6 @@ class DeltaKinematics:
% (math.sqrt(self.max_xy2), math.sqrt(self.slow_xy2),
math.sqrt(self.very_slow_xy2)))
self.set_position([0., 0., 0.])
- def set_max_jerk(self, max_xy_halt_velocity, max_velocity, max_accel):
- self.max_velocity = max_velocity
- max_z_velocity = self.config.getfloat(
- 'max_z_velocity', max_velocity, above=0.)
- self.max_z_velocity = min(max_velocity, max_z_velocity)
- self.max_accel = max_accel
- for stepper in self.steppers:
- stepper.set_max_jerk(max_xy_halt_velocity, max_accel)
def _cartesian_to_actuator(self, coord):
return [math.sqrt(self.arm_length2
- (self.towers[i][0] - coord[0])**2