Commit 76f9c750 几米阳光

调试修改

1 个父辈 dbf9a7a6
...@@ -193,15 +193,22 @@ namespace URSoldering.Common ...@@ -193,15 +193,22 @@ namespace URSoldering.Common
/// </summary> /// </summary>
public void sendLine(string strSendData) public void sendLine(string strSendData)
{ {
LogUtil.info(LOGGER, LogName + "发送数据:" + strSendData); try
LogUtil.URLInfo(LogName + "发送数据:" + strSendData);
strSendData = strSendData + "\r\n";
byte[] sendBuffer = new byte[DefaultDataLength];
sendBuffer = Encoding.UTF8.GetBytes(strSendData);
if (m_clientSocket != null && m_clientSocket.Connected)
{ {
m_clientSocket.Send(sendBuffer); LogUtil.info(LOGGER, LogName + "发送数据:" + strSendData);
LogUtil.debug(LOGGER, "Send >> " + strSendData); LogUtil.URLInfo(LogName + "发送数据:" + strSendData);
strSendData = strSendData + "\r\n";
byte[] sendBuffer = new byte[DefaultDataLength];
sendBuffer = Encoding.UTF8.GetBytes(strSendData);
if (m_clientSocket != null && m_clientSocket.Connected)
{
m_clientSocket.Send(sendBuffer);
LogUtil.debug(LOGGER, "Send >> " + strSendData);
}
}catch (Exception ex)
{
LogUtil.error(LogName + "发送数据【" + strSendData + "】出错");
LogUtil.URLError(LogName+ "发送数据【"+ strSendData + "】出错:"+ex.ToString());
} }
} }
int headSize = 4;//包头长度 固定4 int headSize = 4;//包头长度 固定4
......
...@@ -103,7 +103,6 @@ ...@@ -103,7 +103,6 @@
<Compile Include="bean\BoardManager.cs" /> <Compile Include="bean\BoardManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Robot\LineSolderingRobot.cs" /> <Compile Include="Robot\LineSolderingRobot.cs" />
<Compile Include="Robot\LineSolderingRobot_Partial.cs" />
<Compile Include="Robot\soldering\WeldRobotBean.cs" /> <Compile Include="Robot\soldering\WeldRobotBean.cs" />
<Compile Include="Robot\soldering\WeldRobotBean_Partial.cs" /> <Compile Include="Robot\soldering\WeldRobotBean_Partial.cs" />
<Compile Include="Robot\soldering\WeldStepBean.cs" /> <Compile Include="Robot\soldering\WeldStepBean.cs" />
......
...@@ -34,18 +34,12 @@ namespace URSoldering.DeviceLibrary ...@@ -34,18 +34,12 @@ namespace URSoldering.DeviceLibrary
ledTimer.Enabled = false; ledTimer.Enabled = false;
IsInSuddendown = false; IsInSuddendown = false;
WarnMsg = ""; WarnMsg = "";
if (!ShuddenOK()) if (!ShuddenOK())
{ {
WarnMsg = "急停未开"; WarnMsg = "急停未开";
return false; return false;
} }
//if (KNDIOValue(IO_Type.AirCheck_Single).Equals(IO_VALUE.LOW))
//{
// WarnMsg = "没有气压信号";
// return false;
//}
//焊接机器人复位 //焊接机器人复位
string solderingStr = ""; string solderingStr = "";
if (Status > RobotStatus.Wait) if (Status > RobotStatus.Wait)
...@@ -63,13 +57,9 @@ namespace URSoldering.DeviceLibrary ...@@ -63,13 +57,9 @@ namespace URSoldering.DeviceLibrary
return false; return false;
} }
Status = RobotStatus.Reset; Status = RobotStatus.Reset;
//KNDIOMove(IO_Type.AutoRunSingle, IO_VALUE.HIGH); WeldRobotBean.IsInWeld = false;
//KNDIOMove(IO_Type.AlarmSingle, IO_VALUE.LOW); IsInProcess = false;
//KNDIOMove(IO_Type.WaitSingle, IO_VALUE.LOW);
//KNDIOMove(IO_Type.DeviceRunON, IO_VALUE.LOW);
IsInProcess = false;
ledTimer.Enabled = true; ledTimer.Enabled = true;
mainTimer.Enabled = true; mainTimer.Enabled = true;
return true; return true;
...@@ -85,6 +75,26 @@ namespace URSoldering.DeviceLibrary ...@@ -85,6 +75,26 @@ namespace URSoldering.DeviceLibrary
IsInSuddendown = true; IsInSuddendown = true;
Alarm(AlarmType.SuddenStop); Alarm(AlarmType.SuddenStop);
} }
public string StartWeld()
{
string msg = "";
//如果开始焊接,开始焊接
if (Status.Equals(RobotStatus.Runing) && WeldRobotBean.WeldMoveStep.moveType.Equals(MoveType.None))
{
msg = WeldRobotBean.StartWeld();
if (msg.Equals(""))
{
Status = RobotStatus.Busy;
}
}
else
{
msg = "无法开始焊接";
}
return msg;
}
private bool IsInProcess = false; private bool IsInProcess = false;
protected override void mainTimer_Elapsed(object sender, ElapsedEventArgs e) protected override void mainTimer_Elapsed(object sender, ElapsedEventArgs e)
{ {
...@@ -116,11 +126,7 @@ namespace URSoldering.DeviceLibrary ...@@ -116,11 +126,7 @@ namespace URSoldering.DeviceLibrary
&& KNDIOValue(IO_Type.SendWire_Work).Equals(IO_VALUE.HIGH)) && KNDIOValue(IO_Type.SendWire_Work).Equals(IO_VALUE.HIGH))
{ {
LogUtil.info(RobotName + "复位完成"); LogUtil.info(RobotName + "复位完成");
Status = RobotStatus.Runing; Status = RobotStatus.Runing;
//KNDIOMove(IO_Type.AutoRunSingle, IO_VALUE.HIGH);
//KNDIOMove(IO_Type.AlarmSingle, IO_VALUE.LOW);
//KNDIOMove(IO_Type.WaitSingle, IO_VALUE.LOW);
//KNDIOMove(IO_Type.DeviceRunON, IO_VALUE.HIGH);
} }
} }
else if (Status.Equals(RobotStatus.Runing)) else if (Status.Equals(RobotStatus.Runing))
...@@ -175,8 +181,7 @@ namespace URSoldering.DeviceLibrary ...@@ -175,8 +181,7 @@ namespace URSoldering.DeviceLibrary
} }
private void StopMove() private void StopMove()
{ {
//KNDIOMove(IO_Type.DeviceRunON, IO_VALUE.LOW);
WeldRobotBean.StopMove(); WeldRobotBean.StopMove();
this.Status = RobotStatus.Runing; this.Status = RobotStatus.Runing;
} }
...@@ -185,14 +190,68 @@ namespace URSoldering.DeviceLibrary ...@@ -185,14 +190,68 @@ namespace URSoldering.DeviceLibrary
ledTimer.Enabled = false; ledTimer.Enabled = false;
mainTimer.Enabled = false; mainTimer.Enabled = false;
StopMove(); StopMove();
WeldRobotBean.StopRun(); WeldRobotBean.StopRun();
//KNDIOMove(IO_Type.AutoRunSingle, IO_VALUE.LOW);
//KNDIOMove(IO_Type.AlarmSingle, IO_VALUE.LOW);
//KNDIOMove(IO_Type.WaitSingle, IO_VALUE.LOW);
//KNDIOMove(IO_Type.DeviceRunON, IO_VALUE.LOW);
this.Status = RobotStatus.Wait; this.Status = RobotStatus.Wait;
LogUtil.info(RobotName + "停止运行"); LogUtil.info(RobotName + "停止运行");
} }
public DateTime LastStartWeldTime = DateTime.Now;
public DateTime LastEndWeldTime = DateTime.Now;
public bool IsWeld = false;
public delegate void GetCode();
public event GetCode GetCodeFun;
public bool IsAutoRun = false;
private void BusyProcess()
{
if (LineStep.moveStep.Equals(MoveStep.Wait))
{
if (WeldRobotBean.IsInWeld.Equals(false))
{
LastEndWeldTime = DateTime.Now;
TimeSpan span = LastEndWeldTime - LastStartWeldTime;
if (BoardManager.CurrBoard.WeldTime.TotalSeconds <= 0)
{
BoardManager.CurrBoard.WeldTime = span;
}
else
{
BoardManager.CurrBoard.WeldTime = new TimeSpan(0, 0, (int)(BoardManager.CurrBoard.WeldTime.TotalSeconds + span.TotalSeconds) / 2);
}
BoardManager.Update(BoardManager.CurrBoard);
LogUtil.info("Busy处理:" + "焊接结束,焊接耗时" + FormUtil.GetSpanStr(span) + ",累积平均耗时" + FormUtil.GetSpanStr(BoardManager.CurrBoard.WeldTime) + "");
LineStep.EndMove();
Status = RobotStatus.Runing;
}
}
}
/// <summary>
/// 判断是否还有未完成的工作
/// </summary>
public bool NeedWork()
{
if (Status > RobotStatus.Wait)
{
if (WeldRobotBean.WeldMoveStep.moveType.Equals(MoveType.Weld))
{
return true;
}
}
return false;
}
private void Alarm(AlarmType alarmType)
{
this.alarmType = alarmType;
if (AlarmType.SuddenStop.Equals(alarmType))
{
WarnMsg = "收到急停信号";
WeldRobotBean.Alarm(AlarmType.SuddenStop);
SendWireManager.Release();
StopMove();
}
}
} }
} }
using URSoldering.Common;
using URSoldering.LoadCSVLibrary;
using System;
namespace URSoldering.DeviceLibrary
{
public partial class URSolderingRobot
{
public DateTime LastStartWeldTime = DateTime.Now;
public DateTime LastEndWeldTime = DateTime.Now;
public bool IsWeld = false;
public delegate void GetCode();
public event GetCode GetCodeFun;
public bool IsAutoRun = false;
private void BusyProcess()
{
if (LineStep.moveStep.Equals(MoveStep.BUSY01_Weld))
{
if (WeldRobotBean.IsInWeld.Equals(false))
{
LastEndWeldTime = DateTime.Now;
TimeSpan span = LastEndWeldTime - LastStartWeldTime;
if (BoardManager.CurrBoard.WeldTime.TotalSeconds <= 0)
{
BoardManager.CurrBoard.WeldTime = span;
}
else
{
BoardManager.CurrBoard.WeldTime = new TimeSpan(0, 0, (int)(BoardManager.CurrBoard.WeldTime.TotalSeconds + span.TotalSeconds) / 2);
}
BoardManager.Update(BoardManager.CurrBoard);
LogUtil.info("Busy处理:" + "焊接结束,焊接耗时" + FormUtil.GetSpanStr(span) + ",累积平均耗时" + FormUtil.GetSpanStr(BoardManager.CurrBoard.WeldTime) + ",阻挡气缸下降");
LineStep.EndMove();
Status = RobotStatus.Runing;
}
}
}
/// <summary>
/// 判断是否还有未完成的工作
/// </summary>
public bool NeedWork()
{
if (Status > RobotStatus.Wait)
{
if (WeldRobotBean.WeldMoveStep.moveType.Equals(MoveType.Weld))
{
return true;
}
}
return false;
}
private void Alarm(AlarmType alarmType)
{
this.alarmType = alarmType;
if (AlarmType.SuddenStop.Equals(alarmType))
{
//KNDIOMove(IO_Type.AlarmSingle, IO_VALUE.HIGH);
WarnMsg = "收到急停信号";
WeldRobotBean.Alarm(AlarmType.SuddenStop);
SendWireManager.Release();
StopMove();
}
}
}
}
...@@ -73,7 +73,7 @@ namespace URSoldering.DeviceLibrary ...@@ -73,7 +73,7 @@ namespace URSoldering.DeviceLibrary
} }
else if (WaitType == 3) else if (WaitType == 3)
{ {
return "等待机器人运动结束"; return "等待机器人运动结束"+UrPoint.ToShowStr();
} }
else if (WaitType == 4) else if (WaitType == 4)
{ {
...@@ -82,6 +82,9 @@ namespace URSoldering.DeviceLibrary ...@@ -82,6 +82,9 @@ namespace URSoldering.DeviceLibrary
else if (WaitType == 5) else if (WaitType == 5)
{ {
return "等待送丝"; return "等待送丝";
}else if (WaitType == 6)
{
return "等待机器人连接完成";
} }
else else
{ {
......
...@@ -23,7 +23,7 @@ namespace URSoldering.DeviceLibrary ...@@ -23,7 +23,7 @@ namespace URSoldering.DeviceLibrary
public static URPointValue Clear2Point = new URPointValue(); public static URPointValue Clear2Point = new URPointValue();
public static URPointValue RobotMin = new URPointValue(); public static URPointValue RobotMin = new URPointValue();
public static URPointValue RobotMax = new URPointValue(); public static URPointValue RobotMax = new URPointValue();
public static int SendWireXiShu = ConfigAppSettings.GetIntValue(Setting_Init.SendWire_Change); public static int SendWireXiShu = ConfigAppSettings.GetIntValue(Setting_Init.SendWire_Change);
//休眠的秒数,<=0不需要休眠 //休眠的秒数,<=0不需要休眠
...@@ -52,7 +52,7 @@ namespace URSoldering.DeviceLibrary ...@@ -52,7 +52,7 @@ namespace URSoldering.DeviceLibrary
public static int WeldCount = 0; public static int WeldCount = 0;
private static bool isInit = false; private static bool isInit = false;
public static AlarmType alarmType = AlarmType.None; public static AlarmType alarmType = AlarmType.None;
//记录是否空闲中,如果空闲并且超过三分钟,就关闭烙铁,下次启动时需要打卡 //记录是否空闲中,如果空闲并且超过三分钟,就关闭烙铁,下次启动时需要打卡
private static bool IsFree = false; private static bool IsFree = false;
private static DateTime BeginFreeTime = DateTime.Now; private static DateTime BeginFreeTime = DateTime.Now;
...@@ -73,7 +73,7 @@ namespace URSoldering.DeviceLibrary ...@@ -73,7 +73,7 @@ namespace URSoldering.DeviceLibrary
RobotMax = LoadPoint(Setting_Init.Soldering_RobotMax); RobotMax = LoadPoint(Setting_Init.Soldering_RobotMax);
} }
private static URPointValue LoadPoint( string configStr) private static URPointValue LoadPoint(string configStr)
{ {
URPointValue p = new URPointValue(); URPointValue p = new URPointValue();
string configP = ConfigAppSettings.GetValue(configStr); string configP = ConfigAppSettings.GetValue(configStr);
...@@ -89,10 +89,10 @@ namespace URSoldering.DeviceLibrary ...@@ -89,10 +89,10 @@ namespace URSoldering.DeviceLibrary
} }
public static SolderingRobotConfig RobotConfig = null; public static SolderingRobotConfig RobotConfig = null;
public static void InitData(SolderingRobotConfig config) public static void InitData(SolderingRobotConfig config)
{ {
RobotConfig = config; RobotConfig = config;
} }
/// <summary> /// <summary>
/// 初始化 /// 初始化
...@@ -107,7 +107,7 @@ namespace URSoldering.DeviceLibrary ...@@ -107,7 +107,7 @@ namespace URSoldering.DeviceLibrary
{ {
WarnMsg = "连接UR机器人失败"; WarnMsg = "连接UR机器人失败";
} }
}); });
SolderingManager.Init(RobotConfig.JBC_Soldering_Port, RobotConfig.JBC_Soldering_Num); SolderingManager.Init(RobotConfig.JBC_Soldering_Port, RobotConfig.JBC_Soldering_Num);
SendWireManager.Init(RobotConfig.JBC_SendWire_Port); SendWireManager.Init(RobotConfig.JBC_SendWire_Port);
...@@ -115,15 +115,14 @@ namespace URSoldering.DeviceLibrary ...@@ -115,15 +115,14 @@ namespace URSoldering.DeviceLibrary
} }
public static void ResetInit() public static void ResetInit()
{ {
if (!URRobotControl.IsRun) if (!URRobotControl.IsRun)
{ {
//URRobotControl.InitEpson();
Task.Factory.StartNew(delegate () Task.Factory.StartNew(delegate ()
{ {
bool result = URRobotControl.StartRobot(); bool result = URRobotControl.StartRobot();
if(!result) if (!result)
{ {
WarnMsg = "连接UR机器人失败"; WarnMsg = "连接UR机器人失败";
} }
...@@ -137,8 +136,8 @@ namespace URSoldering.DeviceLibrary ...@@ -137,8 +136,8 @@ namespace URSoldering.DeviceLibrary
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static string StartRun() public static string StartRun()
{ {
LogUtil.info(RobotName + "开始启动"); LogUtil.info(RobotName + "开始启动");
IsFirstStart = true; IsFirstStart = true;
return GoHome(); return GoHome();
} }
...@@ -155,12 +154,22 @@ namespace URSoldering.DeviceLibrary ...@@ -155,12 +154,22 @@ namespace URSoldering.DeviceLibrary
{ {
ResetInit(); ResetInit();
} }
Thread.Sleep(1000); //Thread.Sleep(1000);
if (!URRobotControl.IsRun) //if (!URRobotControl.IsRun)
//{
// Thread.Sleep(2000);
//}
if (!URRobotControl.PointIsValid(HomePoint))
{
LogUtil.info(RobotName + "开始启动失败:原点坐标无效");
return "原点坐标无效";
}
if ((!URRobotControl.PointIsValid(Clear1Point)) || (!URRobotControl.PointIsValid(Clear2Point)))
{ {
Thread.Sleep(2000); LogUtil.info(RobotName + "开始启动失败:清洗点坐标无效");
return "清洗点坐标无效";
} }
if (HasSoldering) if (HasSoldering)
{ {
if (!SolderingManager.IsRun) if (!SolderingManager.IsRun)
...@@ -168,20 +177,21 @@ namespace URSoldering.DeviceLibrary ...@@ -168,20 +177,21 @@ namespace URSoldering.DeviceLibrary
LogUtil.info(RobotName + "开始启动:烙铁没有连接上"); LogUtil.info(RobotName + "开始启动:烙铁没有连接上");
return "烙铁没有连接上!"; return "烙铁没有连接上!";
} }
if (!SendWireManager.IsRun)
{
LogUtil.info(RobotName + "开始启动:JBC送丝器没有连接上");
return "JBC送丝器没有连接上!";
}
} }
if (!SendWireManager.IsRun)
{
LogUtil.info(RobotName + "开始启动:JBC送丝器没有连接上");
return "JBC送丝器没有连接上!";
}
IsInSudden = false; IsInSudden = false;
IsNoAir = false; IsNoAir = false;
//开始运行 //开始运行
alarmType = AlarmType.None; alarmType = AlarmType.None;
//锁定轴 //锁定轴
URRobotControl.LockAxis(); URRobotControl.LockAxis();
//烙铁温度=0, 送丝上升,机器复位 //烙铁温度=0, 送丝上升,机器复位
SolderingUp(false); SolderingUp(false);
SendWireWork(false); SendWireWork(false);
...@@ -190,24 +200,24 @@ namespace URSoldering.DeviceLibrary ...@@ -190,24 +200,24 @@ namespace URSoldering.DeviceLibrary
mainTimer.Enabled = true; mainTimer.Enabled = true;
return ""; return "";
} }
public static void StopWeld() public static void StopWeld()
{ {
LogUtil.info(RobotName + "停止当前焊接"); LogUtil.info(RobotName + "停止当前焊接");
WeldMoveStep.EndMove(); WeldMoveStep.EndMove();
} }
/// <summary> /// <summary>
/// 停止所有运动 /// 停止所有运动
/// </summary> /// </summary>
public static void StopMove() public static void StopMove()
{ {
StopWeld(); StopWeld();
LogUtil.info(RobotName + "停止所有运动"); LogUtil.info(RobotName + "停止所有运动");
//烙铁温度=0,烙铁上升,送丝上升,机器复位 //烙铁温度=0,烙铁上升,送丝上升,机器复位
SolderingUp(false); SolderingUp(false);
SendWireWork(false); SendWireWork(false);
SendWireManager.StopSend(); SendWireManager.StopSend();
SolderingManager.Release(); SolderingManager.Release();
} }
...@@ -220,8 +230,8 @@ namespace URSoldering.DeviceLibrary ...@@ -220,8 +230,8 @@ namespace URSoldering.DeviceLibrary
SolderSleep = false; SolderSleep = false;
StopMove(); StopMove();
mainTimer.Enabled = false; mainTimer.Enabled = false;
ISRun = false; ISRun = false;
LogUtil.info(LOGGER, RobotName + "停止运行"); LogUtil.info(LOGGER, RobotName + "停止运行");
} }
private static bool IsTimerProcess = false; private static bool IsTimerProcess = false;
...@@ -293,7 +303,7 @@ namespace URSoldering.DeviceLibrary ...@@ -293,7 +303,7 @@ namespace URSoldering.DeviceLibrary
{ {
return; return;
} }
if (URRobotControl.WarnMsg.Equals("")) if (URRobotControl.WarnMsg.Equals(""))
{ {
if (URRobotControl.IsRun.Equals(false)) if (URRobotControl.IsRun.Equals(false))
...@@ -324,7 +334,7 @@ namespace URSoldering.DeviceLibrary ...@@ -324,7 +334,7 @@ namespace URSoldering.DeviceLibrary
} }
private static DateTime preCheckSendWireTime = DateTime.Now; private static DateTime preCheckSendWireTime = DateTime.Now;
private static DateTime lastSendWireOkTime = DateTime.Now; private static DateTime lastSendWireOkTime = DateTime.Now;
/// <summary> /// <summary>
/// 检测送丝错误 /// 检测送丝错误
/// </summary> /// </summary>
...@@ -342,7 +352,7 @@ namespace URSoldering.DeviceLibrary ...@@ -342,7 +352,7 @@ namespace URSoldering.DeviceLibrary
WarnMsg = "送丝器报警"; WarnMsg = "送丝器报警";
Alarm(AlarmType.SendWireAlarm); Alarm(AlarmType.SendWireAlarm);
LogUtil.error(RobotName + WarnMsg); LogUtil.error(RobotName + WarnMsg);
} }
} }
else else
{ {
...@@ -374,9 +384,9 @@ namespace URSoldering.DeviceLibrary ...@@ -374,9 +384,9 @@ namespace URSoldering.DeviceLibrary
if (alarmType.Equals(AlarmType.SendWireAlarm) && IsInSudden.Equals(false) && IsNoAir.Equals(false)) if (alarmType.Equals(AlarmType.SendWireAlarm) && IsInSudden.Equals(false) && IsNoAir.Equals(false))
{ {
if (WeldMoveStep.moveType.Equals(MoveType.Weld)) if (WeldMoveStep.moveType.Equals(MoveType.Weld))
{ {
LogUtil.info(RobotName + "开始卡丝恢复,重新此焊点的焊接 !"); LogUtil.info(RobotName + "开始卡丝恢复,重新此焊点的焊接 !");
WeldMoveStep.NextMoveStep(MoveStep.Wait); WeldMoveStep.NextMoveStep(MoveStep.Wait);
} }
lastSendWireOkTime = DateTime.Now; lastSendWireOkTime = DateTime.Now;
LogUtil.info(RobotName + "开始卡丝恢复!"); LogUtil.info(RobotName + "开始卡丝恢复!");
...@@ -410,7 +420,7 @@ namespace URSoldering.DeviceLibrary ...@@ -410,7 +420,7 @@ namespace URSoldering.DeviceLibrary
{ {
//10秒钟检测一次 //10秒钟检测一次
TimeSpan span = DateTime.Now - preCheckSolderingTime; TimeSpan span = DateTime.Now - preCheckSolderingTime;
if (span.TotalSeconds > 10) if (span.TotalSeconds > 10)
{ {
preCheckSolderingTime = DateTime.Now; preCheckSolderingTime = DateTime.Now;
...@@ -419,11 +429,11 @@ namespace URSoldering.DeviceLibrary ...@@ -419,11 +429,11 @@ namespace URSoldering.DeviceLibrary
//添加验证,需要连续两次都是同一个值才算有效,跳过不稳定的错误 //添加验证,需要连续两次都是同一个值才算有效,跳过不稳定的错误
if (!ErrorCode.Equals(preSolderingRet)) if (!ErrorCode.Equals(preSolderingRet))
{ {
LOGGER.Info(RobotName+"烙铁PortError更改,本次读取的值:"+ErrorCode+",上次的值:"+preSolderingRet+""); LOGGER.Info(RobotName + "烙铁PortError更改,本次读取的值:" + ErrorCode + ",上次的值:" + preSolderingRet + "");
preSolderingRet = ErrorCode; preSolderingRet = ErrorCode;
} }
if (ErrorCode > 0) if (ErrorCode > 0)
{ {
string str = SolderingManager.GetErrorStr(ErrorCode); string str = SolderingManager.GetErrorStr(ErrorCode);
WarnMsg = "烙铁报警:" + str; WarnMsg = "烙铁报警:" + str;
Alarm(AlarmType.SolderingAlarm); Alarm(AlarmType.SolderingAlarm);
...@@ -436,13 +446,13 @@ namespace URSoldering.DeviceLibrary ...@@ -436,13 +446,13 @@ namespace URSoldering.DeviceLibrary
WarnMsg = ""; WarnMsg = "";
alarmType = AlarmType.None; alarmType = AlarmType.None;
WarnMsg = ""; WarnMsg = "";
LogUtil.error(RobotName +"消除烙铁报警!"); LogUtil.error(RobotName + "消除烙铁报警!");
} }
} }
} }
} }
/// <summary> /// <summary>
/// io检测异常,如果所有的步骤已经完成,表示信号超时异常已经结束 /// io检测异常,如果所有的步骤已经完成,表示信号超时异常已经结束
/// </summary> /// </summary>
...@@ -460,7 +470,7 @@ namespace URSoldering.DeviceLibrary ...@@ -460,7 +470,7 @@ namespace URSoldering.DeviceLibrary
return; return;
} }
if (alarmType.Equals(AlarmType.IoSingleTimeOut) || alarmType.Equals(AlarmType.StepTimeOut)) if (alarmType.Equals(AlarmType.IoSingleTimeOut) || alarmType.Equals(AlarmType.StepTimeOut))
{ {
if (WeldMoveStep.IsInWait == false) if (WeldMoveStep.IsInWait == false)
{ {
LogUtil.info(RobotName + "之前有IO超时异常,清理信号超时异常!"); LogUtil.info(RobotName + "之前有IO超时异常,清理信号超时异常!");
...@@ -476,7 +486,7 @@ namespace URSoldering.DeviceLibrary ...@@ -476,7 +486,7 @@ namespace URSoldering.DeviceLibrary
LogUtil.error(LOGGER, "IOTimeOutProcess出错:" + ex.ToString()); LogUtil.error(LOGGER, "IOTimeOutProcess出错:" + ex.ToString());
} }
} }
public static void Alarm(AlarmType alarm) public static void Alarm(AlarmType alarm)
{ {
LogUtil.error(LOGGER, RobotName + "收到报警:" + alarm); LogUtil.error(LOGGER, RobotName + "收到报警:" + alarm);
alarmType = alarm; alarmType = alarm;
...@@ -485,10 +495,10 @@ namespace URSoldering.DeviceLibrary ...@@ -485,10 +495,10 @@ namespace URSoldering.DeviceLibrary
if (alarmType.Equals(AlarmType.IoSingleTimeOut)) if (alarmType.Equals(AlarmType.IoSingleTimeOut))
{ {
} }
else if (alarmType.Equals(AlarmType.SuddenStop) || alarmType.Equals(AlarmType.NoAirCheck)||alarm.Equals(AlarmType.RobotError)) else if (alarmType.Equals(AlarmType.SuddenStop) || alarmType.Equals(AlarmType.NoAirCheck) || alarm.Equals(AlarmType.RobotError))
{ {
if (alarmType.Equals(AlarmType.SuddenStop)) if (alarmType.Equals(AlarmType.SuddenStop))
{ {
IsInSudden = true; IsInSudden = true;
} }
else if (alarmType.Equals(AlarmType.NoAirCheck)) else if (alarmType.Equals(AlarmType.NoAirCheck))
...@@ -496,9 +506,9 @@ namespace URSoldering.DeviceLibrary ...@@ -496,9 +506,9 @@ namespace URSoldering.DeviceLibrary
IsNoAir = true; IsNoAir = true;
} }
//急停之后需要机械臂重连 //急停之后需要机械臂重连
URRobotControl.StopRobot(); URRobotControl.StopRobot();
//停止所有运行 //停止所有运行
StopMove(); StopMove();
} }
} }
...@@ -531,17 +541,7 @@ namespace URSoldering.DeviceLibrary ...@@ -531,17 +541,7 @@ namespace URSoldering.DeviceLibrary
if (WeldMoveStep.moveStep.Equals(MoveStep.Home_Reset)) if (WeldMoveStep.moveStep.Equals(MoveStep.Home_Reset))
{ {
WeldMoveStep.NextMoveStep(MoveStep.Home_1_RobotMove); WeldMoveStep.NextMoveStep(MoveStep.Home_1_RobotMove);
//验证位置
TimeSpan span = URRobotControl.GetLastPosition().UpdateTime - DateTime.Now; ;
if (span.TotalSeconds <= 60 && (URRobotControl.GetLastPosition().Y != 0) && (URRobotControl.GetLastPosition().X != 0))
{
string msg = CheckEpsonPoint(URRobotControl.GetLastPosition());
if (!msg.Equals(""))
{
WarnMsg = msg;
return;
}
}
if (IsFirstStart) if (IsFirstStart)
{ {
if (BoardManager.CurrBoard != null && BoardManager.CurrBoard.pointList.Count > 0) if (BoardManager.CurrBoard != null && BoardManager.CurrBoard.pointList.Count > 0)
...@@ -551,10 +551,8 @@ namespace URSoldering.DeviceLibrary ...@@ -551,10 +551,8 @@ namespace URSoldering.DeviceLibrary
int maxTemp = BoardManager.CurrBoard.pointList[0].preheatTemperatureMax; int maxTemp = BoardManager.CurrBoard.pointList[0].preheatTemperatureMax;
int minTemp = BoardManager.CurrBoard.pointList[0].preheatTemperatureMin; int minTemp = BoardManager.CurrBoard.pointList[0].preheatTemperatureMin;
SolderingManager.setTemp(temp.ToString()); SolderingManager.setTemp(temp.ToString());
//等待温度到达,并达到指定时间
WeldLog("设置烙铁温度" + temp + ""); WeldLog("设置烙铁温度" + temp + "");
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTemperature(temp, maxTemp, minTemp)); WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTemperature(temp, maxTemp, minTemp));
//WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTime(time));
} }
} }
MoveToOrg(); MoveToOrg();
...@@ -564,8 +562,8 @@ namespace URSoldering.DeviceLibrary ...@@ -564,8 +562,8 @@ namespace URSoldering.DeviceLibrary
if (IsFirstStart) if (IsFirstStart)
{ {
IsFirstStart = false; IsFirstStart = false;
WeldMoveStep.NextMoveStep(MoveStep.Home_3_StartClear); WeldMoveStep.NextMoveStep(MoveStep.Home_3_StartClear);
SendWireUpToClear1(); SendWireUpToClear1();
} }
else else
{ {
...@@ -573,16 +571,16 @@ namespace URSoldering.DeviceLibrary ...@@ -573,16 +571,16 @@ namespace URSoldering.DeviceLibrary
WarnMsg = ""; WarnMsg = "";
WeldMoveStep.EndMove(); WeldMoveStep.EndMove();
} }
} }
else if (WeldMoveStep.moveStep.Equals(MoveStep.Home_3_StartClear)) else if (WeldMoveStep.moveStep.Equals(MoveStep.Home_3_StartClear))
{ {
WeldMoveStep.NextMoveStep(MoveStep.Home_4_ToClear2); WeldMoveStep.NextMoveStep(MoveStep.Home_4_ToClear2);
MoveToClear2(RobotConfig.ClearMSenconds); MoveToClear2(RobotConfig.ClearMSenconds);
} }
else if (WeldMoveStep.moveStep.Equals(MoveStep.Home_4_ToClear2)) else if (WeldMoveStep.moveStep.Equals(MoveStep.Home_4_ToClear2))
{ {
WeldMoveStep.NextMoveStep(MoveStep.Home_5_ToOrg); WeldMoveStep.NextMoveStep(MoveStep.Home_5_ToOrg);
MoveToOrg(); MoveToOrg();
} }
else if (WeldMoveStep.moveStep.Equals(MoveStep.Home_5_ToOrg)) else if (WeldMoveStep.moveStep.Equals(MoveStep.Home_5_ToOrg))
...@@ -590,108 +588,69 @@ namespace URSoldering.DeviceLibrary ...@@ -590,108 +588,69 @@ namespace URSoldering.DeviceLibrary
WeldLog("回原点结束,清洗完成 ,送丝上升到位 "); WeldLog("回原点结束,清洗完成 ,送丝上升到位 ");
WarnMsg = ""; WarnMsg = "";
WeldMoveStep.EndMove(); WeldMoveStep.EndMove();
} }
} }
private static void MoveToPoint(WeldPointInfo p, bool IsHigh) private static void MoveToPoint(WeldPointInfo p, bool IsHigh)
{ {
SendWireWork(true); SendWireWork(true);
SolderingDown(true); SolderingDown(true);
URPointValue point = new URPointValue(p.RobotX, p.RoobtY, p.RobotZ, p.RobotRX, p.RobotRY, p.RobotRZ); URPointValue point = p.GetURPoint();
WeldLog("移动到焊点【" + WeldMoveStep.CurrPoint.pointName + "】:" + point.ToShowStr()); WeldLog("移动到焊点【" + WeldMoveStep.CurrPoint.pointName + "】:" + point.ToShowStr());
URRobotControl.MoveTo(point, isHighSpeed); URRobotControl.MoveTo(point, isHighSpeed);
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitRobotPoint(point)); WeldMoveStep.WaitList.Add(WaitResultInfo.WaitRobotPoint(point));
} }
private static void MoveToOrg() private static void MoveToOrg()
{ {
SolderingUp(true); SolderingUp(true);
SendWireWork(true); SendWireWork(true);
if (HomePoint.X != 0 && HomePoint.Y != 0 && HomePoint.Z != 0 ) WeldLog("送丝上升,机械臂走到待机点 ");
{ URRobotControl.MoveTo(HomePoint, isHighSpeed);
WeldLog("送丝上升,机械臂走到待机点 "); WeldMoveStep.WaitList.Add(WaitResultInfo.WaitRobotPoint(HomePoint));
URRobotControl.MoveTo(HomePoint,isHighSpeed);
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitRobotPoint(HomePoint));
}
} }
private static void SendWireUpToClear1() private static void SendWireUpToClear1()
{ {
SolderingUp(true ); SolderingUp(true);
SendWireClear(true); SendWireClear(true);
Thread.Sleep(100); Thread.Sleep(100);
WeldCount = 0; WeldCount = 0;
if (Clear1Point.X != 0 && Clear1Point.Y != 0 && Clear1Point.Z != 0) WeldLog("送丝上升,打开清洗装置,机械臂走到清洗点1 ");
{ URRobotControl.MoveTo(Clear1Point, isHighSpeed);
WeldLog("送丝上升,打开清洗装置,机械臂走到清洗点1 "); WeldMoveStep.WaitList.Add(WaitResultInfo.WaitRobotPoint(Clear1Point));
URRobotControl.MoveTo(Clear1Point, isHighSpeed);
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitRobotPoint(Clear1Point));
}
} }
private static void MoveToClear2(int mSenconds) private static void MoveToClear2(int mSenconds)
{ {
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTime(mSenconds)); WeldMoveStep.WaitList.Add(WaitResultInfo.WaitTime(mSenconds));
if (Clear2Point.X != 0 && Clear2Point.Y != 0 && Clear2Point.Z != 0) WeldLog("机械臂走到清洗点2 ,打开清洗装置,清洗时间:" + mSenconds + " ");
{ URRobotControl.MoveTo(Clear2Point, isHighSpeed);
WeldLog("机械臂走到清洗点2 ,打开清洗装置,清洗时间:" + mSenconds + " "); WeldMoveStep.WaitList.Add(WaitResultInfo.WaitRobotPoint(Clear2Point));
URRobotControl.MoveTo(Clear2Point, isHighSpeed);
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitRobotPoint(Clear1Point));
}
} }
//更新原点 //更新原点
public static void UpdateOrgPoint(URPointValue point) public static void UpdateOrgPoint(URPointValue point)
{ {
WeldRobotBean.HomePoint = point; WeldRobotBean.HomePoint = point;
string str = point.ToJosonStr(); string str = point.ToJosonStr();
ConfigAppSettings.SaveValue(Setting_Init.Soldering_HomePoint, str); ConfigAppSettings.SaveValue(Setting_Init.Soldering_HomePoint, str);
} }
public static void UpdateClear1Point(URPointValue point) public static void UpdateClear1Point(URPointValue point)
{ {
WeldRobotBean.Clear1Point = point; WeldRobotBean.Clear1Point = point;
string str = point.ToJosonStr(); string str = point.ToJosonStr();
ConfigAppSettings.SaveValue(Setting_Init.Soldering_Clear1Point, str); ConfigAppSettings.SaveValue(Setting_Init.Soldering_Clear1Point, str);
} }
public static void UpdateClear2Point(URPointValue point) public static void UpdateClear2Point(URPointValue point)
{ {
WeldRobotBean.Clear2Point = point; WeldRobotBean.Clear2Point = point;
string str = point.ToJosonStr(); string str = point.ToJosonStr();
ConfigAppSettings.SaveValue(Setting_Init.Soldering_Clear2Point, str); ConfigAppSettings.SaveValue(Setting_Init.Soldering_Clear2Point, str);
} }
/// <summary> /// <summary>
/// 验证机器人是否超出活动范围 /// 验证机器人是否超出活动范围
/// </summary> /// </summary>
/// <param name="point"></param> /// <param name="point"></param>
/// <returns></returns> /// <returns></returns>
public static string CheckEpsonPoint(URPointValue point) public static string CheckEpsonPoint(URPointValue point)
{ {
//if (EpsonXMin < EpsonXMax)
//{
// if (point.X < EpsonXMin || point.X > EpsonXMax)
// {
// return "机械臂X轴超出活动范围";
// }
//}
//if (EpsonYMin < EpsonYMax)
//{
// if (point.Y < EpsonYMin || point.Y > EpsonYMax)
// {
// return "机械臂Y轴超出活动范围";
// }
//}
//if (EpsonZMin < EpsonZMax)
//{
// if (point.Z < EpsonZMin || point.Z > EpsonZMax)
// {
// return "机械臂Z轴超出活动范围";
// }
//}
//if (EpsonUMin < EpsonUMax)
//{
// if (point.U < EpsonUMin || point.U > EpsonUMax)
// {
// return "机械臂U轴超出活动范围";
// }
//}
return ""; return "";
} }
} }
......
...@@ -39,6 +39,7 @@ namespace URSoldering.DeviceLibrary ...@@ -39,6 +39,7 @@ namespace URSoldering.DeviceLibrary
{ {
return "没有找到电路板信息,无法开始焊接"; return "没有找到电路板信息,无法开始焊接";
} }
//记录焊接板子数量 //记录焊接板子数量
WeldCount++; WeldCount++;
...@@ -68,19 +69,7 @@ namespace URSoldering.DeviceLibrary ...@@ -68,19 +69,7 @@ namespace URSoldering.DeviceLibrary
} }
else if (WeldMoveStep.moveStep.Equals(MoveStep.W01_RobotMoveToPoint)) else if (WeldMoveStep.moveStep.Equals(MoveStep.W01_RobotMoveToPoint))
{ {
if (WeldMoveStep.IsFirstPoint())
{
for (int i = 0; i < 5; i++)
{
GetCodeFun?.Invoke();
if (RobotManager.SolderingRobot.WareCode.Equals(""))
{ Thread.Sleep(100); }
else
{
break;
}
}
}
if (WeldMoveStep.IsSlowSendWire) if (WeldMoveStep.IsSlowSendWire)
{ {
//已经慢速送丝 //已经慢速送丝
...@@ -172,8 +161,8 @@ namespace URSoldering.DeviceLibrary ...@@ -172,8 +161,8 @@ namespace URSoldering.DeviceLibrary
} }
else if (WeldMoveStep.moveStep.Equals(MoveStep.W14_AOICheck)) else if (WeldMoveStep.moveStep.Equals(MoveStep.W14_AOICheck))
{ {
AOICheckFun.Invoke(); //AOICheckFun.Invoke();
Thread.Sleep(300); //Thread.Sleep(300);
IsInWeld = false; IsInWeld = false;
if (WeldCount >= RobotConfig.ClearCount) if (WeldCount >= RobotConfig.ClearCount)
{ {
...@@ -342,6 +331,11 @@ namespace URSoldering.DeviceLibrary ...@@ -342,6 +331,11 @@ namespace URSoldering.DeviceLibrary
} }
public static void SolderingUp(bool isWait) public static void SolderingUp(bool isWait)
{ {
if (RobotBean.KNDIOValue(IO_Type.Soldering_Down).Equals(IO_VALUE.LOW) &&
RobotBean.KNDIOValue(IO_Type.Soldering_Up).Equals(IO_VALUE.HIGH))
{
return;
}
RobotBean.KNDIOMove(IO_Type.Soldering_Down, IO_VALUE.LOW); RobotBean.KNDIOMove(IO_Type.Soldering_Down, IO_VALUE.LOW);
RobotBean.KNDIOMove(IO_Type.Soldering_Up, IO_VALUE.HIGH); RobotBean.KNDIOMove(IO_Type.Soldering_Up, IO_VALUE.HIGH);
if (isWait) if (isWait)
...@@ -353,6 +347,11 @@ namespace URSoldering.DeviceLibrary ...@@ -353,6 +347,11 @@ namespace URSoldering.DeviceLibrary
public static void SendWireWork(bool isWait) public static void SendWireWork(bool isWait)
{ {
if (RobotBean.KNDIOValue(IO_Type.SendWire_Clear).Equals(IO_VALUE.LOW) &&
RobotBean.KNDIOValue(IO_Type.SendWire_Work).Equals(IO_VALUE.HIGH))
{
return;
}
RobotBean.KNDIOMove(IO_Type.SendWire_Clear, IO_VALUE.LOW); RobotBean.KNDIOMove(IO_Type.SendWire_Clear, IO_VALUE.LOW);
RobotBean.KNDIOMove(IO_Type.SendWire_Work, IO_VALUE.HIGH); RobotBean.KNDIOMove(IO_Type.SendWire_Work, IO_VALUE.HIGH);
if (isWait) if (isWait)
...@@ -363,12 +362,17 @@ namespace URSoldering.DeviceLibrary ...@@ -363,12 +362,17 @@ namespace URSoldering.DeviceLibrary
} }
public static void SendWireClear(bool isWait) public static void SendWireClear(bool isWait)
{ {
RobotBean.KNDIOMove(IO_Type.SendWire_Clear, IO_VALUE.LOW); if (RobotBean.KNDIOValue(IO_Type.SendWire_Work).Equals(IO_VALUE.LOW) &&
RobotBean.KNDIOMove(IO_Type.SendWire_Work, IO_VALUE.HIGH); RobotBean.KNDIOValue(IO_Type.SendWire_Clear).Equals(IO_VALUE.HIGH))
{
return;
}
RobotBean.KNDIOMove(IO_Type.SendWire_Clear, IO_VALUE.HIGH);
RobotBean.KNDIOMove(IO_Type.SendWire_Work, IO_VALUE.LOW);
if (isWait) if (isWait)
{ {
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SendWire_Clear, IO_VALUE.LOW)); WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SendWire_Clear, IO_VALUE.HIGH));
WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SendWire_Work, IO_VALUE.HIGH)); WeldMoveStep.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.SendWire_Work, IO_VALUE.LOW));
} }
} }
private static DateTime preGetStatusTime = DateTime.Now; private static DateTime preGetStatusTime = DateTime.Now;
......
...@@ -113,6 +113,13 @@ namespace URSoldering.DeviceLibrary ...@@ -113,6 +113,13 @@ namespace URSoldering.DeviceLibrary
{ {
return false; return false;
} }
foreach(WeldPointInfo p in weldPointList)
{
if (!URRobotControl.PointIsValid(p.GetURPoint()))
{
return false;
}
}
CurrPoint = weldPointList[CurrPointIndex]; CurrPoint = weldPointList[CurrPointIndex];
PointTime = new PointWeldTime(); PointTime = new PointWeldTime();
ResetCount = 0; ResetCount = 0;
......
...@@ -33,7 +33,7 @@ DO,送丝电机启动,SendWireStart,106,192.168.10.11,0,送丝电机启动,Y07,DO-07,0 ...@@ -33,7 +33,7 @@ DO,送丝电机启动,SendWireStart,106,192.168.10.11,0,送丝电机启动,Y07,DO-07,0
,故障指示灯(红色),AlarmSingle,115,192.168.10.11,0,故障指示灯(红色),Y16,DO-16,0 ,故障指示灯(红色),AlarmSingle,115,192.168.10.11,0,故障指示灯(红色),Y16,DO-16,0
,,,,,,,,, ,,,,,,,,,
PRO,尤傲机器人IP,UR_IP,192.168.10.13,,,,,, PRO,尤傲机器人IP,UR_IP,192.168.10.13,,,,,,
PRO,焊接多少块板子后,清洗烙铁,ClearCount,1,,,,,, PRO,焊接多少块板子后,清洗烙铁,ClearCount,10,,,,,,
PRO,清洗IO的毫秒数,ClearMSenconds,3000,,,,,, PRO,清洗IO的毫秒数,ClearMSenconds,3000,,,,,,
PRO,JBC烙铁端口号,JBC_Soldering_Port,COM2,,,,,, PRO,JBC烙铁端口号,JBC_Soldering_Port,COM2,,,,,,
PRO,JBC烙铁编号,JBC_Soldering_Num,1,,,,,, PRO,JBC烙铁编号,JBC_Soldering_Num,1,,,,,,
......
...@@ -28,13 +28,13 @@ namespace URSoldering.DeviceLibrary ...@@ -28,13 +28,13 @@ namespace URSoldering.DeviceLibrary
/// <summary> /// <summary>
/// 机器人焊接时Z轴的高点 /// 机器人焊接时Z轴的高点
/// </summary> /// </summary>
public double ZHighValue { get; set; } public double ZHighValue { get; set; }
/// <summary> /// <summary>
/// 工位编号,夹具编号(每一个程序需要配置四个夹具的位置,防止位置偏差) /// 工位编号,夹具编号(每一个程序需要配置四个夹具的位置,防止位置偏差)
/// </summary> /// </summary>
public int StationNum { get; set; } public int StationNum { get; set; }
/// <summary> /// <summary>
/// 料号 /// 料号
/// </summary> /// </summary>
...@@ -43,7 +43,7 @@ namespace URSoldering.DeviceLibrary ...@@ -43,7 +43,7 @@ namespace URSoldering.DeviceLibrary
/// 电路板名称 /// 电路板名称
/// </summary> /// </summary>
public string boardName { get; set; } public string boardName { get; set; }
/// <summary> /// <summary>
/// 宽度 /// 宽度
/// </summary> /// </summary>
...@@ -79,11 +79,11 @@ namespace URSoldering.DeviceLibrary ...@@ -79,11 +79,11 @@ namespace URSoldering.DeviceLibrary
/// <summary> /// <summary>
/// 已经焊接次数,每次修改板子都会重置 /// 已经焊接次数,每次修改板子都会重置
/// </summary> /// </summary>
public int solderingCount { get; set; } public int solderingCount { get; set; }
/// <summary> /// <summary>
/// 焊接的时间,每次修改板子都会重置 /// 焊接的时间,每次修改板子都会重置
/// </summary> /// </summary>
public double solderingTime { get; set; } public double solderingTime { get; set; }
/// <summary> /// <summary>
/// 已经焊接次数,不重置 /// 已经焊接次数,不重置
/// </summary> /// </summary>
...@@ -96,7 +96,7 @@ namespace URSoldering.DeviceLibrary ...@@ -96,7 +96,7 @@ namespace URSoldering.DeviceLibrary
public string GetDes() public string GetDes()
{ {
return " 长度:" + boardLength + ",宽度:" + boardWidth + ",焊点数量:" + this.pointList.Count; return " 长度:" + boardLength + ",宽度:" + boardWidth + ",焊点数量:" + this.pointList.Count;
} }
public Image GetImage() public Image GetImage()
{ {
...@@ -190,7 +190,7 @@ namespace URSoldering.DeviceLibrary ...@@ -190,7 +190,7 @@ namespace URSoldering.DeviceLibrary
public double RobotRX { get; set; } public double RobotRX { get; set; }
public double RobotRY { get; set; } public double RobotRY { get; set; }
public double RobotRZ { get; set; } public double RobotRZ { get; set; }
/// <summary> /// <summary>
/// 预热温度 /// 预热温度
/// </summary> /// </summary>
...@@ -202,7 +202,7 @@ namespace URSoldering.DeviceLibrary ...@@ -202,7 +202,7 @@ namespace URSoldering.DeviceLibrary
/// <summary> /// <summary>
/// 预热温度下限 /// 预热温度下限
/// </summary> /// </summary>
public int preheatTemperatureMin { get; set; } public int preheatTemperatureMin { get; set; }
/// <summary> /// <summary>
/// 预热时间(秒) /// 预热时间(秒)
/// </summary> /// </summary>
...@@ -255,5 +255,11 @@ namespace URSoldering.DeviceLibrary ...@@ -255,5 +255,11 @@ namespace URSoldering.DeviceLibrary
/// </summary> /// </summary>
public int ClearTime { get; set; } public int ClearTime { get; set; }
public URPointValue GetURPoint()
{
URPointValue p = new URPointValue(RobotX, RoobtY, RobotZ, RobotRX, RobotRY, RobotRZ);
return p;
}
} }
} }
...@@ -178,7 +178,7 @@ namespace URSoldering.DeviceLibrary ...@@ -178,7 +178,7 @@ namespace URSoldering.DeviceLibrary
} }
else else
{ {
LogUtil.info("烙铁未初始化,调用了setTemp直接返回false"); LogUtil.debug("烙铁未初始化,调用了setTemp直接返回false");
return false; return false;
} }
} }
......
...@@ -18,7 +18,7 @@ namespace URSoldering.DeviceLibrary ...@@ -18,7 +18,7 @@ namespace URSoldering.DeviceLibrary
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static TcpClient controlTcp = new TcpClient(); public static TcpClient controlTcp = new TcpClient();
public static URPointValue LastPoint = new URPointValue(); public static URPointValue LastPoint = new URPointValue();
public static URPointValue LastSendPoint = new URPointValue();
public static string RobotIp = ""; public static string RobotIp = "";
public static int ControlPort = 29999; public static int ControlPort = 29999;
...@@ -54,7 +54,7 @@ namespace URSoldering.DeviceLibrary ...@@ -54,7 +54,7 @@ namespace URSoldering.DeviceLibrary
/// 上一次启动的时间,UR机械臂启动需要时间,默认需要3分钟,若三分钟后还没有链接,需要重新启动 /// 上一次启动的时间,UR机械臂启动需要时间,默认需要3分钟,若三分钟后还没有链接,需要重新启动
/// </summary> /// </summary>
private static DateTime PreStartTime = DateTime.Now; private static DateTime PreStartTime = DateTime.Now;
private static int StartTimeOutSeconds = 10000; private static int StartTimeOutSeconds = 20000;
public static string WarnMsg = ""; public static string WarnMsg = "";
private static System.Timers.Timer reconnectTimer = null; private static System.Timers.Timer reconnectTimer = null;
...@@ -452,8 +452,22 @@ namespace URSoldering.DeviceLibrary ...@@ -452,8 +452,22 @@ namespace URSoldering.DeviceLibrary
public static void LockAxis() public static void LockAxis()
{ {
} }
public static bool PointIsValid(URPointValue point)
{
if (point.X != 0 && point.Y != 0 && point.Z != 0)
{
return true;
}
return false;
}
public static void MoveTo(URPointValue point, bool isHigh) public static void MoveTo(URPointValue point, bool isHigh)
{ {
if (!PointIsValid(point))
{
LogUtil.info(LogName + "试图移动到:" + point.ToShowStr()+",此坐标无效,直接返回");
return;
}
//movep(p[0.062, -0.030, 0.325, 0.0299, 2.2263, 2.2171], a = 1.2, v = 0.25, r = 0) //movep(p[0.062, -0.030, 0.325, 0.0299, 2.2263, 2.2171], a = 1.2, v = 0.25, r = 0)
//movej([0, 1.57, -1.57, 3.14, -1.57, 1.57],a = 1.4, v = 1.05, t = 0, r = 0) //movej([0, 1.57, -1.57, 3.14, -1.57, 1.57],a = 1.4, v = 1.05, t = 0, r = 0)
...@@ -475,7 +489,8 @@ namespace URSoldering.DeviceLibrary ...@@ -475,7 +489,8 @@ namespace URSoldering.DeviceLibrary
{ {
//LogUtil.info(LogName + "试图移动到:" + point.ToShowStr()); //LogUtil.info(LogName + "试图移动到:" + point.ToShowStr());
} }
URRobotClient.LastMoveCMD = moveCmd; URRobotClient.LastMoveCMD = moveCmd;
LastSendPoint = point;
} }
public static void MoveTo(URPointValue point) public static void MoveTo(URPointValue point)
{ {
......
...@@ -51,8 +51,6 @@ ...@@ -51,8 +51,6 @@
this.dataGridViewImageColumn2 = new System.Windows.Forms.DataGridViewImageColumn(); this.dataGridViewImageColumn2 = new System.Windows.Forms.DataGridViewImageColumn();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.panPoint = new System.Windows.Forms.Panel(); this.panPoint = new System.Windows.Forms.Panel();
this.panVideo = new System.Windows.Forms.Panel();
this.hWVideo = new HalconDotNet.HWindowControl();
this.panBoard = new System.Windows.Forms.Panel(); this.panBoard = new System.Windows.Forms.Panel();
this.picBoard = new System.Windows.Forms.PictureBox(); this.picBoard = new System.Windows.Forms.PictureBox();
this.gbOriginInfo = new System.Windows.Forms.GroupBox(); this.gbOriginInfo = new System.Windows.Forms.GroupBox();
...@@ -154,7 +152,6 @@ ...@@ -154,7 +152,6 @@
((System.ComponentModel.ISupportInitialize)(this.picZAdd)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picZAdd)).BeginInit();
this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip2.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.panVideo.SuspendLayout();
this.panBoard.SuspendLayout(); this.panBoard.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picBoard)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picBoard)).BeginInit();
this.gbOriginInfo.SuspendLayout(); this.gbOriginInfo.SuspendLayout();
...@@ -335,7 +332,6 @@ ...@@ -335,7 +332,6 @@
// //
this.panel1.AutoScroll = true; this.panel1.AutoScroll = true;
this.panel1.Controls.Add(this.panPoint); this.panel1.Controls.Add(this.panPoint);
this.panel1.Controls.Add(this.panVideo);
this.panel1.Controls.Add(this.panBoard); this.panel1.Controls.Add(this.panBoard);
this.panel1.Controls.Add(this.groupBox2); this.panel1.Controls.Add(this.groupBox2);
this.panel1.Controls.Add(this.label25); this.panel1.Controls.Add(this.label25);
...@@ -362,31 +358,6 @@ ...@@ -362,31 +358,6 @@
this.panPoint.Size = new System.Drawing.Size(869, 267); this.panPoint.Size = new System.Drawing.Size(869, 267);
this.panPoint.TabIndex = 321; this.panPoint.TabIndex = 321;
// //
// panVideo
//
this.panVideo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panVideo.Controls.Add(this.hWVideo);
this.panVideo.Location = new System.Drawing.Point(898, 202);
this.panVideo.Name = "panVideo";
this.panVideo.Size = new System.Drawing.Size(485, 424);
this.panVideo.TabIndex = 320;
//
// hWVideo
//
this.hWVideo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.hWVideo.BackColor = System.Drawing.Color.Black;
this.hWVideo.BorderColor = System.Drawing.Color.Black;
this.hWVideo.ImagePart = new System.Drawing.Rectangle(0, 0, 640, 480);
this.hWVideo.Location = new System.Drawing.Point(3, 3);
this.hWVideo.MaximumSize = new System.Drawing.Size(800, 500);
this.hWVideo.Name = "hWVideo";
this.hWVideo.Size = new System.Drawing.Size(479, 418);
this.hWVideo.TabIndex = 319;
this.hWVideo.WindowSize = new System.Drawing.Size(479, 418);
//
// panBoard // panBoard
// //
this.panBoard.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.panBoard.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
...@@ -394,9 +365,9 @@ ...@@ -394,9 +365,9 @@
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.panBoard.Controls.Add(this.picBoard); this.panBoard.Controls.Add(this.picBoard);
this.panBoard.Controls.Add(this.gbOriginInfo); this.panBoard.Controls.Add(this.gbOriginInfo);
this.panBoard.Location = new System.Drawing.Point(899, 19); this.panBoard.Location = new System.Drawing.Point(898, 78);
this.panBoard.Name = "panBoard"; this.panBoard.Name = "panBoard";
this.panBoard.Size = new System.Drawing.Size(482, 136); this.panBoard.Size = new System.Drawing.Size(482, 553);
this.panBoard.TabIndex = 261; this.panBoard.TabIndex = 261;
// //
// picBoard // picBoard
...@@ -407,7 +378,7 @@ ...@@ -407,7 +378,7 @@
this.picBoard.Cursor = System.Windows.Forms.Cursors.Cross; this.picBoard.Cursor = System.Windows.Forms.Cursors.Cross;
this.picBoard.Location = new System.Drawing.Point(0, 0); this.picBoard.Location = new System.Drawing.Point(0, 0);
this.picBoard.Name = "picBoard"; this.picBoard.Name = "picBoard";
this.picBoard.Size = new System.Drawing.Size(463, 76); this.picBoard.Size = new System.Drawing.Size(463, 493);
this.picBoard.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.picBoard.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picBoard.TabIndex = 259; this.picBoard.TabIndex = 259;
this.picBoard.TabStop = false; this.picBoard.TabStop = false;
...@@ -857,7 +828,7 @@ ...@@ -857,7 +828,7 @@
this.tckSpeed.Name = "tckSpeed"; this.tckSpeed.Name = "tckSpeed";
this.tckSpeed.Size = new System.Drawing.Size(214, 45); this.tckSpeed.Size = new System.Drawing.Size(214, 45);
this.tckSpeed.TabIndex = 314; this.tckSpeed.TabIndex = 314;
this.tckSpeed.Value = 4; this.tckSpeed.Value = 4;
this.tckSpeed.ValueChanged += new System.EventHandler(this.tckSpeed_ValueChanged); this.tckSpeed.ValueChanged += new System.EventHandler(this.tckSpeed_ValueChanged);
// //
// txtRobotY // txtRobotY
...@@ -904,7 +875,7 @@ ...@@ -904,7 +875,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(1131, 170); this.label25.Location = new System.Drawing.Point(1145, 40);
this.label25.Name = "label25"; this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(30, 17); this.label25.Size = new System.Drawing.Size(30, 17);
this.label25.TabIndex = 37; this.label25.TabIndex = 37;
...@@ -914,7 +885,7 @@ ...@@ -914,7 +885,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(1001, 170); this.label24.Location = new System.Drawing.Point(1015, 40);
this.label24.Name = "label24"; this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(30, 17); this.label24.Size = new System.Drawing.Size(30, 17);
this.label24.TabIndex = 36; this.label24.TabIndex = 36;
...@@ -1237,7 +1208,7 @@ ...@@ -1237,7 +1208,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(943, 167); this.txtBoardLength.Location = new System.Drawing.Point(957, 37);
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);
...@@ -1327,7 +1298,7 @@ ...@@ -1327,7 +1298,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(1073, 167); this.txtBoardWidth.Location = new System.Drawing.Point(1087, 37);
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);
...@@ -1338,7 +1309,7 @@ ...@@ -1338,7 +1309,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(917, 170); this.label3.Location = new System.Drawing.Point(931, 40);
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;
...@@ -1348,7 +1319,7 @@ ...@@ -1348,7 +1319,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(1051, 170); this.label4.Location = new System.Drawing.Point(1065, 40);
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;
...@@ -1359,7 +1330,7 @@ ...@@ -1359,7 +1330,7 @@
this.btnOpenFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btnOpenFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnOpenFile.FlatAppearance.BorderSize = 0; this.btnOpenFile.FlatAppearance.BorderSize = 0;
this.btnOpenFile.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnOpenFile.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenFile.Location = new System.Drawing.Point(1182, 161); this.btnOpenFile.Location = new System.Drawing.Point(1196, 31);
this.btnOpenFile.Name = "btnOpenFile"; this.btnOpenFile.Name = "btnOpenFile";
this.btnOpenFile.Size = new System.Drawing.Size(100, 35); this.btnOpenFile.Size = new System.Drawing.Size(100, 35);
this.btnOpenFile.TabIndex = 260; this.btnOpenFile.TabIndex = 260;
...@@ -1426,7 +1397,6 @@ ...@@ -1426,7 +1397,6 @@
this.contextMenuStrip2.ResumeLayout(false); this.contextMenuStrip2.ResumeLayout(false);
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel1.PerformLayout(); this.panel1.PerformLayout();
this.panVideo.ResumeLayout(false);
this.panBoard.ResumeLayout(false); this.panBoard.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picBoard)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picBoard)).EndInit();
this.gbOriginInfo.ResumeLayout(false); this.gbOriginInfo.ResumeLayout(false);
...@@ -1503,8 +1473,6 @@ ...@@ -1503,8 +1473,6 @@
private System.Windows.Forms.Label lblSpeed; private System.Windows.Forms.Label lblSpeed;
private System.Windows.Forms.Label lblEpsonError; private System.Windows.Forms.Label lblEpsonError;
private System.Windows.Forms.Button btnStopDown; private System.Windows.Forms.Button btnStopDown;
private HalconDotNet.HWindowControl hWVideo;
private System.Windows.Forms.Panel panVideo;
private System.Windows.Forms.TextBox txtCode; private System.Windows.Forms.TextBox txtCode;
private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label10;
private System.Windows.Forms.Button btnPositionTest; private System.Windows.Forms.Button btnPositionTest;
......
...@@ -46,16 +46,11 @@ namespace URSoldering.Client ...@@ -46,16 +46,11 @@ namespace URSoldering.Client
this.Text = "修改程序【" + board.boardName + "】"; this.Text = "修改程序【" + board.boardName + "】";
} }
} }
private System.Timers.Timer timer1 = new System.Timers.Timer(); private System.Timers.Timer timer1 = new System.Timers.Timer();
private System.Timers.Timer usbTimer = new System.Timers.Timer();
private void FrmBoardInfo_Load(object sender, EventArgs e) private void FrmBoardInfo_Load(object sender, EventArgs e)
{ {
CheckForIllegalCrossThreadCalls = false; CheckForIllegalCrossThreadCalls = false;
usbTimer = new System.Timers.Timer();
usbTimer.AutoReset = true;
usbTimer.Enabled = false;
usbTimer.Interval = 300;
usbTimer.Elapsed += UsbTimer_Elapsed;
StepValue = 0.5; StepValue = 0.5;
tckSpeed.Value = 3; tckSpeed.Value = 3;
isFinishLoad = false; isFinishLoad = false;
...@@ -121,11 +116,7 @@ namespace URSoldering.Client ...@@ -121,11 +116,7 @@ namespace URSoldering.Client
btnSendWire.Enabled = false; btnSendWire.Enabled = false;
btnStopSend.Enabled = false; btnStopSend.Enabled = false;
} }
if (!ConfigAppSettings.GetBoolValue(Setting_Init.ISDebug))
{
UsbCameraHDevelop.OpenCamera(VideoCameraName);
}
usbTimer.Enabled = true;
isFinishLoad = true; isFinishLoad = true;
} }
...@@ -152,39 +143,7 @@ namespace URSoldering.Client ...@@ -152,39 +143,7 @@ namespace URSoldering.Client
} }
return false; return false;
} }
private int dWidth = 0;
private int dHeight = 0;
private string VideoCameraName = ConfigAppSettings.GetValue(Setting_Init.VideoCameraName);
private void UsbTimer_Elapsed(object sender, ElapsedEventArgs e)
{
try
{
if (panVideo.Visible)
{
if (UsbCameraHDevelop.IsOpen(VideoCameraName))
{
HObject ho_Image = UsbCameraHDevelop.GrabImage(VideoCameraName);
if (ho_Image != null)
{
if (dWidth <= 0)
{
HTuple width, height;
HOperatorSet.GetImageSize(ho_Image, out width, out height);
dWidth = (int)width.D;
dHeight = (int)height.D;
hWVideo.HalconWindow.SetPart(0, 0, dHeight, dWidth);
}
HOperatorSet.DispObj(ho_Image, hWVideo.HalconWindow);
}
}
}
}
catch (Exception ex)
{
LogUtil.error("获取实时出错:" + ex.ToString());
}
}
private void RobotStatus(bool isConnect) private void RobotStatus(bool isConnect)
......
...@@ -32,20 +32,20 @@ namespace URSoldering.Client ...@@ -32,20 +32,20 @@ namespace URSoldering.Client
private void btnWelding_Click(object sender, EventArgs e) private void btnWelding_Click(object sender, EventArgs e)
{ {
if (BoardManager.CurrBoard == null) //if (BoardManager.CurrBoard == null)
{ //{
if (BoardManager.boardList.Count > 0) // if (BoardManager.boardList.Count > 0)
{ // {
BoardManager.UpdateCurrBoard(BoardManager.boardList[0].boardId); // BoardManager.UpdateCurrBoard(BoardManager.boardList[0].boardId);
} // }
else // else
{ // {
MessageBox.Show("请先配置程序"); // MessageBox.Show("请先配置程序");
return; // return;
} // }
} //}
isClick = true; isClick = true;
FrmWork fw = new FrmWork(); FrmProgramSelect fw = new FrmProgramSelect();
this.Visible = false; ; this.Visible = false; ;
fw.ShowDialog(); fw.ShowDialog();
this.Visible = true; this.Visible = true;
......
...@@ -58,9 +58,9 @@ namespace URSoldering.Client ...@@ -58,9 +58,9 @@ namespace URSoldering.Client
BoardManager.UpdateCurrBoard(board.boardId); BoardManager.UpdateCurrBoard(board.boardId);
//判断程序是否配置完成 //判断程序是否配置完成
//FrmWork fw = new FrmWork(); FrmWork fw = new FrmWork();
//this.Hide(); this.Hide();
//fw.ShowDialog(); fw.ShowDialog();
} }
this.Close(); this.Close();
} }
......
...@@ -64,7 +64,7 @@ namespace URSoldering.Client ...@@ -64,7 +64,7 @@ namespace URSoldering.Client
{ {
this.txtClearTime.Text = weldPointInfo.ClearTime.ToString(); this.txtClearTime.Text = weldPointInfo.ClearTime.ToString();
} }
ShowPoint(new URPointValue(weldPointInfo.RobotX, weldPointInfo.RoobtY, weldPointInfo.RobotZ, weldPointInfo.RobotRX, weldPointInfo.RobotRY, weldPointInfo.RobotRZ)); ShowPoint(weldPointInfo.GetURPoint());
} }
private void btnSave_Click(object sender, EventArgs e) private void btnSave_Click(object sender, EventArgs e)
......
...@@ -42,9 +42,6 @@ ...@@ -42,9 +42,6 @@
System.Windows.Forms.DataVisualization.Charting.Legend legend3 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Legend legend3 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series(); System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.timer = new System.Windows.Forms.Timer(this.components); this.timer = new System.Windows.Forms.Timer(this.components);
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.hWVideo = new HalconDotNet.HWindowControl();
this.label4 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.logBox = new System.Windows.Forms.RichTextBox(); this.logBox = new System.Windows.Forms.RichTextBox();
...@@ -95,7 +92,6 @@ ...@@ -95,7 +92,6 @@
this.chartSolder = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.chartSolder = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.chartLine = new System.Windows.Forms.DataVisualization.Charting.Chart(); this.chartLine = new System.Windows.Forms.DataVisualization.Charting.Chart();
this.label7 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label();
this.groupBox5.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.axCKVisionCtrl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.axCKVisionCtrl1)).BeginInit();
...@@ -115,46 +111,6 @@ ...@@ -115,46 +111,6 @@
this.timer.Interval = 300; this.timer.Interval = 300;
this.timer.Tick += new System.EventHandler(this.timer_Tick); this.timer.Tick += new System.EventHandler(this.timer_Tick);
// //
// groupBox5
//
this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox5.Controls.Add(this.hWVideo);
this.groupBox5.Controls.Add(this.label4);
this.groupBox5.Location = new System.Drawing.Point(1155, 499);
this.groupBox5.MaximumSize = new System.Drawing.Size(800, 500);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(102, 157);
this.groupBox5.TabIndex = 316;
this.groupBox5.TabStop = false;
//
// hWVideo
//
this.hWVideo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.hWVideo.BackColor = System.Drawing.Color.Black;
this.hWVideo.BorderColor = System.Drawing.Color.Black;
this.hWVideo.ImagePart = new System.Drawing.Rectangle(0, 0, 640, 480);
this.hWVideo.Location = new System.Drawing.Point(4, 44);
this.hWVideo.Name = "hWVideo";
this.hWVideo.Size = new System.Drawing.Size(94, 108);
this.hWVideo.TabIndex = 301;
this.hWVideo.WindowSize = new System.Drawing.Size(94, 108);
//
// label4
//
this.label4.BackColor = System.Drawing.Color.MediumBlue;
this.label4.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.ForeColor = System.Drawing.Color.White;
this.label4.Location = new System.Drawing.Point(4, 11);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(134, 31);
this.label4.TabIndex = 300;
this.label4.Text = "实时视频";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// groupBox3 // groupBox3
// //
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
...@@ -209,7 +165,8 @@ ...@@ -209,7 +165,8 @@
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.button2); this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Controls.Add(this.button1); this.groupBox2.Controls.Add(this.button1);
...@@ -219,9 +176,9 @@ ...@@ -219,9 +176,9 @@
this.groupBox2.Controls.Add(this.label1); this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.lblAOIResult); this.groupBox2.Controls.Add(this.lblAOIResult);
this.groupBox2.Location = new System.Drawing.Point(1155, 62); this.groupBox2.Location = new System.Drawing.Point(1155, 62);
this.groupBox2.MaximumSize = new System.Drawing.Size(800, 500); this.groupBox2.MaximumSize = new System.Drawing.Size(1000, 1000);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(99, 436); this.groupBox2.Size = new System.Drawing.Size(99, 595);
this.groupBox2.TabIndex = 269; this.groupBox2.TabIndex = 269;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
// //
...@@ -256,7 +213,7 @@ ...@@ -256,7 +213,7 @@
this.axCKVisionCtrl1.Location = new System.Drawing.Point(4, 43); this.axCKVisionCtrl1.Location = new System.Drawing.Point(4, 43);
this.axCKVisionCtrl1.Name = "axCKVisionCtrl1"; this.axCKVisionCtrl1.Name = "axCKVisionCtrl1";
this.axCKVisionCtrl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axCKVisionCtrl1.OcxState"))); this.axCKVisionCtrl1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axCKVisionCtrl1.OcxState")));
this.axCKVisionCtrl1.Size = new System.Drawing.Size(91, 389); this.axCKVisionCtrl1.Size = new System.Drawing.Size(91, 548);
this.axCKVisionCtrl1.TabIndex = 306; this.axCKVisionCtrl1.TabIndex = 306;
// //
// lblCodeResult // lblCodeResult
...@@ -265,7 +222,7 @@ ...@@ -265,7 +222,7 @@
this.lblCodeResult.AutoSize = true; this.lblCodeResult.AutoSize = true;
this.lblCodeResult.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblCodeResult.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblCodeResult.ForeColor = System.Drawing.Color.Blue; this.lblCodeResult.ForeColor = System.Drawing.Color.Blue;
this.lblCodeResult.Location = new System.Drawing.Point(183, 13); this.lblCodeResult.Location = new System.Drawing.Point(183, 172);
this.lblCodeResult.Name = "lblCodeResult"; this.lblCodeResult.Name = "lblCodeResult";
this.lblCodeResult.Size = new System.Drawing.Size(107, 25); this.lblCodeResult.Size = new System.Drawing.Size(107, 25);
this.lblCodeResult.TabIndex = 305; this.lblCodeResult.TabIndex = 305;
...@@ -301,7 +258,7 @@ ...@@ -301,7 +258,7 @@
this.lblAOIResult.AutoSize = true; this.lblAOIResult.AutoSize = true;
this.lblAOIResult.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblAOIResult.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblAOIResult.ForeColor = System.Drawing.Color.Blue; this.lblAOIResult.ForeColor = System.Drawing.Color.Blue;
this.lblAOIResult.Location = new System.Drawing.Point(183, 14); this.lblAOIResult.Location = new System.Drawing.Point(183, 173);
this.lblAOIResult.Name = "lblAOIResult"; this.lblAOIResult.Name = "lblAOIResult";
this.lblAOIResult.Size = new System.Drawing.Size(77, 25); this.lblAOIResult.Size = new System.Drawing.Size(77, 25);
this.lblAOIResult.TabIndex = 301; this.lblAOIResult.TabIndex = 301;
...@@ -802,7 +759,6 @@ ...@@ -802,7 +759,6 @@
this.ClientSize = new System.Drawing.Size(1276, 741); this.ClientSize = new System.Drawing.Size(1276, 741);
this.Controls.Add(this.gbBoardInfo); this.Controls.Add(this.gbBoardInfo);
this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1); this.Controls.Add(this.groupBox1);
...@@ -812,7 +768,6 @@ ...@@ -812,7 +768,6 @@
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmWelding_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmWelding_FormClosing);
this.Load += new System.EventHandler(this.FrmWelding_Load); this.Load += new System.EventHandler(this.FrmWelding_Load);
this.Shown += new System.EventHandler(this.FrmWork_Shown); this.Shown += new System.EventHandler(this.FrmWork_Shown);
this.groupBox5.ResumeLayout(false);
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout(); this.groupBox3.PerformLayout();
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
...@@ -863,9 +818,6 @@ ...@@ -863,9 +818,6 @@
private System.Windows.Forms.ListView listPoint; private System.Windows.Forms.ListView listPoint;
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.CheckBox chbXunHuan; private System.Windows.Forms.CheckBox chbXunHuan;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Label label4;
private HalconDotNet.HWindowControl hWVideo;
private System.Windows.Forms.Button btnBlow; private System.Windows.Forms.Button btnBlow;
private System.Windows.Forms.Label lblCodeResult; private System.Windows.Forms.Label lblCodeResult;
private AxCKVisionCtrlLib.AxCKVisionCtrl axCKVisionCtrl1; private AxCKVisionCtrlLib.AxCKVisionCtrl axCKVisionCtrl1;
......
...@@ -28,15 +28,14 @@ namespace URSoldering.Client ...@@ -28,15 +28,14 @@ namespace URSoldering.Client
Dictionary<string, IOTextControl> DIControlList = new Dictionary<string, IOTextControl>(); Dictionary<string, IOTextControl> DIControlList = new Dictionary<string, IOTextControl>();
Dictionary<string, IOTextControl> DOControlList = new Dictionary<string, IOTextControl>(); Dictionary<string, IOTextControl> DOControlList = new Dictionary<string, IOTextControl>();
private bool isInitOk = false; private bool isInitOk = false;
private System.Timers.Timer usbTimer = new System.Timers.Timer();
private void FrmWelding_Load(object sender, EventArgs e) private void FrmWelding_Load(object sender, EventArgs e)
{ {
lblCodeResult.Visible = false; lblCodeResult.Visible = false;
lblAOIResult.Visible = false; lblAOIResult.Visible = false;
LoadListPoint(); LoadListPoint();
//LoadIOList();
ClearMsg();
Robot = RobotManager.SolderingRobot; Robot = RobotManager.SolderingRobot;
WeldRobotBean.AOICheckFun += AOICheck; WeldRobotBean.AOICheckFun += AOICheck;
//WeldRobotBean.GetCodeFun += GetCode; //WeldRobotBean.GetCodeFun += GetCode;
...@@ -47,12 +46,7 @@ namespace URSoldering.Client ...@@ -47,12 +46,7 @@ namespace URSoldering.Client
this.WindowState = FormWindowState.Maximized; this.WindowState = FormWindowState.Maximized;
this.chbHigh.Checked = WeldRobotBean.isHighSpeed; this.chbHigh.Checked = WeldRobotBean.isHighSpeed;
usbTimer = new System.Timers.Timer();
usbTimer.AutoReset = true;
usbTimer.Enabled = false;
usbTimer.Interval = 300;
usbTimer.Elapsed += UsbTimer_Elapsed;
Robot = RobotManager.SolderingRobot; Robot = RobotManager.SolderingRobot;
//StartRun(); //StartRun();
isInitOk = true; isInitOk = true;
...@@ -63,7 +57,7 @@ namespace URSoldering.Client ...@@ -63,7 +57,7 @@ namespace URSoldering.Client
this.Close(); this.Close();
} }
this.Text = "程序【" + BoardManager.CurrBoard.boardName + "】工作"; this.Text = "程序【" + BoardManager.CurrBoard.boardName + "】工作";
// LoadPoint(BoardManager.CurrBoard, -1); LoadPoint(BoardManager.CurrBoard, -1);
this.btnChange.Focus(); this.btnChange.Focus();
...@@ -266,7 +260,7 @@ namespace URSoldering.Client ...@@ -266,7 +260,7 @@ namespace URSoldering.Client
catch (Exception ex) catch (Exception ex)
{ {
} }
if (id != board.boardId || currWeldIndex == -3 || currWeldIndex >= -1) if (id != board.boardId || currWeldIndex == -3 || currWeldIndex .Equals( -1))
{ {
this.lblPointCount.Text = board.pointList.Count.ToString(); this.lblPointCount.Text = board.pointList.Count.ToString();
this.lblProName.Text = board.boardName; this.lblProName.Text = board.boardName;
...@@ -385,45 +379,7 @@ namespace URSoldering.Client ...@@ -385,45 +379,7 @@ namespace URSoldering.Client
btnStart.Text = "复位"; btnStart.Text = "复位";
} }
} }
private int dWidth = 0;
private int dHeight = 0;
private void UsbTimer_Elapsed(object sender, ElapsedEventArgs e)
{
//try
//{
// if (WeldRobotBean.ISRun &&
// (WeldRobotBean.WeldMoveStep.moveType.Equals(MoveType.Weld)||
// WeldRobotBean.WeldMoveStep.moveType.Equals(MoveType.GoHome)))
// {
// if (UsbCameraHDevelop.IsOpen(VideoCameraName))
// {
// HObject ho_Image = UsbCameraHDevelop.GrabImage(VideoCameraName);
// if (ho_Image != null)
// {
// if (dWidth <= 0)
// {
// HTuple width, height;
// HOperatorSet.GetImageSize(ho_Image, out width, out height);
// dWidth = (int)width.D;
// dHeight = (int)height.D;
// hWVideo.HalconWindow.SetPart(0, 0, dHeight, dWidth);
// }
// HOperatorSet.DispObj(ho_Image, hWVideo.HalconWindow);
// }
// }
// }
//}
//catch (Exception ex)
//{
// LogUtil.error("获取实时出错:" + ex.ToString());
//}
}
private void ClearMsg()
{
}
private void timer_Tick(object sender, EventArgs e) private void timer_Tick(object sender, EventArgs e)
{ {
ActualTime(null, null); ActualTime(null, null);
...@@ -508,7 +464,7 @@ namespace URSoldering.Client ...@@ -508,7 +464,7 @@ namespace URSoldering.Client
this.listPoint.Items.Clear(); this.listPoint.Items.Clear();
//LoadPoint(WeldRobotBean.WeldMoveStep.currBoard, -1); //LoadPoint(WeldRobotBean.WeldMoveStep.currBoard, -1);
} }
else if (WeldRobotBean.IsInWeld) else if (WeldRobotBean.WeldMoveStep.moveType.Equals(MoveType.Weld))
{ {
lblMsg.ForeColor = Color.Green; lblMsg.ForeColor = Color.Green;
lblMsg.Text = "程序【" + WeldRobotBean.WeldMoveStep.currBoard.boardName + "】焊接中"; lblMsg.Text = "程序【" + WeldRobotBean.WeldMoveStep.currBoard.boardName + "】焊接中";
...@@ -929,8 +885,11 @@ namespace URSoldering.Client ...@@ -929,8 +885,11 @@ namespace URSoldering.Client
private void btnWeld_Click(object sender, EventArgs e) private void btnWeld_Click(object sender, EventArgs e)
{ {
//如果开始焊接,开始焊接 string msg = Robot.StartWeld();
if (!msg.Equals(""))
{
MessageBox.Show("焊接失败:" + msg);
}
} }
} }
} }
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAJQAAAAIB ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAJQAAAAIB
AAAAAQAAAAAAAAAAAAAAABAAAAAAAAEAaAkAADQoAAAAAAAACw== AAAAAQAAAAAAAAAAAAAAABAAAAAAAAEAaAkAAKM4AAAAAAAACw==
</value> </value>
</data> </data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
......
...@@ -103,11 +103,11 @@ ...@@ -103,11 +103,11 @@
<Compile Include="FrmBoardList.Designer.cs"> <Compile Include="FrmBoardList.Designer.cs">
<DependentUpon>FrmBoardList.cs</DependentUpon> <DependentUpon>FrmBoardList.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FrmBoardSelect.cs"> <Compile Include="FrmProgramSelect.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="FrmBoardSelect.Designer.cs"> <Compile Include="FrmProgramSelect.Designer.cs">
<DependentUpon>FrmBoardSelect.cs</DependentUpon> <DependentUpon>FrmProgramSelect.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="FrmCodeLearn.cs"> <Compile Include="FrmCodeLearn.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
...@@ -204,8 +204,8 @@ ...@@ -204,8 +204,8 @@
<EmbeddedResource Include="FrmBoardList.resx"> <EmbeddedResource Include="FrmBoardList.resx">
<DependentUpon>FrmBoardList.cs</DependentUpon> <DependentUpon>FrmBoardList.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmBoardSelect.resx"> <EmbeddedResource Include="FrmProgramSelect.resx">
<DependentUpon>FrmBoardSelect.cs</DependentUpon> <DependentUpon>FrmProgramSelect.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="FrmCodeLearn.resx"> <EmbeddedResource Include="FrmCodeLearn.resx">
<DependentUpon>FrmCodeLearn.cs</DependentUpon> <DependentUpon>FrmCodeLearn.cs</DependentUpon>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!