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)
......
...@@ -8,6 +8,10 @@ namespace URSoldering.DeviceLibrary ...@@ -8,6 +8,10 @@ namespace URSoldering.DeviceLibrary
{ {
partial class WeldRobotBean partial class WeldRobotBean
{ {
public static PositionResult MarkImgPosition = new PositionResult(0, 0);
public static double MarkChangeValue = 1;
public static bool OffSetEnd = true;
public static bool AOIEnd = true;
public static bool IsInWeld=false; public static bool IsInWeld=false;
public static bool LastAOIResult = true; public static bool LastAOIResult = true;
//public delegate void GetCode(); //public delegate void GetCode();
...@@ -115,8 +119,16 @@ namespace URSoldering.DeviceLibrary ...@@ -115,8 +119,16 @@ namespace URSoldering.DeviceLibrary
} }
else if (WeldMoveStep.moveStep.Equals(MoveStep.W31_WaitToPositionOffset)) else if (WeldMoveStep.moveStep.Equals(MoveStep.W31_WaitToPositionOffset))
{ {
WeldMoveStep.NextMoveStep(MoveStep.W32_PositionOffsetEnd);
OffSetEnd = false;
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTime(3000));
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitOffSet());
WeldMoveStep.OneWaitOk = true;
PositionOffProcess(); PositionOffProcess();
PointEndPross();
}else if (WeldMoveStep.moveStep.Equals(MoveStep.W32_PositionOffsetEnd))
{
PointEndPross();
} }
else if (WeldMoveStep.moveStep.Equals(MoveStep.W03_SlowSendWire)) else if (WeldMoveStep.moveStep.Equals(MoveStep.W03_SlowSendWire))
{ {
...@@ -148,10 +160,10 @@ namespace URSoldering.DeviceLibrary ...@@ -148,10 +160,10 @@ namespace URSoldering.DeviceLibrary
else if (WeldMoveStep.moveStep.Equals(MoveStep.W12_ToClear2)) else if (WeldMoveStep.moveStep.Equals(MoveStep.W12_ToClear2))
{ {
KeepTemp(); KeepTemp();
WeldMoveStep.NextMoveStep(MoveStep.W15_ClearEnd); WeldMoveStep.NextMoveStep(MoveStep.W16_ClearEnd);
MoveToOrg(); MoveToOrg();
} }
else if (WeldMoveStep.moveStep.Equals(MoveStep.W15_ClearEnd)) else if (WeldMoveStep.moveStep.Equals(MoveStep.W16_ClearEnd))
{ {
WeldEnd(); WeldEnd();
} }
...@@ -186,10 +198,18 @@ namespace URSoldering.DeviceLibrary ...@@ -186,10 +198,18 @@ namespace URSoldering.DeviceLibrary
} }
else if (WeldMoveStep.moveStep.Equals(MoveStep.W14_AOICheck)) else if (WeldMoveStep.moveStep.Equals(MoveStep.W14_AOICheck))
{ {
WeldMoveStep.NextMoveStep(MoveStep.W15_AOIEnd);
AOIEnd = false;
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTime(3000));
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitAoiEnd());
WeldMoveStep.OneWaitOk = true;
bool result = LastAOIResult = AOICheckFun.Invoke(); bool result = LastAOIResult = AOICheckFun.Invoke();
WeldLog("AOI检测结果:" + result); WeldLog("AOI检测结果:" + result);
Thread.Sleep(300);
IsInWeld = false; IsInWeld = false;
AOIEnd = true;
}else if (WeldMoveStep.moveStep.Equals(MoveStep.W15_AOIEnd))
{
if (WeldCount >= RobotConfig.ClearCount) if (WeldCount >= RobotConfig.ClearCount)
{ {
WeldLog("已经连续焊" + WeldCount + "块板子,清洗烙铁"); WeldLog("已经连续焊" + WeldCount + "块板子,清洗烙铁");
...@@ -214,64 +234,104 @@ namespace URSoldering.DeviceLibrary ...@@ -214,64 +234,104 @@ namespace URSoldering.DeviceLibrary
else else
{ {
SetPreTemp(true, false); SetPreTemp(true, false);
} }
// 0=普通焊点,必须要焊接
if (WeldMoveStep.CurrPoint.pointType.Equals(0)) if (WeldMoveStep.CurrPoint.pointType.Equals(0))
{ {
if (ZUpLiftValue>0) if (ZUpLiftValue>0)
{ {
//普通焊点先移动至高位 //普通焊点先移动至高位
WeldMoveStep.NextMoveStep(MoveStep.W01_RobotToHighPoint); WeldMoveStep.NextMoveStep(MoveStep.W01_RobotToHighPoint);
LogUtil.info(" 新" + pointName + "移动至焊点高处"); WeldLog(" 新焊点 移动至焊点高处");
MoveToHighPoint(WeldMoveStep.CurrPoint); MoveToHighPoint(WeldMoveStep.CurrPoint);
} }
else else
{ {
LogUtil.info(" 新" + pointName + "预热" + WeldMoveStep.CurrPoint.preheatTemperature + "度,送丝下降,移动机械臂"); WeldLog(" 新焊点 预热" + WeldMoveStep.CurrPoint.preheatTemperature + "度,送丝下降,移动机械臂");
MoveToPoint(WeldMoveStep.CurrPoint); MoveToPoint(WeldMoveStep.CurrPoint);
WeldMoveStep.IsSlowSendWire = true; WeldMoveStep.IsSlowSendWire = true;
SlowSendWire(); SlowSendWire();
} }
WorkCountManager.AddWeldPint(); WorkCountManager.AddWeldPint();
} }
// 2=拖焊焊点
else if (WeldMoveStep.CurrPoint.pointType.Equals(2)) else if (WeldMoveStep.CurrPoint.pointType.Equals(2))
{ {
LogUtil.info(" 新" + pointName + "预热" + WeldMoveStep.CurrPoint.preheatTemperature + "度,送丝下降,移动机械臂"); LogUtil.info(" 新焊点 预热" + WeldMoveStep.CurrPoint.preheatTemperature + "度,送丝下降,移动机械臂");
MoveToPoint(WeldMoveStep.CurrPoint ); MoveToPoint(WeldMoveStep.CurrPoint );
WorkCountManager.AddWeldPint(); WorkCountManager.AddWeldPint();
WeldMoveStep.IsSlowSendWire = true; WeldMoveStep.IsSlowSendWire = true;
SlowSendWire(); SlowSendWire();
} }
else if(WeldMoveStep.CurrPoint.pointType.Equals(1)) // 1=中间点,机器人跳转位置使用
else if (WeldMoveStep.CurrPoint.pointType.Equals(1))
{ {
//拖焊点 //拖焊点
LogUtil.info(" 新" + pointName + " 移动机械臂"); LogUtil.info(" 新焊点 移动机械臂");
MoveToPoint(WeldMoveStep.CurrPoint ); MoveToPoint(WeldMoveStep.CurrPoint );
}else if (WeldMoveStep.CurrPoint.pointType.Equals(3)) }
// 3=拍照点,实现坐标偏移功能
else if (WeldMoveStep.CurrPoint.pointType.Equals(3))
{ {
//拍照点 //拍照点
MoveToPoint(WeldMoveStep.CurrPoint); MoveToPoint(WeldMoveStep.CurrPoint);
} }
else else
{ {
LogUtil.info(" 新" + pointName + " 未知焊点类型,跳过直接下一个焊点"); LogUtil.info(" 新焊点 未知焊点类型,跳过直接下一个焊点");
PointEndPross(); PointEndPross();
} }
} }
private static void LoadMarkInfo()
{
string defStr = ConfigAppSettings.GetValue(Setting_Init.MarkDefaultPosition);
if (defStr.Equals(""))
{
ConfigAppSettings.SaveValue(Setting_Init.MarkDefaultPosition, MarkImgPosition.ToJosonStr());
}
else
{
MarkImgPosition = PositionResult.ToObject(defStr);
}
MarkChangeValue = (double)ConfigAppSettings.GetNumValue(Setting_Init.PositionChangeValue);
if (MarkChangeValue <= 0)
{
MarkChangeValue = 1;
ConfigAppSettings.SaveValue(Setting_Init.PositionChangeValue, MarkChangeValue.ToString());
}
LogUtil.info("加载坐标偏移Mark点【"+ MarkImgPosition.ToJosonStr()+"】转换系数【"+MarkChangeValue+"】");
}
/// <summary> /// <summary>
/// 坐标偏移处理 /// 坐标偏移处理
/// </summary> /// </summary>
private static void PositionOffProcess() private static void PositionOffProcess()
{ {
List<PositionResult> result= PositionOffsetFun?.Invoke(); List<PositionResult> result = PositionOffsetFun?.Invoke();
if (result.Count > 0) if (result.Count > 0)
{ {
//TODO 坐标偏移 //TODO 坐标偏移
if (result.Count > 0)
{
double x = 0;
double y = 0;
PositionResult pianyiPosition = result[0];
x = (pianyiPosition.DataX - MarkImgPosition.DataX) * MarkChangeValue;
y = (pianyiPosition.DataY - MarkImgPosition.DataY) * MarkChangeValue;
WeldLog("找到偏移点,开始进行偏移 X【" + y + "】Y【" + y + "】");
WeldMoveStep.PositionOffSet(x, y);
}
} }
else else
{ {
WeldLog("未找到偏移点"); WeldLog("未找到偏移点,不需要进行偏移");
} }
OffSetEnd = true;
} }
private static void PointEndPross() private static void PointEndPross()
{ {
...@@ -461,12 +521,19 @@ namespace URSoldering.DeviceLibrary ...@@ -461,12 +521,19 @@ namespace URSoldering.DeviceLibrary
string NotOkMsg = ""; string NotOkMsg = "";
if (list.Count > 0) if (list.Count > 0)
{ {
bool isOk = true; bool isOk = !WeldMoveStep.OneWaitOk;
foreach (WaitResultInfo wait in list) foreach (WaitResultInfo wait in list)
{ {
if (wait.IsEnd)
{
continue;
}
NotOkMsg = wait.ToStr();
if (wait.WaitType == 1) if (wait.WaitType == 1)
{ {
if (!RobotBean.KNDIOValue(wait.IoType).Equals(wait.IoValue)) wait.IsEnd = RobotBean.KNDIOValue(wait.IoType).Equals(wait.IoValue);
if (!wait.IsEnd)
{ {
//一分钟还未检测到 //一分钟还未检测到
if (span.TotalMilliseconds > ioSingleTimeOutSeconds) if (span.TotalMilliseconds > ioSingleTimeOutSeconds)
...@@ -477,71 +544,23 @@ namespace URSoldering.DeviceLibrary ...@@ -477,71 +544,23 @@ namespace URSoldering.DeviceLibrary
Alarm(AlarmType.IoSingleTimeOut); Alarm(AlarmType.IoSingleTimeOut);
LogUtil.error(LOGGER, WarnMsg, 13); LogUtil.error(LOGGER, WarnMsg, 13);
} }
isOk = false;
break;
}
else if (WeldMoveStep.OneWaitOk)
{
isOk = true;
break;
} }
} }
else if (wait.WaitType == 2) else if (wait.WaitType == 2)
{ {
if (span.TotalMilliseconds < wait.TimeMSeconds) wait.IsEnd = (span.TotalMilliseconds > wait.TimeMSeconds);
{
NotOkMsg = "时间[" + wait.TimeMSeconds + "]毫秒";
isOk = false;
break;
}
else if (WeldMoveStep.OneWaitOk)
{
isOk = true;
break;
}
} }
else if (wait.WaitType == 3) else if (wait.WaitType == 3)
{ {
if (URRobotControl.MoveOK(wait.UrPoint, WeldMoveStep.LastSetpTime).Equals(false)) wait.IsEnd = URRobotControl.MoveOK(wait.UrPoint, WeldMoveStep.LastSetpTime);
{
NotOkMsg = "机械臂移动到位"+wait.UrPoint.ToShowStr();
isOk = false;
break;
}
else if (WeldMoveStep.OneWaitOk)
{
isOk = true;
break;
}
} }
else if (wait.WaitType == 4) else if (wait.WaitType == 4)
{ {
if (!wait.IsEnd) if (!HasSoldering)
{ {
if (HasSoldering) wait.IsEnd = true; continue;
{
int temp = SolderingManager.queryActualTemp();
if (wait.Temperature != temp && (temp < wait.TemperatureMin || temp > wait.TemperatureMax))
{
NotOkMsg = "烙铁温度[" + wait.Temperature + "]";
isOk = false;
break;
}
else
{
if (WeldMoveStep.OneWaitOk)
{
isOk = true;
break;
}
else
{
wait.IsEnd = true;
}
}
}
wait.IsEnd = true;
} }
wait.IsEnd = SolderingManager.IsRightTemp(wait.Temperature, wait.TemperatureMin, wait.TemperatureMax);
} }
else if (wait.WaitType == 5) else if (wait.WaitType == 5)
{ {
...@@ -553,14 +572,13 @@ namespace URSoldering.DeviceLibrary ...@@ -553,14 +572,13 @@ namespace URSoldering.DeviceLibrary
isAlarm = SendWireManager.IsAlarm(); isAlarm = SendWireManager.IsAlarm();
preCheckSendWireTime = DateTime.Now; preCheckSendWireTime = DateTime.Now;
if (isAlarm) if (isAlarm)
{ {
SendWireManager.StopSend(); SendWireManager.StopSend();
WeldMoveStep.ResetCount++; WeldMoveStep.ResetCount++;
SendWireManager.Reset(); SendWireManager.Reset();
//反向送丝 //反向送丝
int speed = ConfigAppSettings.GetIntValue(Setting_Init.ReverseSendWireSpeed) ; int speed = ConfigAppSettings.GetIntValue(Setting_Init.ReverseSendWireSpeed);
double time = (double)ConfigAppSettings.GetNumValue(Setting_Init.ReverseSendWireTime); double time = (double)ConfigAppSettings.GetNumValue(Setting_Init.ReverseSendWireTime);
if (speed.Equals(0) || time <= 0) if (speed.Equals(0) || time <= 0)
{ {
...@@ -584,25 +602,14 @@ namespace URSoldering.DeviceLibrary ...@@ -584,25 +602,14 @@ namespace URSoldering.DeviceLibrary
if (wait.ShuoKeISReverse.Equals(false) && isAlarm.Equals(false)) if (wait.ShuoKeISReverse.Equals(false) && isAlarm.Equals(false))
{ {
if (span.TotalMilliseconds < wait.TimeMSeconds) wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
{
NotOkMsg = "送丝时间[" + wait.TimeMSeconds + "]毫秒";
isOk = false;
break;
}
else if (WeldMoveStep.OneWaitOk)
{
isOk = true;
break;
}
} }
else if (wait.ShuoKeISReverse.Equals(true) && isAlarm.Equals(false)) else if (wait.ShuoKeISReverse.Equals(true) && isAlarm.Equals(false))
{ {
if (span.TotalMilliseconds < wait.TimeMSeconds) wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
if (!wait.IsEnd)
{ {
NotOkMsg = "送丝时间[" + wait.TimeMSeconds + "]毫秒"; NotOkMsg = "反转送丝时间[" + wait.TimeMSeconds + "]毫秒";
isOk = false;
break;
} }
else else
{ {
...@@ -615,17 +622,26 @@ namespace URSoldering.DeviceLibrary ...@@ -615,17 +622,26 @@ namespace URSoldering.DeviceLibrary
} }
else if (wait.WaitType == 6) else if (wait.WaitType == 6)
{ {
if (!URRobotControl.IsRun) wait.IsEnd = URRobotControl.IsRun;
{ }
NotOkMsg = "机器人连接"; else if (wait.WaitType == 7)
isOk = false; {
break; wait.IsEnd = OffSetEnd;
} }
else if (WeldMoveStep.OneWaitOk) else if (wait.WaitType == 8)
{ {
isOk = true; wait.IsEnd = AOIEnd;
break; }
}
if (wait.IsEnd && WeldMoveStep.OneWaitOk)
{
isOk = true;
break;
}
else if (wait.IsEnd.Equals(false) && WeldMoveStep.OneWaitOk.Equals(false))
{
isOk = false;
break;
} }
} }
if (isOk) if (isOk)
...@@ -647,12 +663,12 @@ namespace URSoldering.DeviceLibrary ...@@ -647,12 +663,12 @@ namespace URSoldering.DeviceLibrary
else else
{ {
WarnMsg = "等待超时[" + WeldMoveStep.moveType + "][" + WeldMoveStep.moveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalMinutes, 1) + "]分钟"; WarnMsg = "等待超时[" + WeldMoveStep.moveType + "][" + WeldMoveStep.moveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalMinutes, 1) + "]分钟";
} }
Alarm(AlarmType.StepTimeOut); Alarm(AlarmType.StepTimeOut);
LogUtil.error(LOGGER, WarnMsg, 12); LogUtil.error(LOGGER, WarnMsg, 12);
//Alarm(StoreAlarmType.IoSingleTimeOut); //Alarm(StoreAlarmType.IoSingleTimeOut);
} }
else if (span.TotalSeconds > 5 && WeldMoveStep.moveType.Equals(MoveType.Weld)) else if (span.TotalSeconds > 5 && WeldMoveStep.moveType.Equals(MoveType.Weld))
{ {
LogUtil.info("焊接[" + WeldMoveStep.moveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒"); LogUtil.info("焊接[" + WeldMoveStep.moveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒");
} }
...@@ -664,13 +680,233 @@ namespace URSoldering.DeviceLibrary ...@@ -664,13 +680,233 @@ namespace URSoldering.DeviceLibrary
} }
} }
//private static void CheckWait()
//{
// int ioSingleTimeOutSeconds = 10000;
// List<WaitResultInfo> list = new List<WaitResultInfo>(WeldMoveStep.WaitList);
// //当等待超过一分钟时,需要打印提示
// TimeSpan span = DateTime.Now - WeldMoveStep.LastSetpTime;
// string NotOkMsg = "";
// if (list.Count > 0)
// {
// bool isOk = true;
// foreach (WaitResultInfo wait in list)
// {
// if (wait.WaitType == 1)
// {
// if (!RobotBean.KNDIOValue(wait.IoType).Equals(wait.IoValue))
// {
// //一分钟还未检测到
// if (span.TotalMilliseconds > ioSingleTimeOutSeconds)
// {
// ConfigIO io = RobotBean.getWaitIO(wait.IoType);
// NotOkMsg = "信号(" + io.Explain + "=" + wait.IoValue + ")";
// WarnMsg = RobotName + " 等待信号(" + io.Explain + "=" + wait.IoValue + ") 超时!";
// Alarm(AlarmType.IoSingleTimeOut);
// LogUtil.error(LOGGER, WarnMsg, 13);
// }
// isOk = false;
// break;
// }
// else if (WeldMoveStep.OneWaitOk)
// {
// isOk = true;
// break;
// }
// }
// else if (wait.WaitType == 2)
// {
// if (span.TotalMilliseconds < wait.TimeMSeconds)
// {
// NotOkMsg = "时间[" + wait.TimeMSeconds + "]毫秒";
// isOk = false;
// break;
// }
// else if (WeldMoveStep.OneWaitOk)
// {
// isOk = true;
// break;
// }
// }
// else if (wait.WaitType == 3)
// {
// if (URRobotControl.MoveOK(wait.UrPoint, WeldMoveStep.LastSetpTime).Equals(false))
// {
// NotOkMsg = "机械臂移动到位" + wait.UrPoint.ToShowStr();
// isOk = false;
// break;
// }
// else if (WeldMoveStep.OneWaitOk)
// {
// isOk = true;
// break;
// }
// }
// else if (wait.WaitType == 4)
// {
// if (!wait.IsEnd)
// {
// if (HasSoldering)
// {
// int temp = SolderingManager.queryActualTemp();
// if (wait.Temperature != temp && (temp < wait.TemperatureMin || temp > wait.TemperatureMax))
// {
// NotOkMsg = "烙铁温度[" + wait.Temperature + "]";
// isOk = false;
// break;
// }
// else
// {
// if (WeldMoveStep.OneWaitOk)
// {
// isOk = true;
// break;
// }
// else
// {
// wait.IsEnd = true;
// }
// }
// }
// wait.IsEnd = true;
// }
// }
// else if (wait.WaitType == 5)
// {
// bool isAlarm = false;
// if (RobotManager.SolderingRobot.IsDebug.Equals(false))
// {
// if (WeldMoveStep.ResetCount < 3)
// {
// isAlarm = SendWireManager.IsAlarm();
// preCheckSendWireTime = DateTime.Now;
// if (isAlarm)
// {
// SendWireManager.StopSend();
// WeldMoveStep.ResetCount++;
// SendWireManager.Reset();
// //反向送丝
// int speed = ConfigAppSettings.GetIntValue(Setting_Init.ReverseSendWireSpeed);
// double time = (double)ConfigAppSettings.GetNumValue(Setting_Init.ReverseSendWireTime);
// if (speed.Equals(0) || time <= 0)
// {
// isAlarm = false;
// LogUtil.error("焊接中第【" + WeldMoveStep.ResetCount + "】次 检测到送丝器报警, 速度【" + speed + "】时间【" + time + "】配置不完整,不反转处理");
// }
// else
// {
// LogUtil.error("焊接中第【" + WeldMoveStep.ResetCount + "】次 检测到送丝器报警, 开始反向送丝,速度【" + speed + "】时间【" + time + "】");
// WeldMoveStep.LastSetpTime = DateTime.Now;
// WeldMoveStep.WaitList.Clear();
// SendWireManager.SendWireBack(time, speed);
// int ms = (int)((time * 1000) + 100);
// WeldMoveStep.WaitList.Add(WaitResultInfo.WaitSendWire(ms, true));
// isOk = false;
// }
// }
// }
// }
// if (wait.ShuoKeISReverse.Equals(false) && isAlarm.Equals(false))
// {
// if (span.TotalMilliseconds < wait.TimeMSeconds)
// {
// NotOkMsg = "送丝时间[" + wait.TimeMSeconds + "]毫秒";
// isOk = false;
// break;
// }
// else if (WeldMoveStep.OneWaitOk)
// {
// isOk = true;
// break;
// }
// }
// else if (wait.ShuoKeISReverse.Equals(true) && isAlarm.Equals(false))
// {
// if (span.TotalMilliseconds < wait.TimeMSeconds)
// {
// NotOkMsg = "送丝时间[" + wait.TimeMSeconds + "]毫秒";
// isOk = false;
// break;
// }
// else
// {
// //反转已经停止,直接重新运行次步骤
// //MoveStep step = (MoveStep)((int)WeldMoveStep.moveStep - 1);
// LogUtil.info(RobotName + " 送丝反转结束,重新开始当前焊点焊接");
// WeldMoveStep.NextMoveStep(MoveStep.Wait);
// }
// }
// }
// else if (wait.WaitType == 6)
// {
// if (!URRobotControl.IsRun)
// {
// NotOkMsg = "机器人连接";
// isOk = false;
// break;
// }
// else if (WeldMoveStep.OneWaitOk)
// {
// isOk = true;
// break;
// }
// }
// else if (wait.WaitType == 7)
// {
// wait.IsEnd = OffSetEnd;
// }
// else if (wait.WaitType == 8)
// {
// wait.IsEnd = AOIEnd;
// }
// }
// if (isOk)
// {
// WeldMoveStep.EndStepWait();
// }
// if (WeldMoveStep.IsInWait)
// {
// if (span.TotalMinutes > 1)
// {
// if (NotOkMsg.Equals(""))
// {
// WarnMsg = "等待超时[" + WeldMoveStep.moveType + "][" + WeldMoveStep.moveStep + "]已等待[" + Math.Round(span.TotalMinutes, 1) + "]分钟,";
// foreach (WaitResultInfo wait in list)
// {
// WarnMsg = WarnMsg + "\r\n" + wait.ToStr();
// }
// }
// else
// {
// WarnMsg = "等待超时[" + WeldMoveStep.moveType + "][" + WeldMoveStep.moveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalMinutes, 1) + "]分钟";
// }
// Alarm(AlarmType.StepTimeOut);
// LogUtil.error(LOGGER, WarnMsg, 12);
// //Alarm(StoreAlarmType.IoSingleTimeOut);
// }
// else if (span.TotalSeconds > 5 && WeldMoveStep.moveType.Equals(MoveType.Weld))
// {
// LogUtil.info("焊接[" + WeldMoveStep.moveStep + "][" + NotOkMsg + "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒");
// }
// }
// }
// else
// {
// WeldMoveStep.EndStepWait();
// }
//}
private static void WeldLog(string str) private static void WeldLog(string str)
{ {
if (WeldMoveStep.moveType.Equals(MoveType.Weld)) if (WeldMoveStep.moveType.Equals(MoveType.Weld))
{ {
if (WeldMoveStep.CurrPoint != null) if (WeldMoveStep.CurrPoint != null)
{ {
LogUtil.info("焊点"+WeldMoveStep.CurrPoint.TypeValue + "【" + WeldMoveStep.CurrPoint.pointName + "】" + str); LogUtil.info( WeldMoveStep.CurrPoint.TypeValue + "【" + WeldMoveStep.CurrPoint.pointName + "】" + str);
} }
else else
{ {
......
...@@ -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 {
//{ if (!URRobotControl.PointIsValid(p.GetURPoint()))
// weldPointList = (from m in board.pointList where m.pointType.Equals(pointType) && m.pointType.Equals(0) select m).ToList<WeldPointInfo>(); {
//} LogUtil.error("【" + board.boardName + "】的焊点【" + p.pointName + "】坐标无效,无法开始焊接");
return false;
}
if (p.pointType.Equals(3))
{
photoPoint = p;
}
else
{
weldPointList.Add(p);
}
}
if (weldPointList.Count <= 0) if (weldPointList.Count <= 0)
{ {
return false; return false;
} }
foreach(WeldPointInfo p in weldPointList) if (photoPoint != null)
{ {
if (!URRobotControl.PointIsValid(p.GetURPoint())) weldPointList.Add(photoPoint);
{
LogUtil.error("【"+ board .boardName+ "】的焊点【"+p.pointName+"】坐标无效,无法开始焊接");
return false;
}
} }
//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);
}
} }
} }
...@@ -195,13 +195,20 @@ namespace URSoldering.DeviceLibrary ...@@ -195,13 +195,20 @@ namespace URSoldering.DeviceLibrary
bool isOk = false; bool isOk = false;
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)
{ {
throw new NotImplementedException(); int temp = SolderingManager.queryActualTemp();
if (temperature != temp && (temp < minTemp))
//if (wait.Temperature != temp && (temp < wait.TemperatureMin || temp > wait.TemperatureMax))
{
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";
} }
}
...@@ -55,7 +55,13 @@ ...@@ -55,7 +55,13 @@
<add key="Soldering_RobotMin" 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_RobotMin" 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_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;
...@@ -894,13 +900,10 @@ namespace URSoldering.Client ...@@ -894,13 +900,10 @@ namespace URSoldering.Client
g.Dispose(); g.Dispose();
//picBoard.Refresh(); //picBoard.Refresh();
} }
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)
...@@ -1018,10 +1021,76 @@ namespace URSoldering.Client ...@@ -1018,10 +1021,76 @@ 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(); Graphics grfx = picBoard.CreateGraphics();
//double orgY = board.getImageOrgY(); float preX = 0;
//Graphics grfx = picBoard.CreateGraphics(); float preY = 0;
//float preX = 0; int index = 0;
//float preY = 0; foreach (WeldPointInfo weld in pointList)
//int index = 0; {
//foreach (WeldPointInfo weld in pointList) int pointHight = 16;
//{ float x, y;
//float x = (float)Math.Abs(weld.PositionX - orgX) * picBoard.Width / width - pointHight / 2; GetPicPointByUrPoint(board,weld.GetURPoint(), out x, out y);
//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); LogUtil.debug("显示焊点:X【" + x + "】Y【" + y + "】,坐标X【" + weld.RobotX + "】坐标Y【" + weld.RobotY + "】");
//if (index > 0) g.FillEllipse(Brushes.Red, x - pointHight / 2, y - pointHight / 2, pointHight, pointHight);
//{ if (index > 0)
// Pen p = new Pen(Color.Red, 2); {
// //中间点 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); float xCenter = (preX + x) / 2;
// Pen RedPen = new Pen(Color.Red, 2); float yCenter = (preY + y) / 2;
// RedPen.CustomEndCap = lineCap; 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.DrawLine(RedPen, preX, preY, xCenter, yCenter); grfx.SmoothingMode = SmoothingMode.HighQuality;
// grfx.DrawLine(p, preX, preY, x, y); 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);
//preX = x; g.DrawString("C ", new Font("Arial ", 10, FontStyle.Bold), Brushes.White, picBoard.Width - 18, 0);
//preY = y; g.DrawString("D ", new Font("Arial ", 10, FontStyle.Bold), Brushes.White, picBoard.Width - 18, picBoard.Height - 20);
//index++;
//g.FillEllipse(Brushes.Red, x, y, pointHight, pointHight);
//}
//g.Dispose(); g.Dispose();
} }
private void FrmBoardList_Shown(object sender, EventArgs e) private void FrmBoardList_Shown(object sender, EventArgs e)
......
...@@ -51,6 +51,11 @@ ...@@ -51,6 +51,11 @@
this.minControl = new UserFromControl.URRobotMControl(); this.minControl = new UserFromControl.URRobotMControl();
this.groupBox6 = new System.Windows.Forms.GroupBox(); this.groupBox6 = new System.Windows.Forms.GroupBox();
this.markControl = new UserFromControl.URRobotMControl(); this.markControl = new UserFromControl.URRobotMControl();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.txtMarkX = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.txtMarkY = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.groupBox4.SuspendLayout(); this.groupBox4.SuspendLayout();
...@@ -58,44 +63,45 @@ ...@@ -58,44 +63,45 @@
this.gbEpsonSetting.SuspendLayout(); this.gbEpsonSetting.SuspendLayout();
this.groupBox5.SuspendLayout(); this.groupBox5.SuspendLayout();
this.groupBox6.SuspendLayout(); this.groupBox6.SuspendLayout();
this.groupBox7.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox3 // groupBox3
// //
this.groupBox3.Controls.Add(this.clear2Control); this.groupBox3.Controls.Add(this.clear2Control);
this.groupBox3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox3.Location = new System.Drawing.Point(447, 12); this.groupBox3.Location = new System.Drawing.Point(387, 12);
this.groupBox3.Name = "groupBox3"; this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(197, 265); this.groupBox3.Size = new System.Drawing.Size(177, 255);
this.groupBox3.TabIndex = 40; this.groupBox3.TabIndex = 40;
this.groupBox3.TabStop = false; this.groupBox3.TabStop = false;
this.groupBox3.Text = "焊接清洗点2配置"; this.groupBox3.Text = "焊接清洗点2配置";
// //
// clear2Control // clear2Control
// //
this.clear2Control.Location = new System.Drawing.Point(24, 20); this.clear2Control.Location = new System.Drawing.Point(6, 20);
this.clear2Control.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.clear2Control.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.clear2Control.Name = "clear2Control"; this.clear2Control.Name = "clear2Control";
this.clear2Control.Size = new System.Drawing.Size(168, 236); this.clear2Control.Size = new System.Drawing.Size(162, 227);
this.clear2Control.TabIndex = 2; this.clear2Control.TabIndex = 2;
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.clear1Control); this.groupBox2.Controls.Add(this.clear1Control);
this.groupBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox2.Location = new System.Drawing.Point(234, 12); this.groupBox2.Location = new System.Drawing.Point(204, 12);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(197, 265); this.groupBox2.Size = new System.Drawing.Size(177, 255);
this.groupBox2.TabIndex = 12; this.groupBox2.TabIndex = 12;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "焊接清洗点1配置"; this.groupBox2.Text = "焊接清洗点1配置";
// //
// clear1Control // clear1Control
// //
this.clear1Control.Location = new System.Drawing.Point(7, 23); this.clear1Control.Location = new System.Drawing.Point(6, 20);
this.clear1Control.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.clear1Control.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.clear1Control.Name = "clear1Control"; this.clear1Control.Name = "clear1Control";
this.clear1Control.Size = new System.Drawing.Size(168, 236); this.clear1Control.Size = new System.Drawing.Size(162, 227);
this.clear1Control.TabIndex = 0; this.clear1Control.TabIndex = 0;
// //
// groupBox4 // groupBox4
...@@ -107,9 +113,9 @@ ...@@ -107,9 +113,9 @@
this.groupBox4.Controls.Add(this.lblWirdFeedingTime); this.groupBox4.Controls.Add(this.lblWirdFeedingTime);
this.groupBox4.Controls.Add(this.txtsendWireTime); this.groupBox4.Controls.Add(this.txtsendWireTime);
this.groupBox4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox4.Location = new System.Drawing.Point(440, 282); this.groupBox4.Location = new System.Drawing.Point(387, 343);
this.groupBox4.Name = "groupBox4"; this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(276, 118); this.groupBox4.Size = new System.Drawing.Size(360, 107);
this.groupBox4.TabIndex = 11; this.groupBox4.TabIndex = 11;
this.groupBox4.TabStop = false; this.groupBox4.TabStop = false;
this.groupBox4.Text = "卡丝时反转配置"; this.groupBox4.Text = "卡丝时反转配置";
...@@ -117,7 +123,7 @@ ...@@ -117,7 +123,7 @@
// label17 // label17
// //
this.label17.AutoSize = true; this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(220, 38); this.label17.Location = new System.Drawing.Point(220, 35);
this.label17.Name = "label17"; this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(30, 17); this.label17.Size = new System.Drawing.Size(30, 17);
this.label17.TabIndex = 64; this.label17.TabIndex = 64;
...@@ -126,7 +132,7 @@ ...@@ -126,7 +132,7 @@
// label18 // label18
// //
this.label18.AutoSize = true; this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(221, 77); this.label18.Location = new System.Drawing.Point(221, 74);
this.label18.Name = "label18"; this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(14, 17); this.label18.Size = new System.Drawing.Size(14, 17);
this.label18.TabIndex = 63; this.label18.TabIndex = 63;
...@@ -135,7 +141,7 @@ ...@@ -135,7 +141,7 @@
// lblWirdFeedingSpeed // lblWirdFeedingSpeed
// //
this.lblWirdFeedingSpeed.AutoSize = true; this.lblWirdFeedingSpeed.AutoSize = true;
this.lblWirdFeedingSpeed.Location = new System.Drawing.Point(15, 32); this.lblWirdFeedingSpeed.Location = new System.Drawing.Point(15, 29);
this.lblWirdFeedingSpeed.Name = "lblWirdFeedingSpeed"; this.lblWirdFeedingSpeed.Name = "lblWirdFeedingSpeed";
this.lblWirdFeedingSpeed.Size = new System.Drawing.Size(92, 17); this.lblWirdFeedingSpeed.Size = new System.Drawing.Size(92, 17);
this.lblWirdFeedingSpeed.TabIndex = 59; this.lblWirdFeedingSpeed.TabIndex = 59;
...@@ -143,7 +149,7 @@ ...@@ -143,7 +149,7 @@
// //
// txtsendWireSpeed // txtsendWireSpeed
// //
this.txtsendWireSpeed.Location = new System.Drawing.Point(118, 32); this.txtsendWireSpeed.Location = new System.Drawing.Point(118, 29);
this.txtsendWireSpeed.MaxLength = 6; this.txtsendWireSpeed.MaxLength = 6;
this.txtsendWireSpeed.Name = "txtsendWireSpeed"; this.txtsendWireSpeed.Name = "txtsendWireSpeed";
this.txtsendWireSpeed.Size = new System.Drawing.Size(96, 23); this.txtsendWireSpeed.Size = new System.Drawing.Size(96, 23);
...@@ -152,7 +158,7 @@ ...@@ -152,7 +158,7 @@
// lblWirdFeedingTime // lblWirdFeedingTime
// //
this.lblWirdFeedingTime.AutoSize = true; this.lblWirdFeedingTime.AutoSize = true;
this.lblWirdFeedingTime.Location = new System.Drawing.Point(15, 72); this.lblWirdFeedingTime.Location = new System.Drawing.Point(15, 69);
this.lblWirdFeedingTime.Name = "lblWirdFeedingTime"; this.lblWirdFeedingTime.Name = "lblWirdFeedingTime";
this.lblWirdFeedingTime.Size = new System.Drawing.Size(92, 17); this.lblWirdFeedingTime.Size = new System.Drawing.Size(92, 17);
this.lblWirdFeedingTime.TabIndex = 61; this.lblWirdFeedingTime.TabIndex = 61;
...@@ -160,7 +166,7 @@ ...@@ -160,7 +166,7 @@
// //
// txtsendWireTime // txtsendWireTime
// //
this.txtsendWireTime.Location = new System.Drawing.Point(118, 72); this.txtsendWireTime.Location = new System.Drawing.Point(118, 69);
this.txtsendWireTime.MaxLength = 6; this.txtsendWireTime.MaxLength = 6;
this.txtsendWireTime.Name = "txtsendWireTime"; this.txtsendWireTime.Name = "txtsendWireTime";
this.txtsendWireTime.Size = new System.Drawing.Size(96, 23); this.txtsendWireTime.Size = new System.Drawing.Size(96, 23);
...@@ -172,23 +178,23 @@ ...@@ -172,23 +178,23 @@
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(21, 12); this.groupBox1.Location = new System.Drawing.Point(21, 12);
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(197, 265); this.groupBox1.Size = new System.Drawing.Size(177, 255);
this.groupBox1.TabIndex = 8; this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "机器人待机点配置"; this.groupBox1.Text = "机器人待机点配置";
// //
// homeControl // homeControl
// //
this.homeControl.Location = new System.Drawing.Point(12, 23); this.homeControl.Location = new System.Drawing.Point(6, 20);
this.homeControl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.homeControl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.homeControl.Name = "homeControl"; this.homeControl.Name = "homeControl";
this.homeControl.Size = new System.Drawing.Size(168, 236); this.homeControl.Size = new System.Drawing.Size(162, 227);
this.homeControl.TabIndex = 1; this.homeControl.TabIndex = 1;
// //
// btnClose // btnClose
// //
this.btnClose.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnClose.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClose.Location = new System.Drawing.Point(599, 502); this.btnClose.Location = new System.Drawing.Point(568, 543);
this.btnClose.Name = "btnClose"; this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(117, 35); this.btnClose.Size = new System.Drawing.Size(117, 35);
this.btnClose.TabIndex = 7; this.btnClose.TabIndex = 7;
...@@ -199,7 +205,7 @@ ...@@ -199,7 +205,7 @@
// btnSaveSetting // btnSaveSetting
// //
this.btnSaveSetting.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSaveSetting.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSaveSetting.Location = new System.Drawing.Point(458, 502); this.btnSaveSetting.Location = new System.Drawing.Point(427, 543);
this.btnSaveSetting.Name = "btnSaveSetting"; this.btnSaveSetting.Name = "btnSaveSetting";
this.btnSaveSetting.Size = new System.Drawing.Size(117, 35); this.btnSaveSetting.Size = new System.Drawing.Size(117, 35);
this.btnSaveSetting.TabIndex = 6; this.btnSaveSetting.TabIndex = 6;
...@@ -212,16 +218,16 @@ ...@@ -212,16 +218,16 @@
this.gbEpsonSetting.Controls.Add(this.txtLimZ); this.gbEpsonSetting.Controls.Add(this.txtLimZ);
this.gbEpsonSetting.Controls.Add(this.label8); this.gbEpsonSetting.Controls.Add(this.label8);
this.gbEpsonSetting.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.gbEpsonSetting.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.gbEpsonSetting.Location = new System.Drawing.Point(440, 404); this.gbEpsonSetting.Location = new System.Drawing.Point(387, 456);
this.gbEpsonSetting.Name = "gbEpsonSetting"; this.gbEpsonSetting.Name = "gbEpsonSetting";
this.gbEpsonSetting.Size = new System.Drawing.Size(276, 80); this.gbEpsonSetting.Size = new System.Drawing.Size(360, 69);
this.gbEpsonSetting.TabIndex = 1; this.gbEpsonSetting.TabIndex = 1;
this.gbEpsonSetting.TabStop = false; this.gbEpsonSetting.TabStop = false;
this.gbEpsonSetting.Text = "机器人Z轴最低点"; this.gbEpsonSetting.Text = "机器人Z轴最低点";
// //
// txtLimZ // txtLimZ
// //
this.txtLimZ.Location = new System.Drawing.Point(107, 35); this.txtLimZ.Location = new System.Drawing.Point(107, 29);
this.txtLimZ.Name = "txtLimZ"; this.txtLimZ.Name = "txtLimZ";
this.txtLimZ.Size = new System.Drawing.Size(133, 23); this.txtLimZ.Size = new System.Drawing.Size(133, 23);
this.txtLimZ.TabIndex = 7; this.txtLimZ.TabIndex = 7;
...@@ -229,7 +235,7 @@ ...@@ -229,7 +235,7 @@
// label8 // label8
// //
this.label8.AutoSize = true; this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(17, 39); this.label8.Location = new System.Drawing.Point(17, 33);
this.label8.Name = "label8"; this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(63, 17); this.label8.Size = new System.Drawing.Size(63, 17);
this.label8.TabIndex = 6; this.label8.TabIndex = 6;
...@@ -240,53 +246,100 @@ ...@@ -240,53 +246,100 @@
this.groupBox5.Controls.Add(this.maxControl); this.groupBox5.Controls.Add(this.maxControl);
this.groupBox5.Controls.Add(this.minControl); this.groupBox5.Controls.Add(this.minControl);
this.groupBox5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox5.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox5.Location = new System.Drawing.Point(21, 282); this.groupBox5.Location = new System.Drawing.Point(21, 270);
this.groupBox5.Name = "groupBox5"; this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(400, 249); this.groupBox5.Size = new System.Drawing.Size(357, 256);
this.groupBox5.TabIndex = 42; this.groupBox5.TabIndex = 42;
this.groupBox5.TabStop = false; this.groupBox5.TabStop = false;
this.groupBox5.Text = "机械臂活动范围"; this.groupBox5.Text = "机械臂活动范围";
// //
// maxControl // maxControl
// //
this.maxControl.Location = new System.Drawing.Point(199, 25); this.maxControl.Location = new System.Drawing.Point(173, 25);
this.maxControl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.maxControl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.maxControl.Name = "maxControl"; this.maxControl.Name = "maxControl";
this.maxControl.Size = new System.Drawing.Size(168, 226); this.maxControl.Size = new System.Drawing.Size(160, 217);
this.maxControl.TabIndex = 3; this.maxControl.TabIndex = 3;
// //
// minControl // minControl
// //
this.minControl.Location = new System.Drawing.Point(12, 25); this.minControl.Location = new System.Drawing.Point(7, 25);
this.minControl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.minControl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.minControl.Name = "minControl"; this.minControl.Name = "minControl";
this.minControl.Size = new System.Drawing.Size(168, 226); this.minControl.Size = new System.Drawing.Size(160, 217);
this.minControl.TabIndex = 2; this.minControl.TabIndex = 2;
// //
// groupBox6 // groupBox6
// //
this.groupBox6.Controls.Add(this.markControl); this.groupBox6.Controls.Add(this.markControl);
this.groupBox6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.groupBox6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox6.Location = new System.Drawing.Point(660, 12); this.groupBox6.Location = new System.Drawing.Point(570, 12);
this.groupBox6.Name = "groupBox6"; this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(197, 265); this.groupBox6.Size = new System.Drawing.Size(177, 255);
this.groupBox6.TabIndex = 43; this.groupBox6.TabIndex = 43;
this.groupBox6.TabStop = false; this.groupBox6.TabStop = false;
this.groupBox6.Text = "坐标偏移Mark点配置"; this.groupBox6.Text = "坐标偏移Mark点配置";
// //
// markControl // markControl
// //
this.markControl.Location = new System.Drawing.Point(24, 20); this.markControl.Location = new System.Drawing.Point(6, 20);
this.markControl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.markControl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6);
this.markControl.Name = "markControl"; this.markControl.Name = "markControl";
this.markControl.Size = new System.Drawing.Size(168, 236); this.markControl.Size = new System.Drawing.Size(162, 227);
this.markControl.TabIndex = 2; this.markControl.TabIndex = 2;
// //
// groupBox7
//
this.groupBox7.Controls.Add(this.txtMarkY);
this.groupBox7.Controls.Add(this.label2);
this.groupBox7.Controls.Add(this.txtMarkX);
this.groupBox7.Controls.Add(this.label1);
this.groupBox7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox7.Location = new System.Drawing.Point(387, 270);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(360, 67);
this.groupBox7.TabIndex = 44;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "坐标偏移Mark点的图片坐标";
//
// txtMarkX
//
this.txtMarkX.Location = new System.Drawing.Point(51, 27);
this.txtMarkX.Name = "txtMarkX";
this.txtMarkX.Size = new System.Drawing.Size(106, 23);
this.txtMarkX.TabIndex = 7;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(17, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(28, 17);
this.label1.TabIndex = 6;
this.label1.Text = "X:";
//
// txtMarkY
//
this.txtMarkY.Location = new System.Drawing.Point(212, 27);
this.txtMarkY.Name = "txtMarkY";
this.txtMarkY.Size = new System.Drawing.Size(106, 23);
this.txtMarkY.TabIndex = 9;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(178, 30);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(27, 17);
this.label2.TabIndex = 8;
this.label2.Text = "Y:";
//
// FrmSetting // FrmSetting
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(871, 555); this.ClientSize = new System.Drawing.Size(789, 587);
this.Controls.Add(this.groupBox7);
this.Controls.Add(this.groupBox6); this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox5); this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox3);
...@@ -308,6 +361,8 @@ ...@@ -308,6 +361,8 @@
this.gbEpsonSetting.PerformLayout(); this.gbEpsonSetting.PerformLayout();
this.groupBox5.ResumeLayout(false); this.groupBox5.ResumeLayout(false);
this.groupBox6.ResumeLayout(false); this.groupBox6.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
...@@ -336,5 +391,10 @@ ...@@ -336,5 +391,10 @@
private UserFromControl.URRobotMControl minControl; private UserFromControl.URRobotMControl minControl;
private System.Windows.Forms.GroupBox groupBox6; private System.Windows.Forms.GroupBox groupBox6;
private UserFromControl.URRobotMControl markControl; private UserFromControl.URRobotMControl markControl;
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.TextBox txtMarkX;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtMarkY;
private System.Windows.Forms.Label label2;
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -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()
...@@ -102,7 +105,7 @@ namespace URSoldering.Client ...@@ -102,7 +105,7 @@ namespace URSoldering.Client
URPointValue minP = minControl.GetPoint(); URPointValue minP = minControl.GetPoint();
URPointValue maxP = maxControl.GetPoint(); URPointValue maxP = maxControl.GetPoint();
//if (XMin > XMax) //if (XMin > XMax)
//{ //{
// MessageBox.Show("请正确输入机械臂X轴范围!"); // MessageBox.Show("请正确输入机械臂X轴范围!");
...@@ -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)
...@@ -729,37 +726,42 @@ namespace URSoldering.Client ...@@ -729,37 +726,42 @@ namespace URSoldering.Client
return 0; return 0;
} }
} }
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 + ";";
} }
} }
resultList = lblAOIResult.Text; resultList = lblAOIResult.Text;
LogUtil.info(resultList); LogUtil.info(resultList);
lblAOIResult.Visible = true; lblAOIResult.Visible = true;
} }
catch (Exception ex) catch (Exception ex)
...@@ -793,39 +795,20 @@ namespace URSoldering.Client ...@@ -793,39 +795,20 @@ namespace URSoldering.Client
LogUtil.info("获取【" + name + "】的数量:" + num); LogUtil.info("获取【" + name + "】的数量:" + num);
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);
if (axCKVisionCtrl1.GetValue(idTool, 102, i, ref objValue) == true)
{ {
objValue = new VariantWrapper(value); result = objValue.ToString();
if (axCKVisionCtrl1.GetValue(idTool, 102, i, ref objValue) == true) x = Convert.ToDouble(result);
{
result = objValue.ToString();
x = Convert.ToDouble(result);
}
objValue = new VariantWrapper(value);
if (axCKVisionCtrl1.GetValue(idTool, 103, i, ref objValue) == true)
{
result = objValue.ToString();
y = Convert.ToDouble(result);
}
aOIDataResults.Add(new PositionResult(x, y, 1, point));
} }
else objValue = new VariantWrapper(value);
if (axCKVisionCtrl1.GetValue(idTool, 103, i, ref objValue) == true)
{ {
objValue = new VariantWrapper(value); result = objValue.ToString();
if (axCKVisionCtrl1.GetValue(idTool, 103, i, ref objValue) == true) y = Convert.ToDouble(result);
{
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));
} }
aOIDataResults.Add(new PositionResult(x, y));
} }
} }
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!