aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/kinematics/delta.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-01-08 11:52:28 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-01-08 11:52:28 -0500
commitc8434ec54b0517503af4aeee9016783d508118b0 (patch)
tree7229f2ea5c4f63a7fad9c46ef6f84adc614b96fa /klippy/kinematics/delta.py
parentf79187d726d00c7215448e5953cdb0dd8d490683 (diff)
downloadkutter-c8434ec54b0517503af4aeee9016783d508118b0.tar.gz
kutter-c8434ec54b0517503af4aeee9016783d508118b0.tar.xz
kutter-c8434ec54b0517503af4aeee9016783d508118b0.zip
kinematics: Calculate axis_minimum/axis_maximum in advance
Calculate the get_status() axis_minimum and axis_maximum fields in advance so that they don't need to be calculated on each get_status() call. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/kinematics/delta.py')
-rw-r--r--klippy/kinematics/delta.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/klippy/kinematics/delta.py b/klippy/kinematics/delta.py
index 2ee8ca41..44331a91 100644
--- a/klippy/kinematics/delta.py
+++ b/klippy/kinematics/delta.py
@@ -1,10 +1,10 @@
# Code for handling the kinematics of linear delta robots
#
-# Copyright (C) 2016-2019 Kevin O'Connor <kevin@koconnor.net>
+# Copyright (C) 2016-2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging
-import stepper, mathutil, homing
+import stepper, mathutil
# Slow moves once the ratio of tower to XY movement exceeds SLOW_RATIO
SLOW_RATIO = 3.
@@ -68,25 +68,28 @@ class DeltaKinematics:
self.limit_z = min([ep - arm
for ep, arm in zip(self.abs_endstops, arm_lengths)])
logging.info(
- "Delta max build height %.2fmm (radius tapered above %.2fmm)" % (
- self.max_z, self.limit_z))
+ "Delta max build height %.2fmm (radius tapered above %.2fmm)"
+ % (self.max_z, self.limit_z))
# Find the point where an XY move could result in excessive
# tower movement
half_min_step_dist = min([r.get_steppers()[0].get_step_dist()
for r in self.rails]) * .5
min_arm_length = min(arm_lengths)
- def ratio_to_dist(ratio):
+ def ratio_to_xy(ratio):
return (ratio * math.sqrt(min_arm_length**2 / (ratio**2 + 1.)
- half_min_step_dist**2)
- + half_min_step_dist)
- self.slow_xy2 = (ratio_to_dist(SLOW_RATIO) - radius)**2
- self.very_slow_xy2 = (ratio_to_dist(2. * SLOW_RATIO) - radius)**2
+ + half_min_step_dist - radius)
+ self.slow_xy2 = ratio_to_xy(SLOW_RATIO)**2
+ self.very_slow_xy2 = ratio_to_xy(2. * SLOW_RATIO)**2
self.max_xy2 = min(print_radius, min_arm_length - radius,
- ratio_to_dist(4. * SLOW_RATIO) - radius)**2
+ ratio_to_xy(4. * SLOW_RATIO))**2
+ max_xy = math.sqrt(self.max_xy2)
logging.info("Delta max build radius %.2fmm (moves slowed past %.2fmm"
- " and %.2fmm)" % (
- math.sqrt(self.max_xy2), math.sqrt(self.slow_xy2),
- math.sqrt(self.very_slow_xy2)))
+ " and %.2fmm)"
+ % (max_xy, math.sqrt(self.slow_xy2),
+ math.sqrt(self.very_slow_xy2)))
+ self.axes_min = toolhead.Coord(-max_xy, -max_xy, self.min_z, 0.)
+ self.axes_max = toolhead.Coord(max_xy, max_xy, self.max_z, 0.)
self.set_position([0., 0., 0.], ())
def get_steppers(self):
return [s for rail in self.rails for s in rail.get_steppers()]
@@ -146,13 +149,10 @@ class DeltaKinematics:
limit_xy2 = -1.
self.limit_xy2 = min(limit_xy2, self.slow_xy2)
def get_status(self, eventtime):
- max_xy = math.sqrt(self.max_xy2)
- axes_min = [-max_xy, -max_xy, self.min_z, 0.]
- axes_max = [max_xy, max_xy, self.max_z, 0.]
return {
'homed_axes': '' if self.need_home else 'xyz',
- 'axis_minimum': homing.Coord(*axes_min),
- 'axis_maximum': homing.Coord(*axes_max)
+ 'axis_minimum': self.axes_min,
+ 'axis_maximum': self.axes_max,
}
def get_calibration(self):
endstops = [rail.get_homing_info().position_endstop