Commit cdfce4a6 几米阳光

坐标偏移模块修改

1 个父辈 7f428025
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -24,7 +24,6 @@ namespace URSoldering.Common ...@@ -24,7 +24,6 @@ namespace URSoldering.Common
return false; return false;
} }
private static int seq = 1; private static int seq = 1;
public static int nextSeq() public static int nextSeq()
...@@ -38,8 +37,6 @@ namespace URSoldering.Common ...@@ -38,8 +37,6 @@ namespace URSoldering.Common
return seq; return seq;
} }
public static string GetValue(string keyStr, string storeStr) public static string GetValue(string keyStr, string storeStr)
{ {
string key = keyStr + storeStr; string key = keyStr + storeStr;
...@@ -65,10 +62,8 @@ namespace URSoldering.Common ...@@ -65,10 +62,8 @@ namespace URSoldering.Common
} }
else else
{ {
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a); Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
} }
}
return a; return a;
} }
public static int GetIntValue(string keyStr, string storeStr) public static int GetIntValue(string keyStr, string storeStr)
...@@ -82,10 +77,9 @@ namespace URSoldering.Common ...@@ -82,10 +77,9 @@ namespace URSoldering.Common
} }
else else
{ {
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a); Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
} }
} return a; return a;
} }
/// <summary> /// <summary>
/// 获取文件的绝对路径 /// 获取文件的绝对路径
...@@ -122,10 +116,8 @@ namespace URSoldering.Common ...@@ -122,10 +116,8 @@ namespace URSoldering.Common
} }
else else
{ {
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a); Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
} }
}
return a; return a;
} }
public static int GetIntValue(string key) public static int GetIntValue(string key)
...@@ -139,10 +131,11 @@ namespace URSoldering.Common ...@@ -139,10 +131,11 @@ namespace URSoldering.Common
} }
else else
{ {
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a); Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
} }
} return a; return a;
} }
public static void SaveValue(string key, int value) public static void SaveValue(string key, int value)
{ {
......
...@@ -323,7 +323,7 @@ namespace URSoldering.DeviceLibrary ...@@ -323,7 +323,7 @@ namespace URSoldering.DeviceLibrary
x = (pianyiPosition.DataX - MarkImgPosition.DataX) * MarkChangeValue; x = (pianyiPosition.DataX - MarkImgPosition.DataX) * MarkChangeValue;
y = (pianyiPosition.DataY - MarkImgPosition.DataY) * MarkChangeValue; y = (pianyiPosition.DataY - MarkImgPosition.DataY) * MarkChangeValue;
WeldLog("找到偏移点,开始进行偏移 X【" + y + "】Y【" + y + "】"); WeldLog("找到偏移点,开始进行偏移 X【" + x + "】Y【" + y + "】");
WeldMoveStep.PositionOffSet(x, y); WeldMoveStep.PositionOffSet(x, y);
} }
} }
......
...@@ -28,12 +28,23 @@ namespace URSoldering.DeviceLibrary ...@@ -28,12 +28,23 @@ namespace URSoldering.DeviceLibrary
{ {
for (int i = 0; i < weldPointList.Count; i++) for (int i = 0; i < weldPointList.Count; i++)
{ {
if (weldPointList[i].pointType.Equals(3))
{
LogUtil.info(weldPointList[i].pointName + "是拍照点,不需要坐标偏移");
}
else if (weldPointList[i].pointType.Equals(1))
{
LogUtil.info(weldPointList[i].pointName + "是中间点,不需要坐标偏移");
}
else
{
string oldPosition = weldPointList[i].GetURPoint().ToShowStr(); string oldPosition = weldPointList[i].GetURPoint().ToShowStr();
weldPointList[i].RobotX += x; weldPointList[i].RobotX += x;
weldPointList[i].RobotY += y; weldPointList[i].RobotY += y;
LogUtil.info(weldPointList[i].pointName + "坐标偏移:偏移前【" + oldPosition + "】偏移后【" + weldPointList[i].GetURPoint().ToShowStr() + "】"); LogUtil.info(weldPointList[i].pointName + "坐标偏移:偏移前【" + oldPosition + "】偏移后【" + weldPointList[i].GetURPoint().ToShowStr() + "】");
} }
} }
}
/// <summary> /// <summary>
/// 焊接的板子信息 /// 焊接的板子信息
/// </summary> /// </summary>
...@@ -104,7 +115,7 @@ namespace URSoldering.DeviceLibrary ...@@ -104,7 +115,7 @@ namespace URSoldering.DeviceLibrary
/// 开始焊接 /// 开始焊接
/// </summary> /// </summary>
/// <param name="pointType">焊点类型,0=所有 </param> /// <param name="pointType">焊点类型,0=所有 </param>
public bool NewWeld(MoveType type, BoardInfo board ) public bool NewWeld(MoveType type, BoardInfo board)
{ {
IsSlowSendWire = false; IsSlowSendWire = false;
StartPointIndex = 0; StartPointIndex = 0;
...@@ -113,44 +124,23 @@ namespace URSoldering.DeviceLibrary ...@@ -113,44 +124,23 @@ namespace URSoldering.DeviceLibrary
this.currBoard = board; this.currBoard = board;
CurrPointIndex = 0; CurrPointIndex = 0;
//需要把拍照点放到第一个 //安装配置顺序加入
WeldPointInfo photoPoint = null; weldPointList = new List<WeldPointInfo>();
foreach(WeldPointInfo p in board.pointList) foreach (WeldPointInfo p in board.pointList)
{ {
if (!URRobotControl.PointIsValid(p.GetURPoint())) if (!URRobotControl.PointIsValid(p.GetURPoint()))
{ {
LogUtil.error("【" + board.boardName + "】的焊点【" + p.pointName + "】坐标无效,无法开始焊接"); LogUtil.error("【" + board.boardName + "】的焊点【" + p.pointName + "】坐标无效,无法开始焊接");
return false; return false;
} }
if (p.pointType.Equals(3)) WeldPointInfo newP = p.Clone();
{ weldPointList.Add(newP);
photoPoint = p;
}
else
{
weldPointList.Add(p);
}
} }
if (weldPointList.Count <= 0) if (weldPointList.Count <= 0)
{ {
return false; return false;
} }
if (photoPoint != null)
{
weldPointList.Add(photoPoint);
}
//weldPointList = board.pointList;
//foreach(WeldPointInfo p in weldPointList)
//{
// if (!URRobotControl.PointIsValid(p.GetURPoint()))
// {
// LogUtil.error("【"+ board .boardName+ "】的焊点【"+p.pointName+"】坐标无效,无法开始焊接");
// return false;
// }
//}
CurrPoint = weldPointList[CurrPointIndex]; CurrPoint = weldPointList[CurrPointIndex];
PointTime = new PointWeldTime(); PointTime = new PointWeldTime();
ResetCount = 0; ResetCount = 0;
......
...@@ -292,5 +292,10 @@ namespace URSoldering.DeviceLibrary ...@@ -292,5 +292,10 @@ namespace URSoldering.DeviceLibrary
return p; return p;
} }
public WeldPointInfo Clone()
{
return (WeldPointInfo)this.MemberwiseClone();
}
} }
} }
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txtRevice = new System.Windows.Forms.TextBox(); this.txtRevice = new System.Windows.Forms.TextBox();
this.btnSend = new System.Windows.Forms.Button(); this.btnSend = new System.Windows.Forms.Button();
...@@ -50,6 +51,7 @@ ...@@ -50,6 +51,7 @@
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
this.btnOpenSold = new System.Windows.Forms.Button(); this.btnOpenSold = new System.Windows.Forms.Button();
this.lblMsg = new System.Windows.Forms.Label(); this.lblMsg = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
...@@ -285,6 +287,11 @@ ...@@ -285,6 +287,11 @@
this.lblMsg.TabIndex = 283; this.lblMsg.TabIndex = 283;
this.lblMsg.Text = "急停未开"; this.lblMsg.Text = "急停未开";
// //
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// FrmSendWire // FrmSendWire
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
...@@ -294,6 +301,7 @@ ...@@ -294,6 +301,7 @@
this.Controls.Add(this.lblMsg); this.Controls.Add(this.lblMsg);
this.Name = "FrmSendWire"; this.Name = "FrmSendWire";
this.Text = "送丝机调试"; this.Text = "送丝机调试";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmSendWire_FormClosed);
this.Load += new System.EventHandler(this.FrmSendWire_Load); this.Load += new System.EventHandler(this.FrmSendWire_Load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout(); this.groupBox1.PerformLayout();
...@@ -326,5 +334,6 @@ ...@@ -326,5 +334,6 @@
private System.Windows.Forms.TextBox txtRevice; private System.Windows.Forms.TextBox txtRevice;
private System.Windows.Forms.Button btnSend; private System.Windows.Forms.Button btnSend;
private System.Windows.Forms.TextBox txtSend; private System.Windows.Forms.TextBox txtSend;
private System.Windows.Forms.Timer timer1;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -73,17 +73,7 @@ namespace URSoldering.Client ...@@ -73,17 +73,7 @@ namespace URSoldering.Client
{ {
this.Close(); this.Close();
} }
private void timer2_Tick(object sender, EventArgs e)
{
if (RobotBean.KNDIOValue(IO_Type.SuddenStop_Single).Equals(IO_VALUE.LOW))
{
lblMsg.Text = "急停未开";
}
else
{
lblMsg.Text = "";
}
}
private void btnReadError_Click(object sender, EventArgs e) private void btnReadError_Click(object sender, EventArgs e)
{ {
...@@ -117,6 +107,7 @@ namespace URSoldering.Client ...@@ -117,6 +107,7 @@ namespace URSoldering.Client
{ {
formStatus(false); formStatus(false);
} }
timer1.Start();
} }
private void btnReadError_Click_1(object sender, EventArgs e) private void btnReadError_Click_1(object sender, EventArgs e)
...@@ -152,5 +143,22 @@ namespace URSoldering.Client ...@@ -152,5 +143,22 @@ namespace URSoldering.Client
txtRevice.Text = rawMsg; txtRevice.Text = rawMsg;
} }
} }
private void timer1_Tick(object sender, EventArgs e)
{
if (RobotBean.KNDIOValue(IO_Type.SuddenStop_Single).Equals(IO_VALUE.LOW))
{
lblMsg.Text = "急停未开";
}
else
{
lblMsg.Text = "";
}
}
private void FrmSendWire_FormClosed(object sender, FormClosedEventArgs e)
{
timer1.Stop();
}
} }
} }
...@@ -117,4 +117,7 @@ ...@@ -117,4 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>
\ No newline at end of file \ No newline at end of file
...@@ -135,8 +135,8 @@ namespace URSoldering.Client ...@@ -135,8 +135,8 @@ namespace URSoldering.Client
// return; // return;
//} //}
int x = FormUtil.GetIntValue(txtMarkX); double x = FormUtil.getDoubleValue(txtMarkX);
int y = FormUtil.GetIntValue(txtMarkY); double y = FormUtil.getDoubleValue(txtMarkY);
if (x <= 0 || y <= 0) if (x <= 0 || y <= 0)
{ {
MessageBox.Show("请输入正确的Mark的图片坐标"); MessageBox.Show("请输入正确的Mark的图片坐标");
......
...@@ -534,6 +534,7 @@ namespace URSoldering.Client ...@@ -534,6 +534,7 @@ namespace URSoldering.Client
lblAOIResult.Visible = false; lblAOIResult.Visible = false;
lblCodeResult.Visible = false; lblCodeResult.Visible = false;
StartRun(); StartRun();
WeldRobotBean.StartWeld();
} }
private void StartRun() private void StartRun()
{ {
......
...@@ -68,7 +68,7 @@ AOI检测NG时,红灯亮,等到下次开始焊接时清理红灯。 ...@@ -68,7 +68,7 @@ AOI检测NG时,红灯亮,等到下次开始焊接时清理红灯。
拍照点不需要坐标偏移
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!