aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/kinematics/corexy.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/corexy.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/corexy.py')
-rw-r--r--klippy/kinematics/corexy.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/klippy/kinematics/corexy.py b/klippy/kinematics/corexy.py
index 73f1dd4c..726ba3c6 100644
--- a/klippy/kinematics/corexy.py
+++ b/klippy/kinematics/corexy.py
@@ -1,10 +1,10 @@
# Code for handling the kinematics of corexy robots
#
-# Copyright (C) 2017-2019 Kevin O'Connor <kevin@koconnor.net>
+# Copyright (C) 2017-2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import logging, math
-import stepper, homing
+import stepper
class CoreXYKinematics:
def __init__(self, toolhead, config):
@@ -31,6 +31,9 @@ class CoreXYKinematics:
self.max_z_accel = config.getfloat(
'max_z_accel', max_accel, above=0., maxval=max_accel)
self.limits = [(1.0, -1.0)] * 3
+ ranges = [r.get_range() for r in self.rails]
+ self.axes_min = toolhead.Coord(*[r[0] for r in ranges], e=0.)
+ self.axes_max = toolhead.Coord(*[r[1] for r in ranges], e=0.)
# Setup stepper max halt velocity
max_halt_velocity = toolhead.get_max_axis_halt()
max_xy_halt_velocity = max_halt_velocity * math.sqrt(2.)
@@ -95,14 +98,10 @@ class CoreXYKinematics:
self.max_z_velocity * z_ratio, self.max_z_accel * z_ratio)
def get_status(self, eventtime):
axes = [a for a, (l, h) in zip("xyz", self.limits) if l <= h]
- axes_min = [0.0, 0.0, 0.0, 0.0]
- axes_max = [0.0, 0.0, 0.0, 0.0]
- for pos, rail in enumerate(self.rails):
- axes_min[pos], axes_max[pos] = rail.get_range()
return {
'homed_axes': "".join(axes),
- 'axis_minimum': homing.Coord(*axes_min),
- 'axis_maximum': homing.Coord(*axes_max)
+ 'axis_minimum': self.axes_min,
+ 'axis_maximum': self.axes_max,
}
def load_kinematics(toolhead, config):