def __init__(self, toolhead, printer, config): stepper_configs = [config.getsection('stepper_' + n) for n in ['a', 'b', 'c']] stepper_a = stepper.PrinterHomingStepper(printer, stepper_configs[0]) stepper_b = stepper.PrinterHomingStepper( printer, stepper_configs[1], default_position=stepper_a.position_endstop) stepper_c = stepper.PrinterHomingStepper( printer, stepper_configs[2], default_position=stepper_a.position_endstop) self.steppers = [stepper_a, stepper_b, stepper_c] self.need_motor_enable = self.need_home = True self.radius = radius = config.getfloat('delta_radius', above=0.) arm_length_a = stepper_configs[0].getfloat('arm_length', above=radius) self.arm_lengths = arm_lengths = [ sconfig.getfloat('arm_length', arm_length_a, above=radius) for sconfig in stepper_configs] self.arm2 = [arm**2 for arm in arm_lengths] self.endstops = [s.position_endstop + math.sqrt(arm2 - radius**2) for s, arm2 in zip(self.steppers, self.arm2)] self.limit_xy2 = -1. self.max_z = min([s.position_endstop for s in self.steppers]) self.min_z = config.getfloat('minimum_z_position', 0, maxval=self.max_z) self.limit_z = min([ep - arm for ep, arm in zip(self.endstops, arm_lengths)]) 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_halt_velocity = toolhead.get_max_axis_halt() for s in self.steppers: s.set_max_jerk(max_halt_velocity, self.max_accel) # Determine tower locations in cartesian space self.angles = [sconfig.getfloat('angle', angle) for sconfig, angle in zip(stepper_configs, [210., 330., 90.])] self.towers = [(math.cos(math.radians(angle)) * radius, math.sin(math.radians(angle)) * radius) for angle in self.angles] # Find the point where an XY move could result in excessive # tower movement half_min_step_dist = min([s.step_dist for s in self.steppers]) * .5 min_arm_length = min(arm_lengths) def ratio_to_dist(ratio): return (ratio * math.sqrt(min_arm_length**2 / (ratio**2 + 1.) - half_min_step_dist**2) + half_min_step_dist) self.slow_xy2 = (ratio_to_dist(SLOW_RATIO) - radius)**2 self.very_slow_xy2 = (ratio_to_dist(2. * SLOW_RATIO) - radius)**2 self.max_xy2 = min(radius, min_arm_length - radius, ratio_to_dist(4. * SLOW_RATIO) - radius)**2 logging.info( "Delta max build radius %.2fmm (moves slowed past %.2fmm and %.2fmm)" % (math.sqrt(self.max_xy2), math.sqrt(self.slow_xy2), math.sqrt(self.very_slow_xy2))) self.set_position([0., 0., 0.], ())
def __init__(self, toolhead, printer, config): self.steppers = [ stepper.PrinterHomingStepper(printer, config.getsection('stepper_x')), stepper.PrinterHomingStepper(printer, config.getsection('stepper_y')), stepper.LookupMultiHomingStepper(printer, config.getsection('stepper_z')) ] self.steppers[0].mcu_endstop.add_stepper(self.steppers[1].mcu_stepper) self.steppers[1].mcu_endstop.add_stepper(self.steppers[0].mcu_stepper) max_velocity, max_accel = toolhead.get_max_velocity() self.max_z_velocity = config.getfloat('max_z_velocity', max_velocity, above=0., maxval=max_velocity) self.max_z_accel = config.getfloat('max_z_accel', max_accel, above=0., maxval=max_accel) self.need_motor_enable = True self.limits = [(1.0, -1.0)] * 3 # Setup stepper max halt velocity max_halt_velocity = toolhead.get_max_axis_halt() max_xy_halt_velocity = max_halt_velocity * math.sqrt(2.) 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( min(max_halt_velocity, self.max_z_velocity), self.max_z_accel)
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 radius = config.getfloat('delta_radius', above=0.) arm_length = config.getfloat('delta_arm_length', above=radius) self.arm_length2 = arm_length**2 self.limit_xy2 = -1. tower_height_at_zeros = math.sqrt(self.arm_length2 - radius**2) self.max_z = min([s.position_endstop for s in self.steppers]) self.limit_z = self.max_z - (arm_length - tower_height_at_zeros) 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_halt_velocity = toolhead.get_max_axis_halt() for s in self.steppers: s.set_max_jerk(max_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.), config.getsection('stepper_c').getfloat('angle', 90.) ] self.towers = [(math.cos(math.radians(angle)) * radius, math.sin(math.radians(angle)) * radius) for angle in angles] # Find the point where an XY move could result in excessive # tower movement half_min_step_dist = min([s.step_dist for s in self.steppers]) * .5 def ratio_to_dist(ratio): return ( ratio * math.sqrt(self.arm_length2 / (ratio**2 + 1.) - half_min_step_dist**2) + half_min_step_dist) self.slow_xy2 = (ratio_to_dist(SLOW_RATIO) - radius)**2 self.very_slow_xy2 = (ratio_to_dist(2. * SLOW_RATIO) - radius)**2 self.max_xy2 = min(radius, arm_length - radius, ratio_to_dist(4. * SLOW_RATIO) - radius)**2 logging.info( "Delta max build radius %.2fmm (moves slowed past %.2fmm and %.2fmm)" % (math.sqrt(self.max_xy2), math.sqrt( self.slow_xy2), math.sqrt(self.very_slow_xy2))) self.set_position([0., 0., 0.])
def __init__(self, toolhead, printer, config): self.steppers = [ stepper.PrinterHomingStepper(printer, config.getsection('stepper_x')), stepper.PrinterHomingStepper(printer, config.getsection('stepper_y')), stepper.LookupMultiHomingStepper(printer, config.getsection('stepper_z')) ] self.steppers[0].mcu_endstop.add_stepper(self.steppers[1].mcu_stepper) self.steppers[1].mcu_endstop.add_stepper(self.steppers[0].mcu_stepper) max_velocity, max_accel = toolhead.get_max_velocity() self.max_z_velocity = config.getfloat('max_z_velocity', max_velocity, above=0., maxval=max_velocity) self.max_z_accel = config.getfloat('max_z_accel', max_accel, above=0., maxval=max_accel) self.need_motor_enable = True self.limits = [(1.0, -1.0)] * 3 # Setup iterative solver ffi_main, ffi_lib = chelper.get_ffi() self.cmove = ffi_main.gc(ffi_lib.move_alloc(), ffi_lib.free) self.move_fill = ffi_lib.move_fill self.steppers[0].setup_itersolve( ffi_main.gc(ffi_lib.corexy_stepper_alloc('+'), ffi_lib.free)) self.steppers[1].setup_itersolve( ffi_main.gc(ffi_lib.corexy_stepper_alloc('-'), ffi_lib.free)) self.steppers[2].setup_cartesian_itersolve('z') # Setup stepper max halt velocity max_halt_velocity = toolhead.get_max_axis_halt() max_xy_halt_velocity = max_halt_velocity * math.sqrt(2.) 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( min(max_halt_velocity, self.max_z_velocity), self.max_z_accel)
def __init__(self, toolhead, printer, config): self.steppers = [stepper.PrinterHomingStepper( printer, config.getsection('stepper_' + n), n) for n in ['x', 'y', 'z']] max_velocity, max_accel = toolhead.get_max_velocity() self.max_z_velocity = config.getfloat( 'max_z_velocity', max_velocity, above=0., maxval=max_velocity) self.max_z_accel = config.getfloat( 'max_z_accel', max_accel, above=0., maxval=max_accel) self.need_motor_enable = True self.limits = [(1.0, -1.0)] * 3 # Setup stepper max halt velocity max_halt_velocity = toolhead.get_max_axis_halt() self.steppers[0].set_max_jerk(max_halt_velocity, max_accel) self.steppers[1].set_max_jerk(max_halt_velocity, max_accel) self.steppers[2].set_max_jerk( min(max_halt_velocity, self.max_z_velocity), max_accel)