Commit 3f9f31b3 几米阳光

坐标偏移功能。离线编程功能。

1 个父辈 c5a1d21e
...@@ -102,7 +102,19 @@ namespace URSoldering.Common ...@@ -102,7 +102,19 @@ namespace URSoldering.Common
public static string HasSoldering = "HasSoldering"; public static string HasSoldering = "HasSoldering";
public static string Config_Pwd = "Config_Pwd"; public static string Config_Pwd = "Config_Pwd";
public static string ZUpLiftValue = "ZUpLiftValue"; public static string ZUpLiftValue = "ZUpLiftValue";
/// <summary>
/// Mark点的基准信息,从AOI获取的坐标
/// </summary>
public static string MarkDefaultPosition = "MarkDefaultPosition";
/// <summary>
/// 坐标转换系数,AOI获取图片的1像素对应实际多少毫米
/// </summary>
public static string PositionChangeValue = "PositionChangeValue";
/// <summary>
/// 坐标偏移的AOI节点名称
/// </summary>
public static string OffSetNodeName = "OffSetNodeName";
} }
} }
...@@ -60,7 +60,23 @@ namespace URSoldering.DeviceLibrary ...@@ -60,7 +60,23 @@ namespace URSoldering.DeviceLibrary
wait.IsEnd = false; wait.IsEnd = false;
return wait; return wait;
} }
/// <summary>
/// 等待坐标偏移
/// </summary>
/// <returns></returns>
public static WaitResultInfo WaitOffSet()
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = 7;
wait.IsEnd = false;
return wait;
}public static WaitResultInfo WaitAoiEnd()
{
WaitResultInfo wait = new WaitResultInfo();
wait.WaitType = 8;
wait.IsEnd = false;
return wait;
}
public string ToStr() public string ToStr()
{ {
if (WaitType == 1) if (WaitType == 1)
...@@ -73,7 +89,7 @@ namespace URSoldering.DeviceLibrary ...@@ -73,7 +89,7 @@ namespace URSoldering.DeviceLibrary
} }
else if (WaitType == 3) else if (WaitType == 3)
{ {
return "等待机器人运动结束"+UrPoint.ToShowStr(); return "等待机器人移动到位【"+UrPoint.ToShowStr()+"】";
} }
else if (WaitType == 4) else if (WaitType == 4)
{ {
...@@ -86,6 +102,14 @@ namespace URSoldering.DeviceLibrary ...@@ -86,6 +102,14 @@ namespace URSoldering.DeviceLibrary
{ {
return "等待机器人连接完成"; return "等待机器人连接完成";
} }
else if (WaitType == 7)
{
return "等待坐标偏移完成";
}
else if (WaitType == 8)
{
return "等待AOI检测完成";
}
else else
{ {
return "Wait位置类型:WaitType=【" + WaitType + "】"; return "Wait位置类型:WaitType=【" + WaitType + "】";
...@@ -137,6 +161,8 @@ namespace URSoldering.DeviceLibrary ...@@ -137,6 +161,8 @@ namespace URSoldering.DeviceLibrary
/// 机器人坐标 /// 机器人坐标
/// </summary> /// </summary>
public URPointValue UrPoint { get; set; } public URPointValue UrPoint { get; set; }
} }
public enum MoveType public enum MoveType
{ {
...@@ -204,9 +230,13 @@ namespace URSoldering.DeviceLibrary ...@@ -204,9 +230,13 @@ namespace URSoldering.DeviceLibrary
/// </summary> /// </summary>
W14_AOICheck=14, W14_AOICheck=14,
/// <summary> /// <summary>
/// AOI检测完成
/// </summary>
W15_AOIEnd=15,
/// <summary>
/// 清洗完成 /// 清洗完成
/// </summary> /// </summary>
W15_ClearEnd=15, W16_ClearEnd=16,
///// <summary> ///// <summary>
///// 送丝下降 ///// 送丝下降
///// </summary> ///// </summary>
...@@ -231,6 +261,10 @@ namespace URSoldering.DeviceLibrary ...@@ -231,6 +261,10 @@ namespace URSoldering.DeviceLibrary
/// 等待3秒后识别位置进行坐标偏移 /// 等待3秒后识别位置进行坐标偏移
/// </summary> /// </summary>
W31_WaitToPositionOffset = 31, W31_WaitToPositionOffset = 31,
/// <summary>
/// 坐标偏移完成
/// </summary>
W32_PositionOffsetEnd=32,
Home_Reset = 100, Home_Reset = 100,
/// <summary> /// <summary>
......
...@@ -74,6 +74,7 @@ namespace URSoldering.DeviceLibrary ...@@ -74,6 +74,7 @@ namespace URSoldering.DeviceLibrary
RobotMin = LoadPoint(Setting_Init.Soldering_RobotMin); RobotMin = LoadPoint(Setting_Init.Soldering_RobotMin);
RobotMax = LoadPoint(Setting_Init.Soldering_RobotMax); RobotMax = LoadPoint(Setting_Init.Soldering_RobotMax);
MarkPoint = LoadPoint(Setting_Init.Soldering_MarkPoint); MarkPoint = LoadPoint(Setting_Init.Soldering_MarkPoint);
LoadMarkInfo();
} }
private static URPointValue LoadPoint(string configStr) private static URPointValue LoadPoint(string configStr)
......
...@@ -24,6 +24,16 @@ namespace URSoldering.DeviceLibrary ...@@ -24,6 +24,16 @@ namespace URSoldering.DeviceLibrary
PointTime = null; PointTime = null;
OneWaitOk = false; OneWaitOk = false;
} }
public void PositionOffSet(double x, double y)
{
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() + "】");
}
}
/// <summary> /// <summary>
/// 焊接的板子信息 /// 焊接的板子信息
/// </summary> /// </summary>
...@@ -102,27 +112,45 @@ namespace URSoldering.DeviceLibrary ...@@ -102,27 +112,45 @@ namespace URSoldering.DeviceLibrary
NewWeld(type); NewWeld(type);
this.currBoard = board; this.currBoard = board;
CurrPointIndex = 0; CurrPointIndex = 0;
//if (pointType.Equals(0))
//{ //需要把拍照点放到第一个
weldPointList = board.pointList; WeldPointInfo photoPoint = null;
//} foreach(WeldPointInfo p in board.pointList)
//else
//{
// weldPointList = (from m in board.pointList where m.pointType.Equals(pointType) && m.pointType.Equals(0) select m).ToList<WeldPointInfo>();
//}
if (weldPointList.Count <= 0)
{ {
if (!URRobotControl.PointIsValid(p.GetURPoint()))
{
LogUtil.error("【" + board.boardName + "】的焊点【" + p.pointName + "】坐标无效,无法开始焊接");
return false; return false;
} }
foreach(WeldPointInfo p in weldPointList) if (p.pointType.Equals(3))
{ {
if (!URRobotControl.PointIsValid(p.GetURPoint())) photoPoint = p;
}
else
{
weldPointList.Add(p);
}
}
if (weldPointList.Count <= 0)
{ {
LogUtil.error("【"+ board .boardName+ "】的焊点【"+p.pointName+"】坐标无效,无法开始焊接");
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;
......
...@@ -2,17 +2,19 @@ ...@@ -2,17 +2,19 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using URSoldering.Common;
namespace URSoldering.DeviceLibrary namespace URSoldering.DeviceLibrary
{ {
/// <summary>
/// 从AOI获取的基准点坐标信息
/// </summary>
public class PositionResult public class PositionResult
{ {
public PositionResult(double x, double y, int type, WeldPointInfo point) public PositionResult(double x, double y )
{ {
this.DataX = x; this.DataX = x;
this.DataY = y; this.DataY = y;
this.DataType = type;
this.PointInfo = point;
} }
/// <summary> /// <summary>
/// 位置X /// 位置X
...@@ -22,13 +24,16 @@ namespace URSoldering.DeviceLibrary ...@@ -22,13 +24,16 @@ namespace URSoldering.DeviceLibrary
/// 位置Y /// 位置Y
/// </summary> /// </summary>
public double DataY = 0; public double DataY = 0;
/// <summary>
/// 数据类型,1=少锡,2=多锡 public string ToJosonStr()
/// </summary> {
public int DataType = 0; string jsonStr = JsonHelper.SerializeObject(this);
/// <summary> return jsonStr;
/// 拍照点、基准点坐标 }
/// </summary>
public WeldPointInfo PointInfo = null; public static PositionResult ToObject(string json)
{
return JsonHelper.DeserializeJsonToObject<PositionResult>(json);
}
} }
} }
...@@ -196,12 +196,19 @@ namespace URSoldering.DeviceLibrary ...@@ -196,12 +196,19 @@ namespace URSoldering.DeviceLibrary
byte[] minTemp = parseCommand("RMIT", out isOk); byte[] minTemp = parseCommand("RMIT", out isOk);
return getReviceTemp(minTemp); return getReviceTemp(minTemp);
} }
public static bool IsRightTemp(int temperature, int minTemp, int maxTemp)
internal static void Init(object jBC_SerialPort, object jBC_EquipmentPort) {
int temp = SolderingManager.queryActualTemp();
if (temperature != temp && (temp < minTemp))
//if (wait.Temperature != temp && (temp < wait.TemperatureMin || temp > wait.TemperatureMax))
{ {
throw new NotImplementedException(); return false;
}
else
{
return true;
}
} }
public static int ReadPortError() public static int ReadPortError()
{ {
if (IsRun) if (IsRun)
......
...@@ -615,6 +615,20 @@ namespace URSoldering.DeviceLibrary ...@@ -615,6 +615,20 @@ namespace URSoldering.DeviceLibrary
public double RY { get; set; } public double RY { get; set; }
public double RZ { get; set; } public double RZ { get; set; }
/// <summary>
/// 坐标是否有效
/// </summary>
/// <returns></returns>
public bool IsValid()
{
if (X.Equals(0) && Y.Equals(0) && Z.Equals(0) && RX.Equals(0) && RY.Equals(0) && RZ.Equals(0))
{
return false;
}
return true;
}
public string ToShowStr() public string ToShowStr()
{ {
return "[X: " + X + ",Y: " + Y + ",Z: " + Z + ",RX: " + RX + ",RY:" + RY + ",RZ:" + RZ + "]"; return "[X: " + X + ",Y: " + Y + ",Z: " + Z + ",RX: " + RX + ",RY:" + RY + ",RZ:" + RZ + "]";
...@@ -630,8 +644,6 @@ namespace URSoldering.DeviceLibrary ...@@ -630,8 +644,6 @@ namespace URSoldering.DeviceLibrary
{ {
return JsonHelper.DeserializeJsonToObject<URPointValue>(json); return JsonHelper.DeserializeJsonToObject<URPointValue>(json);
} }
}
} }
public struct URStatus public struct URStatus
{ {
...@@ -657,6 +669,7 @@ namespace URSoldering.DeviceLibrary ...@@ -657,6 +669,7 @@ namespace URSoldering.DeviceLibrary
/// </summary> /// </summary>
public static string SFETY_POWER_OFF = "POWER_OFF"; public static string SFETY_POWER_OFF = "POWER_OFF";
} }
}
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
<add key="Soldering_RobotMax" value="{&quot;UpdateTime&quot;:&quot;2018-07-28T14:37:09.4700739+08:00&quot;,&quot;X&quot;:0.0,&quot;Y&quot;:0.0,&quot;Z&quot;:0.0,&quot;RX&quot;:0.0,&quot;RY&quot;:0.0,&quot;RZ&quot;:0.0}" /> <add key="Soldering_RobotMax" value="{&quot;UpdateTime&quot;:&quot;2018-07-28T14:37:09.4700739+08:00&quot;,&quot;X&quot;:0.0,&quot;Y&quot;:0.0,&quot;Z&quot;:0.0,&quot;RX&quot;:0.0,&quot;RY&quot;:0.0,&quot;RZ&quot;:0.0}" />
<add key="Soldering_MarkPoint" value="{&quot;UpdateTime&quot;:&quot;2018-07-28T14:37:09.4700739+08:00&quot;,&quot;X&quot;:0.0,&quot;Y&quot;:0.0,&quot;Z&quot;:0.0,&quot;RX&quot;:0.0,&quot;RY&quot;:0.0,&quot;RZ&quot;:0.0}" /> <add key="Soldering_MarkPoint" value="{&quot;UpdateTime&quot;:&quot;2018-07-28T14:37:09.4700739+08:00&quot;,&quot;X&quot;:0.0,&quot;Y&quot;:0.0,&quot;Z&quot;:0.0,&quot;RX&quot;:0.0,&quot;RY&quot;:0.0,&quot;RZ&quot;:0.0}" />
<add key="Config_Pwd" value="123456" /> <add key="Config_Pwd" value="123456" />
<!--坐标偏移Mark点的图像默认坐标-->
<add key="MarkDefaultPosition" value="{&quot;DataX&quot;:0.0,&quot;DataY&quot;:0.0}" />
<!--坐标偏移坐标转换系数,图片的1像素对应实际多少毫米-->
<add key="PositionChangeValue" value="1" />
<!--坐标偏移AOI检测的分支名称-->
<add key="OffSetNodeName" value="坐标偏移"/>
</appSettings> </appSettings>
<log4net> <log4net>
<appender name="defaultAppender" type="log4net.Appender.RollingFileAppender"> <appender name="defaultAppender" type="log4net.Appender.RollingFileAppender">
......
...@@ -369,7 +369,6 @@ ...@@ -369,7 +369,6 @@
this.dgvPoint.Location = new System.Drawing.Point(1080, 85); this.dgvPoint.Location = new System.Drawing.Point(1080, 85);
this.dgvPoint.MultiSelect = false; this.dgvPoint.MultiSelect = false;
this.dgvPoint.Name = "dgvPoint"; this.dgvPoint.Name = "dgvPoint";
this.dgvPoint.ReadOnly = true;
this.dgvPoint.RowHeadersWidth = 5; this.dgvPoint.RowHeadersWidth = 5;
this.dgvPoint.RowTemplate.Height = 23; this.dgvPoint.RowTemplate.Height = 23;
this.dgvPoint.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.dgvPoint.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
...@@ -1153,7 +1152,7 @@ ...@@ -1153,7 +1152,7 @@
// //
this.cmbAoiFile.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.cmbAoiFile.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbAoiFile.FormattingEnabled = true; this.cmbAoiFile.FormattingEnabled = true;
this.cmbAoiFile.Location = new System.Drawing.Point(340, 23); this.cmbAoiFile.Location = new System.Drawing.Point(350, 23);
this.cmbAoiFile.Name = "cmbAoiFile"; this.cmbAoiFile.Name = "cmbAoiFile";
this.cmbAoiFile.Size = new System.Drawing.Size(180, 25); this.cmbAoiFile.Size = new System.Drawing.Size(180, 25);
this.cmbAoiFile.TabIndex = 269; this.cmbAoiFile.TabIndex = 269;
...@@ -1161,7 +1160,7 @@ ...@@ -1161,7 +1160,7 @@
// label9 // label9
// //
this.label9.AutoSize = true; this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(256, 28); this.label9.Location = new System.Drawing.Point(266, 28);
this.label9.Name = "label9"; this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(78, 17); this.label9.Size = new System.Drawing.Size(78, 17);
this.label9.TabIndex = 268; this.label9.TabIndex = 268;
...@@ -1179,7 +1178,7 @@ ...@@ -1179,7 +1178,7 @@
// //
this.label25.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label25.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label25.AutoSize = true; this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(768, 28); this.label25.Location = new System.Drawing.Point(788, 28);
this.label25.Name = "label25"; this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(42, 17); this.label25.Size = new System.Drawing.Size(42, 17);
this.label25.TabIndex = 37; this.label25.TabIndex = 37;
...@@ -1189,7 +1188,7 @@ ...@@ -1189,7 +1188,7 @@
// //
this.label24.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label24.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label24.AutoSize = true; this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(631, 28); this.label24.Location = new System.Drawing.Point(651, 28);
this.label24.Name = "label24"; this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(36, 17); this.label24.Size = new System.Drawing.Size(36, 17);
this.label24.TabIndex = 36; this.label24.TabIndex = 36;
...@@ -1209,7 +1208,7 @@ ...@@ -1209,7 +1208,7 @@
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.FlatAppearance.BorderSize = 0; this.btnSave.FlatAppearance.BorderSize = 0;
this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSave.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSave.Location = new System.Drawing.Point(927, 16); this.btnSave.Location = new System.Drawing.Point(939, 16);
this.btnSave.Name = "btnSave"; this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(117, 41); this.btnSave.Size = new System.Drawing.Size(117, 41);
this.btnSave.TabIndex = 40; this.btnSave.TabIndex = 40;
...@@ -1220,7 +1219,7 @@ ...@@ -1220,7 +1219,7 @@
// txtBoardLength // txtBoardLength
// //
this.txtBoardLength.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.txtBoardLength.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.txtBoardLength.Location = new System.Drawing.Point(576, 25); this.txtBoardLength.Location = new System.Drawing.Point(596, 25);
this.txtBoardLength.MaxLength = 8; this.txtBoardLength.MaxLength = 8;
this.txtBoardLength.Name = "txtBoardLength"; this.txtBoardLength.Name = "txtBoardLength";
this.txtBoardLength.Size = new System.Drawing.Size(53, 23); this.txtBoardLength.Size = new System.Drawing.Size(53, 23);
...@@ -1231,7 +1230,7 @@ ...@@ -1231,7 +1230,7 @@
// //
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(691, 28); this.label4.Location = new System.Drawing.Point(711, 28);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(20, 17); this.label4.Size = new System.Drawing.Size(20, 17);
this.label4.TabIndex = 5; this.label4.TabIndex = 5;
...@@ -1241,7 +1240,7 @@ ...@@ -1241,7 +1240,7 @@
// //
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(554, 28); this.label3.Location = new System.Drawing.Point(574, 28);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(20, 17); this.label3.Size = new System.Drawing.Size(20, 17);
this.label3.TabIndex = 3; this.label3.TabIndex = 3;
...@@ -1250,7 +1249,7 @@ ...@@ -1250,7 +1249,7 @@
// txtBoardWidth // txtBoardWidth
// //
this.txtBoardWidth.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.txtBoardWidth.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.txtBoardWidth.Location = new System.Drawing.Point(713, 25); this.txtBoardWidth.Location = new System.Drawing.Point(733, 25);
this.txtBoardWidth.MaxLength = 8; this.txtBoardWidth.MaxLength = 8;
this.txtBoardWidth.Name = "txtBoardWidth"; this.txtBoardWidth.Name = "txtBoardWidth";
this.txtBoardWidth.Size = new System.Drawing.Size(53, 23); this.txtBoardWidth.Size = new System.Drawing.Size(53, 23);
...@@ -1306,41 +1305,42 @@ ...@@ -1306,41 +1305,42 @@
// //
// Col_ID // Col_ID
// //
this.Col_ID.HeaderText = "固定点"; this.Col_ID.HeaderText = "位置";
this.Col_ID.Name = "Col_ID"; this.Col_ID.Name = "Col_ID";
this.Col_ID.ReadOnly = true; this.Col_ID.ReadOnly = true;
this.Col_ID.Width = 90; this.Col_ID.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Col_ID.Width = 120;
// //
// Col_X // Col_X
// //
this.Col_X.DataPropertyName = "RobotX"; this.Col_X.DataPropertyName = "RobotX";
this.Col_X.HeaderText = "X"; this.Col_X.HeaderText = "X";
this.Col_X.Name = "Col_X"; this.Col_X.Name = "Col_X";
this.Col_X.ReadOnly = true; this.Col_X.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Col_X.Width = 68; this.Col_X.Width = 75;
// //
// Col_Y // Col_Y
// //
this.Col_Y.DataPropertyName = "RobotY"; this.Col_Y.DataPropertyName = "RobotY";
this.Col_Y.HeaderText = "Y"; this.Col_Y.HeaderText = "Y";
this.Col_Y.Name = "Col_Y"; this.Col_Y.Name = "Col_Y";
this.Col_Y.ReadOnly = true; this.Col_Y.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Col_Y.Width = 68; this.Col_Y.Width = 75;
// //
// Col_Z // Col_Z
// //
this.Col_Z.DataPropertyName = "RobotZ"; this.Col_Z.DataPropertyName = "RobotZ";
this.Col_Z.HeaderText = "Z"; this.Col_Z.HeaderText = "Z";
this.Col_Z.Name = "Col_Z"; this.Col_Z.Name = "Col_Z";
this.Col_Z.ReadOnly = true; this.Col_Z.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Col_Z.Width = 68; this.Col_Z.Width = 75;
// //
// Col_RX // Col_RX
// //
this.Col_RX.DataPropertyName = "RobotRX"; this.Col_RX.DataPropertyName = "RobotRX";
this.Col_RX.HeaderText = "RX"; this.Col_RX.HeaderText = "RX";
this.Col_RX.Name = "Col_RX"; this.Col_RX.Name = "Col_RX";
this.Col_RX.ReadOnly = true; this.Col_RX.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Col_RX.Width = 75; this.Col_RX.Width = 75;
// //
// Col_RY // Col_RY
...@@ -1348,7 +1348,7 @@ ...@@ -1348,7 +1348,7 @@
this.Col_RY.DataPropertyName = "RobotRY"; this.Col_RY.DataPropertyName = "RobotRY";
this.Col_RY.HeaderText = "RY"; this.Col_RY.HeaderText = "RY";
this.Col_RY.Name = "Col_RY"; this.Col_RY.Name = "Col_RY";
this.Col_RY.ReadOnly = true; this.Col_RY.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Col_RY.Width = 75; this.Col_RY.Width = 75;
// //
// Col_RZ // Col_RZ
...@@ -1356,7 +1356,7 @@ ...@@ -1356,7 +1356,7 @@
this.Col_RZ.DataPropertyName = "RobotRZ"; this.Col_RZ.DataPropertyName = "RobotRZ";
this.Col_RZ.HeaderText = "RZ"; this.Col_RZ.HeaderText = "RZ";
this.Col_RZ.Name = "Col_RZ"; this.Col_RZ.Name = "Col_RZ";
this.Col_RZ.ReadOnly = true; this.Col_RZ.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Col_RZ.Width = 75; this.Col_RZ.Width = 75;
// //
// Col_Update // Col_Update
...@@ -1378,6 +1378,7 @@ ...@@ -1378,6 +1378,7 @@
this.Col_Move.Text = "移动测试"; this.Col_Move.Text = "移动测试";
this.Col_Move.ToolTipText = "移动测试"; this.Col_Move.ToolTipText = "移动测试";
this.Col_Move.UseColumnTextForLinkValue = true; this.Col_Move.UseColumnTextForLinkValue = true;
this.Col_Move.Width = 75;
// //
// FrmBoardInfo // FrmBoardInfo
// //
......
...@@ -243,10 +243,10 @@ namespace URSoldering.Client ...@@ -243,10 +243,10 @@ namespace URSoldering.Client
} }
} }
dgvPoint.Rows.Add(setFPoint(null, "固定点A", updateBoardInfo.APointValue)); dgvPoint.Rows.Add(setFPoint(null, "固定点A(左上角)", updateBoardInfo.APointValue));
dgvPoint.Rows.Add(setFPoint(null, "固定点B", updateBoardInfo.BPointValue)); dgvPoint.Rows.Add(setFPoint(null, "固定点B(左下角)", updateBoardInfo.BPointValue));
dgvPoint.Rows.Add(setFPoint(null, "固定点C", updateBoardInfo.CPointValue)); dgvPoint.Rows.Add(setFPoint(null, "固定点C(右上角)", updateBoardInfo.CPointValue));
dgvPoint.Rows.Add(setFPoint(null, "固定点D", updateBoardInfo.DPointValue)); dgvPoint.Rows.Add(setFPoint(null, "固定点D(右下角)", updateBoardInfo.DPointValue));
} }
private DataGridViewRow setPointInfo(DataGridViewRow view, WeldPointInfo point) private DataGridViewRow setPointInfo(DataGridViewRow view, WeldPointInfo point)
{ {
...@@ -806,10 +806,9 @@ namespace URSoldering.Client ...@@ -806,10 +806,9 @@ namespace URSoldering.Client
{ {
openFileDialog1.Tag = true; openFileDialog1.Tag = true;
picBoard.Image = Image.FromFile(openFileDialog1.FileName); picBoard.Image = Image.FromFile(openFileDialog1.FileName);
if (this.txtBoardWidth.Text.Trim() != "" && this.txtBoardLength.Text.Trim() != "")
{
loadPictureBoxSize(); loadPictureBoxSize();
}
} }
} }
...@@ -817,6 +816,10 @@ namespace URSoldering.Client ...@@ -817,6 +816,10 @@ namespace URSoldering.Client
//private float imageXiShu = 1; //private float imageXiShu = 1;
private void loadPictureBoxSize() private void loadPictureBoxSize()
{ {
if (this.txtBoardWidth.Text.Trim() == "" || this.txtBoardLength.Text.Trim() == "")
{
return;
}
picBoard.SizeMode = PictureBoxSizeMode.StretchImage; picBoard.SizeMode = PictureBoxSizeMode.StretchImage;
int width = 0; int width = 0;
int height = 0; int height = 0;
...@@ -860,28 +863,31 @@ namespace URSoldering.Client ...@@ -860,28 +863,31 @@ namespace URSoldering.Client
int index = 0; int index = 0;
foreach (WeldPointInfo weld in pointList) foreach (WeldPointInfo weld in pointList)
{ {
//float x = (float)Math.Abs(weld.PositionX - orgX) * imageXiShu; int pointHight = 16;
//float y = (float)Math.Abs(weld.PositionY - orgY) * imageXiShu; float x, y;
GetPicPointByUrPoint(weld.GetURPoint(), out x, out y);
//LogUtil.debug("显示焊点:X【" + x + "】Y【" + y + "】,坐标X【" + weld.PositionX + "】坐标Y【" + weld.PositionY + "】"); LogUtil.debug("显示焊点:X【" + x + "】Y【" + y + "】,坐标X【" + weld.RobotX + "】坐标Y【" + weld.RobotY + "】");
//g.FillEllipse(Brushes.Red, x - pointHight / 2, y - pointHight / 2, pointHight, pointHight); g.FillEllipse(Brushes.Red, x - pointHight / 2, y - pointHight / 2, pointHight, pointHight);
//if (index > 0) if (index > 0)
//{ {
// Pen p = new Pen(Color.Red, 2); Pen p = new Pen(Color.Red, 1);
// //中间点 //中间点
// float xCenter = (preX + x) / 2; float xCenter = (preX + x) / 2;
// float yCenter = (preY + y) / 2; float yCenter = (preY + y) / 2;
// System.Drawing.Drawing2D.AdjustableArrowCap lineCap = new System.Drawing.Drawing2D.AdjustableArrowCap(6, 8, true); System.Drawing.Drawing2D.AdjustableArrowCap lineCap = new System.Drawing.Drawing2D.AdjustableArrowCap(6, 8, true);
// Pen RedPen = new Pen(Color.Red, 2); Pen RedPen = new Pen(Color.Red, 1);
// RedPen.CustomEndCap = lineCap; RedPen.CustomEndCap = lineCap;
// grfx.DrawLine(RedPen, preX, preY, xCenter, yCenter); grfx.DrawLine(RedPen, preX, preY, xCenter, yCenter);
// grfx.DrawLine(p, preX, preY, x, y); grfx.DrawLine(p, preX, preY, x, y);
//} }
//preX = x; //写字
//preY = y; g.DrawString(weld.pointName, new Font("Arial ", 8, FontStyle.Regular), Brushes.Red, x - pointHight / 2, y + pointHight / 2+2);
//index++; preX = x;
preY = y;
index++;
} }
grfx.SmoothingMode = SmoothingMode.HighQuality; grfx.SmoothingMode = SmoothingMode.HighQuality;
...@@ -897,11 +903,8 @@ namespace URSoldering.Client ...@@ -897,11 +903,8 @@ namespace URSoldering.Client
private void dgvList_CellValueChanged(object sender, DataGridViewCellEventArgs e) private void dgvList_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{ {
if (this.txtBoardWidth.Text.Trim() != "" && this.txtBoardLength.Text.Trim() != "")
{
loadPictureBoxSize(); loadPictureBoxSize();
} }
}
private void txtOriginX_TextChanged(object sender, EventArgs e) private void txtOriginX_TextChanged(object sender, EventArgs e)
{ {
...@@ -1019,9 +1022,75 @@ namespace URSoldering.Client ...@@ -1019,9 +1022,75 @@ namespace URSoldering.Client
private void 保存焊点ToolStripMenuItem_Click(object sender, EventArgs e) private void 保存焊点ToolStripMenuItem_Click(object sender, EventArgs e)
{ {
if (m_MouseDownPoint == null || m_MouseDownPoint.X == 0 || m_MouseDownPoint.Y == 0)
{
MessageBox.Show("请点击要保存的焊点");
return;
} }
double x = 0;
double y = 0;
URPointValue point = GetUrPointByPicPoint( );
LogUtil.info("新增焊点:X【" + m_MouseDownPoint.X + "】Y【" + m_MouseDownPoint.Y + "】,坐标 【" + point.ToShowStr() + "】 ");
AddNewPoint(point);
liUpdateTime_LinkClicked(null, null);
}
private void GetPicPointByUrPoint(URPointValue point, out float x, out float y)
{
int width = picBoard.Width;
int height = picBoard.Height;
URPointValue APointValue = GetFRowPoint(0);
URPointValue BPointValue = GetFRowPoint(1);
URPointValue CPointValue = GetFRowPoint(2);
URPointValue DPointValue = GetFRowPoint(3);
//判断AD点是否有效
if (APointValue.IsValid() && DPointValue.IsValid())
{
x = (float)((point.X-APointValue.X) * width / (DPointValue.X - APointValue.X));
y = (float)((point.Y-APointValue.Y) * height / (DPointValue.Y - APointValue.Y));
}
else if (BPointValue.IsValid() && CPointValue.IsValid())
{
x = (float)((point.X-BPointValue.X) * width / (CPointValue.X - BPointValue.X));
y = (float)((point.Y-CPointValue.Y) * height / (BPointValue.Y - CPointValue.Y));
}
else
{
x = -1;
y = -1;
}
}
private URPointValue GetUrPointByPicPoint( )
{
URPointValue currPoint = GetCurrRobotPoint();
URPointValue point = new URPointValue(0, 0, currPoint.Z, currPoint.RX, currPoint.RY, currPoint.RZ);
URPointValue APointValue = GetFRowPoint(0);
URPointValue BPointValue = GetFRowPoint(1);
URPointValue CPointValue = GetFRowPoint(2);
URPointValue DPointValue = GetFRowPoint(3);
int width = picBoard.Width;
int height = picBoard.Height;
//判断AD点是否有效
if (APointValue.IsValid() && DPointValue.IsValid())
{
double x = APointValue.X + m_MouseDownPoint.X * (DPointValue.X - APointValue.X) / width;
double y= APointValue.Y+m_MouseDownPoint.Y*(DPointValue.Y - APointValue.Y) / height;
point.X = x;
point.Y = y;
}else if (BPointValue.IsValid() && CPointValue.IsValid())
{
double x =BPointValue.X+ m_MouseDownPoint.X * (CPointValue.X - BPointValue.X) / width;
double y =CPointValue.Y+ m_MouseDownPoint.Y * (BPointValue.Y - CPointValue.Y) / height;
point.X = x;
point.Y = y;
}
return point;
}
private void AddNewPoint(URPointValue robotP) private void AddNewPoint(URPointValue robotP)
{ {
......
...@@ -7,6 +7,8 @@ using System.Drawing; ...@@ -7,6 +7,8 @@ using System.Drawing;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Windows.Forms; using System.Windows.Forms;
using URSoldering.Common;
using System.Drawing.Drawing2D;
namespace URSoldering.Client namespace URSoldering.Client
{ {
...@@ -160,7 +162,32 @@ namespace URSoldering.Client ...@@ -160,7 +162,32 @@ namespace URSoldering.Client
MessageBox.Show("请选择程序!"); MessageBox.Show("请选择程序!");
} }
} }
private void GetPicPointByUrPoint(BoardInfo boardInfo ,URPointValue point, out float x, out float y)
{
int width = picBoard.Width;
int height = picBoard.Height;
URPointValue APointValue = boardInfo.APointValue;
URPointValue BPointValue = boardInfo.BPointValue;
URPointValue CPointValue = boardInfo.CPointValue;
URPointValue DPointValue = boardInfo.DPointValue;
//判断AD点是否有效
if (APointValue.IsValid() && DPointValue.IsValid())
{
x = (float)((point.X-APointValue.X) * width / (DPointValue.X - APointValue.X));
y = (float)((point.Y-APointValue.Y) * height / (DPointValue.Y - APointValue.Y));
}
else if (BPointValue.IsValid() && CPointValue.IsValid())
{
x = (float)((point.X-BPointValue.X) * width / (CPointValue.X - BPointValue.X));
y = (float)((point.Y-CPointValue.Y) * height / (BPointValue.Y - CPointValue.Y));
}
else
{
x = -1;
y = -1;
}
}
private void loadPictureBoxSize(BoardInfo board) private void loadPictureBoxSize(BoardInfo board)
{ {
picBoard.SizeMode = PictureBoxSizeMode.StretchImage; picBoard.SizeMode = PictureBoxSizeMode.StretchImage;
...@@ -194,38 +221,47 @@ namespace URSoldering.Client ...@@ -194,38 +221,47 @@ namespace URSoldering.Client
picBoard.Image = board.GetImage(); picBoard.Image = board.GetImage();
picBoard.Refresh(); picBoard.Refresh();
//int orgType = board.orgType;
//double orgX = board.getImageOrgX();
//double orgY = board.getImageOrgY();
//Graphics grfx = picBoard.CreateGraphics();
//float preX = 0;
//float preY = 0;
//int index = 0;
//foreach (WeldPointInfo weld in pointList)
//{
//float x = (float)Math.Abs(weld.PositionX - orgX) * picBoard.Width / width - pointHight / 2;
//float y = (float)Math.Abs(weld.PositionY - orgY) * picBoard.Width / width - pointHight / 2;
//g.FillEllipse(Brushes.Red, x - pointHight / 2, y - pointHight / 2, pointHight, pointHight);
//if (index > 0)
//{
// Pen p = new Pen(Color.Red, 2);
// //中间点
// float xCenter = (preX + x) / 2;
// float yCenter = (preY + y) / 2;
// System.Drawing.Drawing2D.AdjustableArrowCap lineCap = new System.Drawing.Drawing2D.AdjustableArrowCap(6, 8, true);
// Pen RedPen = new Pen(Color.Red, 2);
// RedPen.CustomEndCap = lineCap;
// grfx.DrawLine(RedPen, preX, preY, xCenter, yCenter); Graphics grfx = picBoard.CreateGraphics();
// grfx.DrawLine(p, preX, preY, x, y); float preX = 0;
//} float preY = 0;
//preX = x; int index = 0;
//preY = y; foreach (WeldPointInfo weld in pointList)
//index++; {
//g.FillEllipse(Brushes.Red, x, y, pointHight, pointHight); int pointHight = 16;
//} float x, y;
GetPicPointByUrPoint(board,weld.GetURPoint(), out x, out y);
LogUtil.debug("显示焊点:X【" + x + "】Y【" + y + "】,坐标X【" + weld.RobotX + "】坐标Y【" + weld.RobotY + "】");
g.FillEllipse(Brushes.Red, x - pointHight / 2, y - pointHight / 2, pointHight, pointHight);
if (index > 0)
{
Pen p = new Pen(Color.Red, 1);
//中间点
float xCenter = (preX + x) / 2;
float yCenter = (preY + y) / 2;
System.Drawing.Drawing2D.AdjustableArrowCap lineCap = new System.Drawing.Drawing2D.AdjustableArrowCap(6, 8, true);
Pen RedPen = new Pen(Color.Red, 1);
RedPen.CustomEndCap = lineCap;
grfx.DrawLine(RedPen, preX, preY, xCenter, yCenter);
grfx.DrawLine(p, preX, preY, x, y);
}
//写字
g.DrawString(weld.pointName, new Font("Arial ", 10, FontStyle.Bold), Brushes.Red, x - pointHight / 2, y + pointHight / 2 + 2);
preX = x;
preY = y;
index++;
}
grfx.SmoothingMode = SmoothingMode.HighQuality;
g.DrawString("A ", new Font("Arial ", 10, FontStyle.Bold), Brushes.White, 3, 3);
g.DrawString("B ", new Font("Arial ", 10, FontStyle.Bold), Brushes.White, 3, picBoard.Height - 20);
g.DrawString("C ", new Font("Arial ", 10, FontStyle.Bold), Brushes.White, picBoard.Width - 18, 0);
g.DrawString("D ", new Font("Arial ", 10, FontStyle.Bold), Brushes.White, picBoard.Width - 18, picBoard.Height - 20);
//g.Dispose(); g.Dispose();
} }
private void FrmBoardList_Shown(object sender, EventArgs e) private void FrmBoardList_Shown(object sender, EventArgs e)
......
...@@ -38,6 +38,9 @@ namespace URSoldering.Client ...@@ -38,6 +38,9 @@ namespace URSoldering.Client
clear1Control.ShowPoint(WeldRobotBean.Clear1Point); clear1Control.ShowPoint(WeldRobotBean.Clear1Point);
homeControl.ShowPoint(WeldRobotBean.HomePoint); homeControl.ShowPoint(WeldRobotBean.HomePoint);
markControl.ShowPoint(WeldRobotBean.MarkPoint); markControl.ShowPoint(WeldRobotBean.MarkPoint);
txtMarkX.Text = WeldRobotBean.MarkImgPosition.DataX.ToString();
txtMarkY.Text = WeldRobotBean.MarkImgPosition.DataY.ToString();
} }
private void saveValue() private void saveValue()
...@@ -132,6 +135,18 @@ namespace URSoldering.Client ...@@ -132,6 +135,18 @@ namespace URSoldering.Client
// return; // return;
//} //}
int x = FormUtil.GetIntValue(txtMarkX);
int y = FormUtil.GetIntValue(txtMarkY);
if (x <= 0 || y <= 0)
{
MessageBox.Show("请输入正确的Mark的图片坐标");
txtMarkX.Focus();
return;
}
WeldRobotBean.MarkImgPosition = new PositionResult(x, y);
ConfigAppSettings.SaveValue(Setting_Init.MarkDefaultPosition, WeldRobotBean.MarkImgPosition.ToJosonStr());
WeldRobotBean.UpdateOrgPoint(homeP); WeldRobotBean.UpdateOrgPoint(homeP);
WeldRobotBean.UpdateClear1Point(clear1P); WeldRobotBean.UpdateClear1Point(clear1P);
WeldRobotBean.UpdateClear2Point(clear2P); WeldRobotBean.UpdateClear2Point(clear2P);
...@@ -150,8 +165,9 @@ namespace URSoldering.Client ...@@ -150,8 +165,9 @@ namespace URSoldering.Client
ConfigAppSettings.SaveValue(Setting_Init.Soldering_RobotMax, maxP.ToJosonStr()); ConfigAppSettings.SaveValue(Setting_Init.Soldering_RobotMax, maxP.ToJosonStr());
URPointValue markPoint = markControl.GetPoint(); URPointValue markPoint = markControl.GetPoint();
WeldRobotBean.MarkPoint = markPoint; WeldRobotBean.UpdateMarkPoint(markPoint);
ConfigAppSettings.SaveValue(Setting_Init.Soldering_MarkPoint, markPoint.ToJosonStr()); //WeldRobotBean.MarkPoint = markPoint;
//ConfigAppSettings.SaveValue(Setting_Init.Soldering_MarkPoint, markPoint.ToJosonStr());
MessageBox.Show("保存成功,需要重启之后才能生效!"); MessageBox.Show("保存成功,需要重启之后才能生效!");
this.Close(); this.Close();
......
...@@ -684,10 +684,7 @@ namespace URSoldering.Client ...@@ -684,10 +684,7 @@ namespace URSoldering.Client
axCKVisionCtrl1.Execute(num); axCKVisionCtrl1.Execute(num);
axCKVisionCtrl1.ZoomView(2); axCKVisionCtrl1.ZoomView(2);
axCKVisionCtrl1.Redraw(); axCKVisionCtrl1.Redraw();
Thread.Sleep(1000);
axCKVisionCtrl1.Execute(num);
axCKVisionCtrl1.ZoomView(2);
axCKVisionCtrl1.Redraw();
return true; return true;
} }
catch (Exception ex) catch (Exception ex)
...@@ -730,29 +727,34 @@ namespace URSoldering.Client ...@@ -730,29 +727,34 @@ namespace URSoldering.Client
} }
} }
private List<PositionResult> RunPositionOffset( ) private List<PositionResult> RunPositionOffset()
{ {
List<PositionResult> pointList = new List<PositionResult>(); List<PositionResult> pointList = new List<PositionResult>();
try try
{ {
this.label1.Text = "视觉坐标偏移"; this.label1.Text = "视觉坐标偏移";
lblCodeResult.Visible = false; lblCodeResult.Visible = false;
RunAOI(0); RunAOI(2);
Thread.Sleep(100); Thread.Sleep(100);
string shaoxi = "坐标偏移" ; string nodeName = ConfigAppSettings.GetValue(Setting_Init.OffSetNodeName);
int result1 = CKResult(shaoxi, 10); if (nodeName.Equals(""))
if (!result1.Equals(1)) {
nodeName = "坐标偏移";
ConfigAppSettings.SaveValue(Setting_Init.OffSetNodeName, nodeName);
}
int result1 = CKResult(nodeName, 10);
if (result1.Equals(1))
{ {
pointList = GetPhotoResult(shaoxi, 100); pointList = GetPhotoResult(nodeName, 100);
} }
string resultList = ""; string resultList = "";
if (pointList.Count <= 0) if (pointList.Count <= 0)
{ {
lblAOIResult.Text = shaoxi + "未识别到焊点"; lblAOIResult.Text = nodeName + "未识别到焊点";
} }
else else
{ {
lblAOIResult.Text = shaoxi + "识别结果:"; lblAOIResult.Text = nodeName + "识别结果:";
foreach (PositionResult result in pointList) foreach (PositionResult result in pointList)
{ {
lblAOIResult.Text += " X:" + result.DataX + ",Y:" + result.DataY + ";"; lblAOIResult.Text += " X:" + result.DataX + ",Y:" + result.DataY + ";";
...@@ -794,8 +796,6 @@ namespace URSoldering.Client ...@@ -794,8 +796,6 @@ namespace URSoldering.Client
for (int i = 0; i < num; i++) for (int i = 0; i < num; i++)
{ {
double x = 0, y = 0; double x = 0, y = 0;
if (name.Equals("少锡"))
{
objValue = new VariantWrapper(value); objValue = new VariantWrapper(value);
if (axCKVisionCtrl1.GetValue(idTool, 102, i, ref objValue) == true) if (axCKVisionCtrl1.GetValue(idTool, 102, i, ref objValue) == true)
{ {
...@@ -808,24 +808,7 @@ namespace URSoldering.Client ...@@ -808,24 +808,7 @@ namespace URSoldering.Client
result = objValue.ToString(); result = objValue.ToString();
y = Convert.ToDouble(result); y = Convert.ToDouble(result);
} }
aOIDataResults.Add(new PositionResult(x, y, 1, point)); aOIDataResults.Add(new PositionResult(x, y));
}
else
{
objValue = new VariantWrapper(value);
if (axCKVisionCtrl1.GetValue(idTool, 103, i, ref objValue) == true)
{
result = objValue.ToString();
x = Convert.ToDouble(result);
}
objValue = new VariantWrapper(value);
if (axCKVisionCtrl1.GetValue(idTool, 104, i, ref objValue) == true)
{
result = objValue.ToString();
y = Convert.ToDouble(result);
}
aOIDataResults.Add(new PositionResult(x, y, 2, point));
}
} }
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -37,16 +37,22 @@ AOI检测NG时,红灯亮,等到下次开始焊接时清理红灯。 ...@@ -37,16 +37,22 @@ AOI检测NG时,红灯亮,等到下次开始焊接时清理红灯。
20181022 20181022
需要修改内容: 需要修改内容:
坐标偏移功能
1.增加一个整体的mark点,保存机械臂坐标
2.每个电路板需要配置拍照点
3.流程修改:焊接之前,先去拍照点,拍照识别,取出坐标后进行整体坐标偏移,然后再焊接。
AOI程序修改:分支1是左边偏移功能。分支2是AOI检测功能。
图片上自动编程功能:
图片上要显示四个点:ABCD
需要配置AC点或者BD点作为固定点
点击图片,直接增加焊点,可以自动算出XY坐标
坐标偏移功能
1.增加一个整体的mark点,需要配置 机械臂坐标 和 图片对应坐标,偏移时根据此Mark点的图片坐标对机械臂坐标进行偏移。
2.每个程序需要配置一个拍照点 , 焊接之前,先去拍照点,拍照识别Mark点,取出坐标后进行坐标偏移,然后再根据偏移后的坐标进行焊接。
3.AOI程序需要修改:分支2是坐标偏移功能。分支1是AOI检测功能。
自动编程功能:
1.程序编辑界面:每个程序都要配置AC点或者BD点作为固定点,也可以四个固定点都配置。
2.增加焊点时,点击图片对应位置新增焊点 ,会自动算出新焊点XY的坐标
20181126增加配置
更新程序后需要在URSolderingClient.exe.config增加配置:
<!--坐标偏移Mark点的图像默认坐标-->
<add key="MarkDefaultPosition" value="{&quot;DataX&quot;:0.0,&quot;DataY&quot;:0.0}" />
<!--坐标偏移坐标转换系数,图片的1像素对应实际多少毫米-->
<add key="PositionChangeValue" value="1" />
<!--坐标偏移AOI检测的分支名称-->
<add key="OffSetNodeName" value="坐标偏移"/>
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!