aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/kinematics/winch.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/winch.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/winch.py')
-rw-r--r--klippy/kinematics/winch.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/klippy/kinematics/winch.py b/klippy/kinematics/winch.py
index 4785d8ac..b5d3c245 100644
--- a/klippy/kinematics/winch.py
+++ b/klippy/kinematics/winch.py
@@ -1,9 +1,9 @@
# Code for handling the kinematics of cable winch robots
#
-# Copyright (C) 2018-2019 Kevin O'Connor <kevin@koconnor.net>
+# Copyright (C) 2018-2021 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import stepper, mathutil, homing
+import stepper, mathutil
class WinchKinematics:
def __init__(self, toolhead, config):
@@ -28,6 +28,9 @@ class WinchKinematics:
for s in self.steppers:
s.set_max_jerk(max_halt_velocity, max_accel)
# Setup boundary checks
+ acoords = zip(*self.anchors)
+ self.axes_min = toolhead.Coord(*[min(a) for a in acoords], e=0.)
+ self.axes_max = toolhead.Coord(*[max(a) for a in acoords], e=0.)
self.set_position([0., 0., 0.], ())
def get_steppers(self):
return list(self.steppers)
@@ -47,15 +50,10 @@ class WinchKinematics:
pass
def get_status(self, eventtime):
# XXX - homed_checks and rail limits not implemented
- axes_min = [0.0, 0.0, 0.0, 0.0]
- axes_max = [0.0, 0.0, 0.0, 0.0]
- for pos, axis in enumerate('xyz'):
- axes_min[pos] = min([a[pos] for a in self.anchors])
- axes_max[pos] = max([a[pos] for a in self.anchors])
return {
'homed_axes': 'xyz',
- '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):