Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
        void _home_axis(Homing homing_state, int axis, PrinterRail rail)
        {
            // Determine movement
            var _tup_1       = rail.get_range();
            var position_min = _tup_1.X;
            var position_max = _tup_1.Y;
            var hi           = rail.get_homing_info();
            var homepos      = new List <double?> {
                null, null, null, null
            };

            homepos[axis] = hi.position_endstop;
            if (axis == 0)
            {
                homepos[1] = 0.0;
            }
            var forcepos = homepos.ToList();

            if (hi.positive_dir ?? false)
            {
                forcepos[axis] -= hi.position_endstop - position_min;
            }
            else
            {
                forcepos[axis] += position_max - hi.position_endstop;
            }
            // Perform homing
            double?limit_speed = null;

            if (axis == 2)
            {
                limit_speed = this.max_z_velocity;
            }
            homing_state.home_rails(new List <PrinterRail> {
                rail
            },
                                    (forcepos[0], forcepos[1], forcepos[2], forcepos[3]),
                                    (homepos[0], homepos[1], homepos[2], homepos[3]),
                                    limit_speed);
        }