mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-06 05:24:02 -06:00
toolhead: Eliminate set_max_jerk() from kinematic classes
Allow the kinematic classes to query the max velocity, max accel, and max halt velocity from the toolhead class instead of having the toolhead class call into the kinematic classes with those values. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
0d13834293
commit
7a81bfc4a4
6 changed files with 53 additions and 45 deletions
|
@ -12,13 +12,11 @@ StepList = (0, 1, 2)
|
|||
SLOW_RATIO = 3.
|
||||
|
||||
class DeltaKinematics:
|
||||
def __init__(self, printer, config):
|
||||
self.config = config
|
||||
def __init__(self, toolhead, printer, config):
|
||||
self.steppers = [stepper.PrinterHomingStepper(
|
||||
printer, config.getsection('stepper_' + n), n)
|
||||
for n in ['a', 'b', 'c']]
|
||||
self.need_motor_enable = self.need_home = True
|
||||
self.max_velocity = self.max_z_velocity = self.max_accel = 0.
|
||||
radius = config.getfloat('delta_radius', above=0.)
|
||||
arm_length = config.getfloat('delta_arm_length', above=radius)
|
||||
self.arm_length2 = arm_length**2
|
||||
|
@ -29,6 +27,14 @@ class DeltaKinematics:
|
|||
logging.info(
|
||||
"Delta max build height %.2fmm (radius tapered above %.2fmm)" % (
|
||||
self.max_z, self.limit_z))
|
||||
# Setup stepper max halt velocity
|
||||
self.max_velocity, self.max_accel = toolhead.get_max_velocity()
|
||||
self.max_z_velocity = config.getfloat(
|
||||
'max_z_velocity', self.max_velocity,
|
||||
above=0., maxval=self.max_velocity)
|
||||
max_xy_halt_velocity = toolhead.get_max_axis_halt(self.max_accel)
|
||||
for s in self.steppers:
|
||||
s.set_max_jerk(max_xy_halt_velocity, self.max_accel)
|
||||
# Determine tower locations in cartesian space
|
||||
angles = [config.getsection('stepper_a').getfloat('angle', 210.),
|
||||
config.getsection('stepper_b').getfloat('angle', 330.),
|
||||
|
@ -52,14 +58,6 @@ class DeltaKinematics:
|
|||
% (math.sqrt(self.max_xy2), math.sqrt(self.slow_xy2),
|
||||
math.sqrt(self.very_slow_xy2)))
|
||||
self.set_position([0., 0., 0.])
|
||||
def set_max_jerk(self, max_xy_halt_velocity, max_velocity, max_accel):
|
||||
self.max_velocity = max_velocity
|
||||
max_z_velocity = self.config.getfloat(
|
||||
'max_z_velocity', max_velocity, above=0.)
|
||||
self.max_z_velocity = min(max_velocity, max_z_velocity)
|
||||
self.max_accel = max_accel
|
||||
for stepper in self.steppers:
|
||||
stepper.set_max_jerk(max_xy_halt_velocity, max_accel)
|
||||
def _cartesian_to_actuator(self, coord):
|
||||
return [math.sqrt(self.arm_length2
|
||||
- (self.towers[i][0] - coord[0])**2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue