public Move(ToolHead toolhead, Vector4d start_pos, Vector4d end_pos, double speed) { this.toolhead = toolhead; this.start_pos = start_pos; this.end_pos = end_pos; this.accel = toolhead.max_accel; var velocity = Math.Min(speed, toolhead.max_velocity); this.cmove = toolhead.cmove; this.is_kinematic_move = true; this.axes_d = end_pos - start_pos; this.move_d = ((Vector3d)axes_d).Length(); //Math.Sqrt((from d in axes_d.GetRange(0, 3) select (d * d)).Sum()); if (move_d < 0.000000001) { // Extrude only move this.end_pos = start_pos; axes_d.X = 0.0f; this.move_d = Math.Abs(axes_d.W); this.accel = 99999999.9; velocity = speed; this.is_kinematic_move = false; } this.min_move_t = move_d / velocity; // Junction speeds are tracked in velocity squared. The // delta_v2 is the maximum amount of this squared-velocity that // can change in this move. this.max_start_v2 = 0.0; this.max_cruise_v2 = Math.Pow(velocity, 2); this.delta_v2 = 2.0 * move_d * this.accel; this.max_smoothed_v2 = 0.0; this.smooth_delta_v2 = 2.0 * move_d * toolhead.max_accel_to_decel; }
public Homing(Machine printer) { this.printer = printer; this.toolhead = printer.lookup_object <ToolHead>("toolhead"); this.changed_axes = new List <int>(); this.verify_retract = true; }