diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-12-01 15:29:26 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-12-01 18:17:54 -0500 |
commit | c49d3fdb17d6ba8f90099826355200d5219ab6b6 (patch) | |
tree | ad12f524dab0e3d100adcb8c12c603a686c7b7d9 /klippy/cartesian.py | |
parent | fcaf359e897cea792ac28fc9140316c76eb87c40 (diff) | |
download | kutter-c49d3fdb17d6ba8f90099826355200d5219ab6b6.tar.gz kutter-c49d3fdb17d6ba8f90099826355200d5219ab6b6.tar.xz kutter-c49d3fdb17d6ba8f90099826355200d5219ab6b6.zip |
toolhead: Specify maximum acceleration and velocity in toolhead class
Change the config file so the maximum accel and velocity are specified
in the "printer" section instead of the individual "stepper" sections.
The underlying code limits the velocity and accel of the toolhead
relative to the print object, so it makes sense to configure the
system that was as well.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/cartesian.py')
-rw-r--r-- | klippy/cartesian.py | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/klippy/cartesian.py b/klippy/cartesian.py index 09a2a094..50946f03 100644 --- a/klippy/cartesian.py +++ b/klippy/cartesian.py @@ -13,21 +13,21 @@ class CartKinematics: self.steppers = [stepper.PrinterStepper( printer, config.getsection('stepper_' + n), n) for n in ['x', 'y', 'z']] + self.max_z_velocity = config.getfloat('max_z_velocity', 9999999.9) + self.max_z_accel = config.getfloat('max_z_accel', 9999999.9) self.need_motor_enable = True self.limits = [(1.0, -1.0)] * 3 + def set_max_jerk(self, max_xy_halt_velocity, max_accel): + self.steppers[0].set_max_jerk(max_xy_halt_velocity, max_accel) + self.steppers[1].set_max_jerk(max_xy_halt_velocity, max_accel) + self.steppers[2].set_max_jerk(0., self.max_z_accel) def build_config(self): - for stepper in self.steppers[:2]: - stepper.set_max_jerk(0.005 * stepper.max_accel) # XXX for stepper in self.steppers: stepper.build_config() def set_position(self, newpos): for i in StepList: s = self.steppers[i] s.mcu_stepper.set_position(int(newpos[i]*s.inv_step_dist + 0.5)) - def get_max_speed(self): - max_xy_speed = min(s.max_velocity for s in self.steppers[:2]) - max_xy_accel = min(s.max_accel for s in self.steppers[:2]) - return max_xy_speed, max_xy_accel def get_homed_position(self, homing_state): pos = [None]*3 for axis in homing_state.get_axes(): @@ -99,13 +99,9 @@ class CartKinematics: return # Move with Z - update velocity and accel for slower Z axis self.check_endstops(move) - axes_d = move.axes_d - move_d = move.move_d - velocity_factor = min([self.steppers[i].max_velocity / abs(axes_d[i]) - for i in StepList if axes_d[i]]) - accel_factor = min([self.steppers[i].max_accel / abs(axes_d[i]) - for i in StepList if axes_d[i]]) - move.limit_speed(velocity_factor * move_d, accel_factor * move_d) + z_ratio = move.move_d / abs(move.axes_d[2]) + move.limit_speed( + self.max_z_velocity * z_ratio, self.max_z_accel * z_ratio) def move(self, move_time, move): if self.need_motor_enable: self.check_motor_enable(move_time, move) |