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>
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user