diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-09-03 15:17:02 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-09-03 15:45:04 -0400 |
commit | 7a81bfc4a4651c913add10e34e7431513cf8a5f5 (patch) | |
tree | 7f3a40804dd52154d864cc71e7a120cddecf4725 /klippy/toolhead.py | |
parent | 0d13834293d0b5db2fc3407bd603dbfaa691402d (diff) | |
download | kutter-7a81bfc4a4651c913add10e34e7431513cf8a5f5.tar.gz kutter-7a81bfc4a4651c913add10e34e7431513cf8a5f5.tar.xz kutter-7a81bfc4a4651c913add10e34e7431513cf8a5f5.zip |
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>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r-- | klippy/toolhead.py | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 1cff9ef3..0914a247 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -184,12 +184,7 @@ class ToolHead: self.printer = printer self.reactor = printer.reactor self.mcu = printer.objects['mcu'] - self.extruder = extruder.DummyExtruder() - kintypes = {'cartesian': cartesian.CartKinematics, - 'corexy': corexy.CoreXYKinematics, - 'delta': delta.DeltaKinematics} - self.kin = config.getchoice('kinematics', kintypes)(printer, config) - self.max_speed = config.getfloat('max_velocity', above=0.) + self.max_velocity = config.getfloat('max_velocity', above=0.) self.max_accel = config.getfloat('max_accel', above=0.) self.max_accel_to_decel = config.getfloat( 'max_accel_to_decel', self.max_accel * 0.5 @@ -197,7 +192,6 @@ class ToolHead: self.junction_deviation = config.getfloat( 'junction_deviation', 0.02, above=0.) self.move_queue = MoveQueue() - self.move_queue.set_extruder(self.extruder) self.commanded_pos = [0., 0., 0., 0.] # Print time tracking self.buffer_time_low = config.getfloat( @@ -221,12 +215,14 @@ class ToolHead: 'motor_off_time', 600.000, minval=0.) self.motor_off_timer = self.reactor.register_timer( self._motor_off_handler) - # Determine the maximum velocity a cartesian axis could have - # before cornering. The 8. was determined experimentally. - xy_halt = math.sqrt(8. * self.junction_deviation * self.max_accel) - self.kin.set_max_jerk(xy_halt, self.max_speed, self.max_accel) - for e in extruder.get_printer_extruders(printer): - e.set_max_jerk(xy_halt, self.max_speed, self.max_accel) + # Create kinematics class + self.extruder = extruder.DummyExtruder() + self.move_queue.set_extruder(self.extruder) + kintypes = {'cartesian': cartesian.CartKinematics, + 'corexy': corexy.CoreXYKinematics, + 'delta': delta.DeltaKinematics} + self.kin = config.getchoice('kinematics', kintypes)( + self, printer, config) # Print time tracking def update_move_time(self, movetime): self.print_time += movetime @@ -332,7 +328,7 @@ class ToolHead: self.commanded_pos[:] = newpos self.kin.set_position(newpos) def move(self, newpos, speed): - speed = min(speed, self.max_speed) + speed = min(speed, self.max_velocity) move = Move(self, self.commanded_pos, newpos, speed) if not move.move_d: return @@ -396,6 +392,13 @@ class ToolHead: self.reset_print_time() except: logging.exception("Exception in force_shutdown") + def get_max_velocity(self): + return self.max_velocity, self.max_accel + def get_max_axis_halt(self, max_accel): + # Determine the maximum velocity a cartesian axis could halt + # at due to the junction_deviation setting. The 8.0 was + # determined experimentally. + return math.sqrt(8. * self.junction_deviation * max_accel) def add_printer_objects(printer, config): printer.add_object('toolhead', ToolHead(printer, config)) |