extruder: Calculate sane defaults for extrude only velocity and accel

Instead of requiring the user enter velocity and accel parameters for
extrude only moves, calculate sane defaults from the printer's maximum
velocity and accel.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-01-02 18:58:45 -05:00
parent b26922978a
commit c87c090264
8 changed files with 21 additions and 16 deletions

View File

@ -44,8 +44,6 @@ enable_pin: ar25
step_distance: .004242 step_distance: .004242
nozzle_diameter: 0.500 nozzle_diameter: 0.500
filament_diameter: 3.500 filament_diameter: 3.500
max_velocity: 200000
max_accel: 3000
heater_pin: ar4 heater_pin: ar4
thermistor_pin: analog1 thermistor_pin: analog1
thermistor_type: EPCOS 100K B57560G104F thermistor_type: EPCOS 100K B57560G104F

View File

@ -48,8 +48,6 @@ enable_pin: !ar24
step_distance: .0022 step_distance: .0022
nozzle_diameter: 0.400 nozzle_diameter: 0.400
filament_diameter: 1.750 filament_diameter: 1.750
max_velocity: 200
max_accel: 3000
heater_pin: ar10 heater_pin: ar10
thermistor_pin: analog13 thermistor_pin: analog13
thermistor_type: ATC Semitec 104GT-2 thermistor_type: ATC Semitec 104GT-2

View File

@ -125,12 +125,16 @@ filament_diameter: 3.500
# may be. If an extrude only move requests a distance greater than # may be. If an extrude only move requests a distance greater than
# this value it will cause an error to be returned. The default is # this value it will cause an error to be returned. The default is
# 50mm. # 50mm.
max_velocity: 200000 #max_extrude_only_velocity:
# Maximum velocity (in mm/s) of the extruder motor for extrude only # Maximum velocity (in mm/s) of the extruder motor for extrude only
# moves. This parameter must be provided. # moves. If this is not specified then it is calculated to match the
max_accel: 3000 # limit an XY printing move with a max_extrude_cross_section
# extrusion would have.
#max_extrude_only_accel:
# Maximum acceleration (in mm/s^2) of the extruder motor for extrude # Maximum acceleration (in mm/s^2) of the extruder motor for extrude
# only moves. This parameter must be provided. # only moves. If this is not specified then it is calculated to
# match the limit an XY printing move with a
# max_extrude_cross_section extrusion would have.
#pressure_advance: 0.0 #pressure_advance: 0.0
# The amount of raw filament to push into the extruder during # The amount of raw filament to push into the extruder during
# extruder acceleration. An equal amount of filament is retracted # extruder acceleration. An equal amount of filament is retracted

View File

@ -50,8 +50,6 @@ enable_pin: !PA4
step_distance: .004242 step_distance: .004242
nozzle_diameter: 0.350 nozzle_diameter: 0.350
filament_diameter: 1.750 filament_diameter: 1.750
max_velocity: 200000
max_accel: 3000
pressure_advance: 0.07 pressure_advance: 0.07
heater_pin: PH6 heater_pin: PH6
thermistor_pin: PF0 thermistor_pin: PF0

View File

@ -17,7 +17,7 @@ class CartKinematics:
self.max_z_accel = config.getfloat('max_z_accel', 9999999.9) self.max_z_accel = config.getfloat('max_z_accel', 9999999.9)
self.need_motor_enable = True self.need_motor_enable = True
self.limits = [(1.0, -1.0)] * 3 self.limits = [(1.0, -1.0)] * 3
def set_max_jerk(self, max_xy_halt_velocity, max_accel): def set_max_jerk(self, max_xy_halt_velocity, max_velocity, max_accel):
self.steppers[0].set_max_jerk(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[1].set_max_jerk(max_xy_halt_velocity, max_accel)
self.steppers[2].set_max_jerk(0., self.max_z_accel) self.steppers[2].set_max_jerk(0., self.max_z_accel)

View File

@ -29,8 +29,7 @@ class DeltaKinematics:
(cos(210.)*radius, sin(210.)*radius), (cos(210.)*radius, sin(210.)*radius),
(cos(330.)*radius, sin(330.)*radius), (cos(330.)*radius, sin(330.)*radius),
(cos(90.)*radius, sin(90.)*radius)] (cos(90.)*radius, sin(90.)*radius)]
def set_max_jerk(self, max_xy_halt_velocity, max_accel): def set_max_jerk(self, max_xy_halt_velocity, max_velocity, max_accel):
# XXX - this sets conservative values
for stepper in self.steppers: for stepper in self.steppers:
stepper.set_max_jerk(max_xy_halt_velocity, max_accel) stepper.set_max_jerk(max_xy_halt_velocity, max_accel)
def build_config(self): def build_config(self):

View File

@ -8,6 +8,7 @@ import stepper, heater, homing
class PrinterExtruder: class PrinterExtruder:
def __init__(self, printer, config): def __init__(self, printer, config):
self.config = config
self.heater = heater.PrinterHeater(printer, config) self.heater = heater.PrinterHeater(printer, config)
self.stepper = stepper.PrinterStepper(printer, config, 'extruder') self.stepper = stepper.PrinterStepper(printer, config, 'extruder')
nozzle_diameter = config.getfloat('nozzle_diameter') nozzle_diameter = config.getfloat('nozzle_diameter')
@ -17,11 +18,15 @@ class PrinterExtruder:
'max_extrude_cross_section', 4. * nozzle_diameter**2) 'max_extrude_cross_section', 4. * nozzle_diameter**2)
self.max_extrude_ratio = max_cross_section / filament_area self.max_extrude_ratio = max_cross_section / filament_area
self.max_e_dist = config.getfloat('max_extrude_only_distance', 50.) self.max_e_dist = config.getfloat('max_extrude_only_distance', 50.)
self.max_e_velocity = config.getfloat('max_velocity') self.max_e_velocity = self.max_e_accel = None
self.max_e_accel = config.getfloat('max_accel')
self.pressure_advance = config.getfloat('pressure_advance', 0.) self.pressure_advance = config.getfloat('pressure_advance', 0.)
self.need_motor_enable = True self.need_motor_enable = True
self.extrude_pos = 0. self.extrude_pos = 0.
def set_max_jerk(self, max_xy_halt_velocity, max_velocity, max_accel):
self.max_e_velocity = self.config.getfloat(
'max_extrude_only_velocity', max_velocity * self.max_extrude_ratio)
self.max_e_accel = self.config.getfloat(
'max_extrude_only_accel', max_accel * self.max_extrude_ratio)
def build_config(self): def build_config(self):
self.heater.build_config() self.heater.build_config()
self.stepper.set_max_jerk(9999999.9, 9999999.9) self.stepper.set_max_jerk(9999999.9, 9999999.9)

View File

@ -179,7 +179,10 @@ class ToolHead:
self.motor_off_time = self.reactor.NEVER self.motor_off_time = self.reactor.NEVER
self.flush_timer = self.reactor.register_timer(self._flush_handler) self.flush_timer = self.reactor.register_timer(self._flush_handler)
def build_config(self): def build_config(self):
self.kin.set_max_jerk(0.005 * self.max_accel, self.max_accel) # XXX xy_halt = 0.005 * self.max_accel # XXX
self.kin.set_max_jerk(xy_halt, self.max_speed, self.max_accel)
if self.extruder is not None:
self.extruder.set_max_jerk(xy_halt, self.max_speed, self.max_accel)
self.kin.build_config() self.kin.build_config()
# Print time tracking # Print time tracking
def update_move_time(self, movetime): def update_move_time(self, movetime):