aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/kinematics/polar.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/polar.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/polar.py')
-rw-r--r--klippy/kinematics/polar.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/klippy/kinematics/polar.py b/klippy/kinematics/polar.py
index 14c92437..98b7c7e1 100644
--- a/klippy/kinematics/polar.py
+++ b/klippy/kinematics/polar.py
@@ -1,10 +1,10 @@
# Code for handling the kinematics of polar 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 logging, math
-import stepper, homing
+import stepper
class PolarKinematics:
def __init__(self, toolhead, config):
@@ -32,6 +32,10 @@ class PolarKinematics:
'max_z_accel', max_accel, above=0., maxval=max_accel)
self.limit_z = (1.0, -1.0)
self.limit_xy2 = -1.
+ max_xy = self.rails[0].get_range()[1]
+ min_z, max_z = self.rails[1].get_range()
+ self.axes_min = toolhead.Coord(-max_xy, -max_xy, min_z, 0.)
+ self.axes_max = toolhead.Coord(max_xy, max_xy, max_z, 0.)
# Setup stepper max halt velocity
max_halt_velocity = toolhead.get_max_axis_halt()
stepper_bed.set_max_jerk(max_halt_velocity, max_accel)
@@ -108,14 +112,10 @@ class PolarKinematics:
def get_status(self, eventtime):
xy_home = "xy" if self.limit_xy2 >= 0. else ""
z_home = "z" if self.limit_z[0] <= self.limit_z[1] else ""
- lim_xy = self.rails[0].get_range()
- lim_z = self.rails[1].get_range()
- axes_min = [lim_xy[0], lim_xy[0], lim_z[0], 0.]
- axes_max = [lim_xy[1], lim_xy[1], lim_z[1], 0.]
return {
'homed_axes': xy_home + z_home,
- '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):