Commit cdfce4a6 几米阳光

坐标偏移模块修改

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