/// <summary> /// 坐标转换(倾斜状态): 喷嘴距离基板高度 -> Z轴坐标 /// </summary> /// <param name="needleBoard">距板高度</param> /// <param name="boardHeight">基板测高值</param> /// <returns></returns> public static double NeedleBoard2Z(double needleBoard, double boardHeight, TiltType tiltType) { Log.Dprint("NeedleBoard2Z needleBoard=" + needleBoard + ", boardHeight=" + boardHeight + ", StandardZ=" + Machine.Instance.Robot.CalibPrm.StandardZ + ", StandardHeight=" + Machine.Instance.Robot.CalibPrm.StandardHeight); if (tiltType == TiltType.NoTilt) { return(needleBoard + Machine.Instance.Robot.CalibPrm.StandardZ + (boardHeight - Machine.Instance.Robot.CalibPrm.StandardHeight)); } else { List <AngleHeightPosOffset> curTiltCalibPrms = Machine.Instance.Robot.CalibPrm.AngleHeightPosOffsetList.FindAll(t => t.TiltType.Equals(tiltType)); if (curTiltCalibPrms.Count <= 0) { return(0); } AngleHeightPosOffset curTiltCalibPrm = curTiltCalibPrms.Find(t => t.Gap.Equals(needleBoard)); if (curTiltCalibPrm == null) { return(0); } else { if (curTiltCalibPrm.Gap <= 0.0001) { return(0); } else { return(curTiltCalibPrm.Gap + curTiltCalibPrm.StandardZ + (boardHeight - Machine.Instance.Robot.CalibPrm.StandardHeight)); } } } }
public void Setup(object[] objs) { this.tiltType = (TiltType)objs[0]; this.posZ = (double)objs[1]; this.angle = (double)objs[2]; this.offset = (PointD)objs[3]; }
private void btnChangePosture_Click(object sender, EventArgs e) { Machine.Instance.Robot.MoveSafeZ(); //TODO 根据选择切换气缸 switch (this.cbxPosture.SelectedIndex) { case 0: this.tiltType = TiltType.NoTilt; break; case 1: this.tiltType = TiltType.LTilt; break; case 2: this.tiltType = TiltType.RTilt; break; case 3: this.tiltType = TiltType.FTilt; break; case 4: this.tiltType = TiltType.BTilt; break; } this.Angle = this.txtAngle.Value; Machine.Instance.Robot.MovePosU(this.txtAngle.Value); Machine.Instance.Valve1.CurTilt = this.tiltType; }
/// <summary> /// 相机坐标转换倾斜喷嘴坐标 /// </summary> /// <param name="point"></param> /// <param name="valveType"></param> /// <param name="tiltType"></param> /// <returns></returns> public static PointD ToNeedle(this PointD point, ValveType valveType, TiltType tiltType) { PointD rtn = null; if (valveType == ValveType.Valve1 || valveType == ValveType.Both) { if (tiltType == TiltType.NoTilt) { return(rtn = (point.ToSystem() + Machine.Instance.Robot.CalibPrm.NeedleCamera1 - Machine.Instance.Robot.CalibPrm.NeedleJet1).ToPoint().ToMachine()); } AngleHeightPosOffset curTiltCalibPrm = Machine.Instance.Robot.CalibPrm.AngleHeightPosOffsetList.Find(t => t.TiltType.Equals(tiltType)); if (curTiltCalibPrm == null) { return(null); } rtn = (point.ToSystem() + curTiltCalibPrm.ValveCameraOffset - curTiltCalibPrm.DispenseOffset).ToPoint().ToMachine(); } else { if (Machine.Instance.Setting.DualValveMode != DualValveMode.跟随) { rtn = new PointD( point.X + Machine.Instance.Robot.CalibPrm.NeedleCamera2.X - Machine.Instance.Robot.CalibPrm.NeedleJet2.X + Math.Abs(Machine.Instance.Robot.PosA), point.Y + Machine.Instance.Robot.CalibPrm.NeedleCamera2.Y - Machine.Instance.Robot.CalibPrm.NeedleJet2.Y + Math.Abs(Machine.Instance.Robot.PosB)); } else { rtn = new PointD( point.X + Machine.Instance.Robot.CalibPrm.NeedleCamera2.X - Machine.Instance.Robot.CalibPrm.NeedleJet2.X, point.Y + Machine.Instance.Robot.CalibPrm.NeedleCamera2.Y - Machine.Instance.Robot.CalibPrm.NeedleJet2.Y); } } return(rtn); }
public void Setup(object[] objs) { dotParam = FluidProgram.CurrentOrDefault().ProgramSettings.GetDotParam(dotStyle); this.tileType = (TiltType)objs[0]; this.valveAngle = (double)objs[1]; this.valveCameraOffset = (PointD)objs[2]; this.standardZ = (double)objs[3]; }
public TiltEntry(TiltType type, string origLine, float min, float max, bool range = true) { this.origLine = origLine; this.tiltType = type; this.min = min; this.max = max; this.range = range; }
/// <summary> /// 胶阀倾斜到位 /// </summary> /// <param name="tiltType"></param> /// <param name="velU"></param> /// <param name="accU"></param> /// <returns></returns> public Result ChangeValveTiltStatus(TiltType tiltType, double velU, double accU) { Result ret = Result.OK; // 倾斜到位(胶阀当前倾斜状态不等于轨迹倾斜状态时执行) if (tiltType != Machine.Instance.Valve1.CurTilt && (Machine.Instance.Robot.RobotIsXYZU || Machine.Instance.Robot.RobotIsXYZUV)) { // 回到安全高度再变方向 if (Machine.Instance.Robot.PosZ < Machine.Instance.Robot.CalibPrm.SafeZ) { ret = Machine.Instance.Robot.MoveSafeZAndReply(); if (!ret.IsOk) { return(ret); } } if (Machine.Instance.Robot.RobotIsXYZUV) { // todo 四方位旋转气缸动作 } //U轴倾斜 AngleHeightPosOffset tiltValvePrm = Machine.Instance.Robot.CalibPrm.AngleHeightPosOffsetList.Find(t => t.TiltType.Equals(tiltType)); if (tiltValvePrm == null) { return(Result.FAILED); } if (velU == 0 || accU == 0) { return(Result.FAILED); } ret = Machine.Instance.Robot.MovePosUAndReply(tiltValvePrm.ValveAngle, velU, accU); if (!ret.IsOk) { return(ret); } else { Machine.Instance.Valve1.CurTilt = tiltType; } } return(ret); }
public void Setup(object[] objs) { this.tiltType = (TiltType)objs[0]; this.valveAngle = (double)objs[1]; }
public string Initialize(string filePath, string[] dataLines, bool flipBytes, bool syncListViaNetcore) { //Ignore flipbytes, as this list works differently int line = 2; foreach (string s in dataLines) { string workingString = s.Replace("f", "").Replace("F", "").Replace(" ", "").ToUpper(); string origLine = workingString; var m = entryRegex.Match(workingString); if (m == null || !m.Success) { throw new Exception($"Error loading {filePath}: Unable to parse line {line}, parse failed"); } TiltType type = TiltType.ADD; try { //Type if (m.Groups["type"].Success) { switch (m.Groups[2].Value) { case "ADD": break; case "SUB": type = TiltType.SUB; break; case "MUL": type = TiltType.MUL; break; case "DIV": type = TiltType.DIV; break; case "SET": type = TiltType.SET; break; default: break; } } bool range = false; float min = 0; float max = 0; if (m.Groups["range"].Success) { range = true; //6/7 min = float.Parse(m.Groups[4].Value, culture); max = float.Parse(m.Groups[5].Value, culture); } else { //9 min = float.Parse(m.Groups[9].Value, culture); } TiltEntry entry = new TiltEntry(type, origLine, min, max, range); entries.Add(entry); } catch (Exception ex) { throw new Exception($"Error loading {filePath}: Unable to parse line {line}, float parse failed. Exception:\r\n{ex}"); } line++; } if (entries.Count == 0) { throw new Exception($"Error loading {filePath}: List empty"); } var name = Path.GetFileNameWithoutExtension(filePath); string hash = Filtering.RegisterList(this, name, syncListViaNetcore); return(hash); }