Exemple #1
0
        public KinematicPolar(ToolHead toolhead, ConfigWrapper config)
        {
            // Setup axis steppers
            var stepper_bed = new PrinterStepper(config.getsection("stepper_bed"));
            var rail_arm    = new PrinterRail(config.getsection("stepper_arm"));
            var rail_z      = PrinterRail.LookupMultiRail(config.getsection("stepper_z"));

            stepper_bed.setup_itersolve(KinematicType.polar, new object[] { "a" });
            rail_arm.setup_itersolve(KinematicType.polar, "r");
            rail_z.setup_itersolve(KinematicType.cartesian, "z");
            this.rails = new PrinterRail[] {
                rail_arm,
                rail_z
            };
            this.steppers.Add(stepper_bed);
            this.steppers.AddRange(rail_arm.get_steppers());
            this.steppers.AddRange(rail_z.get_steppers());

            // Setup boundary checks
            var _tup_1       = toolhead.get_max_velocity();
            var max_velocity = _tup_1.Item1;
            var max_accel    = _tup_1.Item2;

            this.max_z_velocity    = config.getfloat("max_z_velocity", max_velocity, above: 0.0, maxval: max_velocity);
            this.max_z_accel       = config.getfloat("max_z_accel", max_accel, above: 0.0, maxval: max_accel);
            this.need_motor_enable = true;
            this.limit_z           = new Vector2d(1, -1);
            this.limit_xy2         = -1.0;
            // Setup stepper max halt velocity
            var max_halt_velocity = toolhead.get_max_axis_halt();

            stepper_bed.set_max_jerk(max_halt_velocity, max_accel);
            rail_arm.set_max_jerk(max_halt_velocity, max_accel);
            rail_z.set_max_jerk(max_halt_velocity, max_accel);
        }
Exemple #2
0
        public KinematicCoreXY(ToolHead toolhead, ConfigWrapper config)
        {
            // Setup axis rails
            this.rails = new PrinterRail[] {
                new PrinterRail(config.getsection("stepper_x")),
                new PrinterRail(config.getsection("stepper_y")),
                PrinterRail.LookupMultiRail(config.getsection("stepper_z"))
            };
            this.rails[0].add_to_endstop(this.rails[1].get_endstops()[0].endstop);
            this.rails[1].add_to_endstop(this.rails[0].get_endstops()[0].endstop);
            this.rails[0].setup_itersolve(KinematicType.corexy, "+");
            this.rails[1].setup_itersolve(KinematicType.corexy, "-");
            this.rails[2].setup_itersolve(KinematicType.cartesian, "z");
            // Setup boundary checks
            var _tup_1       = toolhead.get_max_velocity();
            var max_velocity = _tup_1.Item1;
            var max_accel    = _tup_1.Item2;

            this.max_z_velocity    = config.getfloat("max_z_velocity", max_velocity, above: 0.0, maxval: max_velocity);
            this.max_z_accel       = config.getfloat("max_z_accel", max_accel, above: 0.0, maxval: max_accel);
            this.need_motor_enable = true;
            this.limits            = new Vector2d[] { new Vector2d(1, -1), new Vector2d(1, -1), new Vector2d(1, -1) };
            // Setup stepper max halt velocity
            var max_halt_velocity    = toolhead.get_max_axis_halt();
            var max_xy_halt_velocity = max_halt_velocity * Math.Sqrt(2.0);

            this.rails[0].set_max_jerk(max_xy_halt_velocity, max_accel);
            this.rails[1].set_max_jerk(max_xy_halt_velocity, max_accel);
            this.rails[2].set_max_jerk(Math.Min(max_halt_velocity, this.max_z_velocity), this.max_z_accel);
        }
Exemple #3
0
 public IdleTimeout(ConfigWrapper config)
 {
     this.printer  = config.get_printer();
     this.reactor  = this.printer.get_reactor();
     this.gcode    = this.printer.lookup_object <GCodeParser>("gcode");
     this.toolhead = null;
     this.printer.register_event_handler("klippy:ready", handle_ready);
     this.state        = "Idle";
     this.idle_timeout = config.getfloat("timeout", 600.0, above: 0.0);
     this.idle_gcode   = config.get("gcode", DEFAULT_IDLE_GCODE).Split("\n");
 }
Exemple #4
0
        public KinematicCartesian(ToolHead toolhead, ConfigWrapper config)
        {
            this.printer = config.get_printer();
            // Setup axis rails
            rails    = new PrinterRail[3];
            rails[0] = PrinterRail.LookupMultiRail(config.getsection("stepper_x"));
            rails[0].setup_itersolve(KinematicType.cartesian, "x");
            rails[1] = PrinterRail.LookupMultiRail(config.getsection("stepper_y"));
            rails[1].setup_itersolve(KinematicType.cartesian, "y");
            rails[2] = PrinterRail.LookupMultiRail(config.getsection("stepper_z"));
            rails[2].setup_itersolve(KinematicType.cartesian, "z");
            // Setup boundary checks
            var _tup_2       = toolhead.get_max_velocity();
            var max_velocity = _tup_2.Item1;
            var max_accel    = _tup_2.Item2;

            this.max_z_velocity    = config.getfloat("max_z_velocity", max_velocity, above: 0.0, maxval: max_velocity);
            this.max_z_accel       = config.getfloat("max_z_accel", max_accel, above: 0.0, maxval: max_accel);
            this.need_motor_enable = true;
            // Setup stepper max halt velocity
            var max_halt_velocity = toolhead.get_max_axis_halt();

            this.rails[0].set_max_jerk(max_halt_velocity, max_accel);
            this.rails[1].set_max_jerk(max_halt_velocity, max_accel);
            this.rails[2].set_max_jerk(Math.Min(max_halt_velocity, this.max_z_velocity), max_accel);
            // Check for dual carriage support
            this.dual_carriage_axis  = -1;
            this.dual_carriage_rails = new List <PrinterRail>();
            if (config.has_section("dual_carriage"))
            {
                var dc_config = config.getsection("dual_carriage");
                var dc_axis   = dc_config.getchoice("axis", new Dictionary <string, string> {
                    { "x", "x" }, { "y", "y" }
                });
                this.dual_carriage_axis = dc_axis == "x" ? 0 : 1;
                var dc_rail = PrinterRail.LookupMultiRail(dc_config);
                dc_rail.setup_itersolve(KinematicType.cartesian, dc_axis);
                dc_rail.set_max_jerk(max_halt_velocity, max_accel);
                this.dual_carriage_rails.Add(this.rails[this.dual_carriage_axis]);
                this.dual_carriage_rails.Add(dc_rail);
                this.printer.lookup_object <GCodeParser>("gcode")
                .register_command("SET_DUAL_CARRIAGE", cmd_SET_DUAL_CARRIAGE, desc: cmd_SET_DUAL_CARRIAGE_help);
            }
        }
Exemple #5
0
        public static KinematicBase load_kinematics(KinematicType type, ToolHead toolhead, ConfigWrapper config)
        {
            switch (type)
            {
            case KinematicType.none: break;

            case KinematicType.cartesian: return(new KinematicCartesian(toolhead, config));

            case KinematicType.corexy: break;

            case KinematicType.delta: break;

            case KinematicType.extruder: break;

            case KinematicType.polar: break;

            case KinematicType.winch: break;
            }
            throw new NotImplementedException();
        }
Exemple #6
0
        public KinematicWinch(ToolHead toolhead, ConfigWrapper config)
        {
            // Setup steppers at each anchor
            this.steppers = new List <PrinterStepper>();
            this.anchors  = new List <Vector3d>();
            for (int i = 0; i < 26; i++)
            {
                var name = "stepper_" + (char)('a' + i);
                if (i >= 3 && !config.has_section(name))
                {
                    break;
                }
                var stepper_config = config.getsection(name);
                var s = new PrinterStepper(stepper_config);
                this.steppers.Add(s);
                var anchor = new Vector3d(
                    stepper_config.getfloat("anchor_x"),
                    stepper_config.getfloat("anchor_y"),
                    stepper_config.getfloat("anchor_z"));
                this.anchors.Add(anchor);
                s.setup_itersolve(KinematicType.winch, new object[] { anchor.X, anchor.Y, anchor.Z });
            }
            // Setup stepper max halt velocity
            var _tup_1            = toolhead.get_max_velocity();
            var max_velocity      = _tup_1.Item1;
            var max_accel         = _tup_1.Item2;
            var max_halt_velocity = toolhead.get_max_axis_halt();

            foreach (var s in this.steppers)
            {
                s.set_max_jerk(max_halt_velocity, max_accel);
            }
            // Setup boundary checks
            this.need_motor_enable = true;
            this.set_position(Vector3d.Zero, null);
        }
Exemple #7
0
 public void SetUp()
 {
     toolHead = new ToolHead(HeadType.Crease);
 }
Exemple #8
0
 public void handle_ready()
 {
     this.toolhead      = this.printer.lookup_object <ToolHead>("toolhead");
     this.timeout_timer = this.reactor.register_timer(this.timeout_handler);
     this.printer.register_event_handler("toolhead:sync_print_time", (Delegate)(Action <double, double, double>) this.handle_sync_print_time);
 }