Commit 3983896a ke.sun

添加判断:复位是是否需要重置机器人。

1 个父辈 cffa60e0
...@@ -304,18 +304,19 @@ namespace URSoldering.Common ...@@ -304,18 +304,19 @@ namespace URSoldering.Common
} }
if (num >= Overtime) if (num >= Overtime)
{ {
isOk = false ;
LogUtil.error(PortName + "发送数据" + ByteToString(SendData) + "等待" + Overtime + "超时"); LogUtil.error(PortName + "发送数据" + ByteToString(SendData) + "等待" + Overtime + "超时");
} }
if (_serialPort.BytesToRead >= ReceiveData.Length) if (_serialPort.BytesToRead >= ReceiveData.Length)
{ {
isOk = true;
ret = _serialPort.Read(ReceiveData, 0, ReceiveData.Length); ret = _serialPort.Read(ReceiveData, 0, ReceiveData.Length);
} }
else else
{ {
isOk = true;
ret = _serialPort.Read(ReceiveData, 0, _serialPort.BytesToRead); ret = _serialPort.Read(ReceiveData, 0, _serialPort.BytesToRead);
} }
isOk = true;
return ret; return ret;
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -126,19 +126,18 @@ namespace URSoldering.DeviceLibrary ...@@ -126,19 +126,18 @@ 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;
} }
} }
else if (Status.Equals(RobotStatus.Runing)) else if (Status.Equals(RobotStatus.Runing))
{ {
IOTimeOutProcess();
} }
else if (Status.Equals(RobotStatus.Busy)) else if (Status.Equals(RobotStatus.Busy))
{ {
BusyProcess(); BusyProcess();
} }
else if (Status.Equals(RobotStatus.LineMove)) else if (Status.Equals(RobotStatus.LineMove))
{ {
} }
} }
}catch(Exception ex) }catch(Exception ex)
...@@ -147,38 +146,7 @@ namespace URSoldering.DeviceLibrary ...@@ -147,38 +146,7 @@ namespace URSoldering.DeviceLibrary
} }
IsInProcess = false; IsInProcess = false;
} }
/// <summary>
/// io检测异常,如果所有的步骤已经完成,表示信号超时异常已经结束
/// </summary>
private DateTime preIoTimerOutTime = DateTime.Now;
private void IOTimeOutProcess()
{
try
{
TimeSpan span = DateTime.Now - preIoTimerOutTime;
if (span.TotalSeconds > 1)
{
preIoTimerOutTime = DateTime.Now;
if (IsInSuddendown)
{
return;
}
if (alarmType.Equals(AlarmType.IoSingleTimeOut) || alarmType.Equals(AlarmType.StepTimeOut))
{
if (LineStep.IsInWait == false)
{
LogUtil.info(RobotName + "之前有IO超时异常,清理信号超时异常!");
WarnMsg = "";
alarmType = AlarmType.None;
}
}
}
}
catch (Exception ex)
{
LogUtil.error(LOGGER, "IOTimeOutProcess出错:" + ex.ToString());
}
}
private void StopMove() private void StopMove()
{ {
...@@ -224,8 +192,7 @@ namespace URSoldering.DeviceLibrary ...@@ -224,8 +192,7 @@ namespace URSoldering.DeviceLibrary
} }
} }
} }
/// <summary> /// <summary>
/// 判断是否还有未完成的工作 /// 判断是否还有未完成的工作
/// </summary> /// </summary>
...@@ -247,8 +214,7 @@ namespace URSoldering.DeviceLibrary ...@@ -247,8 +214,7 @@ namespace URSoldering.DeviceLibrary
if (AlarmType.SuddenStop.Equals(alarmType)) if (AlarmType.SuddenStop.Equals(alarmType))
{ {
WarnMsg = "收到急停信号"; WarnMsg = "收到急停信号";
WeldRobotBean.Alarm(AlarmType.SuddenStop); WeldRobotBean.Alarm(AlarmType.SuddenStop);
SendWireManager.Release();
StopMove(); StopMove();
} }
} }
......
...@@ -108,15 +108,27 @@ namespace URSoldering.DeviceLibrary ...@@ -108,15 +108,27 @@ namespace URSoldering.DeviceLibrary
{ {
if (!URRobotControl.IsRun) if (!URRobotControl.IsRun)
{ {
bool isNeedReset = false;
if (alarmType.Equals(AlarmType.SuddenStop) || alarmType.Equals(AlarmType.NoAirCheck) || alarmType.Equals(AlarmType.RobotError))
{
isNeedReset = true;
}
Task.Factory.StartNew(delegate () Task.Factory.StartNew(delegate ()
{
if (isNeedReset)
{ {
bool result = URRobotControl.StartRobot(); URRobotControl.Reset();
}
bool result = URRobotControl.StartRobot();
if (!result)
{
WarnMsg = "连接UR机器人失败";
}
});
if (!result)
{
WarnMsg = "连接UR机器人失败";
}
});
} }
} }
public static void ResetInit() public static void ResetInit()
...@@ -147,12 +159,7 @@ namespace URSoldering.DeviceLibrary ...@@ -147,12 +159,7 @@ namespace URSoldering.DeviceLibrary
else else
{ {
ResetInit(); ResetInit();
} }
//Thread.Sleep(1000);
//if (!URRobotControl.IsRun)
//{
// Thread.Sleep(2000);
//}
if (!URRobotControl.PointIsValid(HomePoint)) if (!URRobotControl.PointIsValid(HomePoint))
{ {
LogUtil.info(RobotName + "开始启动失败:原点坐标无效"); LogUtil.info(RobotName + "开始启动失败:原点坐标无效");
...@@ -489,7 +496,7 @@ namespace URSoldering.DeviceLibrary ...@@ -489,7 +496,7 @@ 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) || alarmType.Equals(AlarmType.RobotError))
{ {
if (alarmType.Equals(AlarmType.SuddenStop)) if (alarmType.Equals(AlarmType.SuddenStop))
{ {
......
...@@ -9,8 +9,8 @@ namespace URSoldering.DeviceLibrary ...@@ -9,8 +9,8 @@ namespace URSoldering.DeviceLibrary
partial class WeldRobotBean partial class WeldRobotBean
{ {
public static bool IsInWeld=false; public static bool IsInWeld=false;
public delegate void GetCode(); //public delegate void GetCode();
public static event GetCode GetCodeFun; //public static event GetCode GetCodeFun;
public delegate void AOICheck( ); public delegate void AOICheck( );
public static event AOICheck AOICheckFun; public static event AOICheck AOICheckFun;
...@@ -157,8 +157,8 @@ namespace URSoldering.DeviceLibrary ...@@ -157,8 +157,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)
{ {
......
...@@ -32,9 +32,11 @@ namespace URSoldering.DeviceLibrary ...@@ -32,9 +32,11 @@ namespace URSoldering.DeviceLibrary
private static string CMD_StartBackSend = "0010WSFD00000"; private static string CMD_StartBackSend = "0010WSFD00000";
private static string CMD_StopSend = "0010WSSD00000"; private static string CMD_StopSend = "0010WSSD00000";
private static string CMD_Reset = "0010WECV00001"; private static string CMD_Reset = "0010WECV00001";
private static string LogName = "";
public static bool Init(string port) public static bool Init(string port)
{ {
LogName = "送丝器[" + port + "]";
if (sb == null) if (sb == null)
{ {
serialPort = port; serialPort = port;
...@@ -54,14 +56,14 @@ namespace URSoldering.DeviceLibrary ...@@ -54,14 +56,14 @@ namespace URSoldering.DeviceLibrary
} }
else else
{ {
LogUtil.error("送丝机初始化失败!"); LogUtil.error(LogName+ "初始化失败!");
Release(); Release();
return false; return false;
} }
} }
else else
{ {
LogUtil.error(LOGGER, "送丝机串口打开失败!"); LogUtil.error(LOGGER, LogName + "串口打开失败!");
IsRun = false; IsRun = false;
return false; return false;
} }
...@@ -124,7 +126,7 @@ namespace URSoldering.DeviceLibrary ...@@ -124,7 +126,7 @@ namespace URSoldering.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Info("转换出错:" + ex.ToString()); LOGGER.Info(LogName + "转换出错:" + ex.ToString());
} }
int data = 0; int data = 0;
...@@ -134,7 +136,7 @@ namespace URSoldering.DeviceLibrary ...@@ -134,7 +136,7 @@ namespace URSoldering.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.debug(LOGGER, "转换出错:" + strData); LogUtil.debug(LOGGER, LogName + "转换出错:" + strData);
} }
return data; return data;
} }
...@@ -248,7 +250,7 @@ namespace URSoldering.DeviceLibrary ...@@ -248,7 +250,7 @@ namespace URSoldering.DeviceLibrary
data = new byte[messageAll.Length - 5]; data = new byte[messageAll.Length - 5];
} }
string str = AcSerialBean.byteToHexStr(messageAll," "); string str = AcSerialBean.byteToHexStr(messageAll," ");
LogUtil.debug(" JBC送丝器【"+commandText+"】 转换后【"+str+"】"); LogUtil.debug(LogName + " JBC送丝器【" +commandText+"】 转换后【"+str+"】");
sb.SendCommand(messageAll, ref data, 100, out isOk); sb.SendCommand(messageAll, ref data, 100, out isOk);
return data; return data;
} }
......
...@@ -22,12 +22,13 @@ namespace URSoldering.DeviceLibrary ...@@ -22,12 +22,13 @@ namespace URSoldering.DeviceLibrary
public static string serialPort = ""; public static string serialPort = "";
public static string equipmentPort = ""; public static string equipmentPort = "";
private static AcSerialBean serialBean = null; private static AcSerialBean serialBean = null;
private static string LogName = "";
/// <summary> /// <summary>
/// 初始化 /// 初始化
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static bool Init(string sPort,string ePort) public static bool Init(string sPort, string ePort)
{ {
serialPort = sPort; serialPort = sPort;
equipmentPort = ePort; equipmentPort = ePort;
...@@ -35,12 +36,13 @@ namespace URSoldering.DeviceLibrary ...@@ -35,12 +36,13 @@ namespace URSoldering.DeviceLibrary
{ {
serialBean = new AcSerialBean(serialPort, bautRate, parity, dataBits, stopBits); serialBean = new AcSerialBean(serialPort, bautRate, parity, dataBits, stopBits);
} }
LogName = "烙铁[" + sPort + "][" + ePort + "]";
try try
{ {
if (IsRun) if (IsRun)
{ {
return true ; return true;
} }
if (serialBean.openPort()) if (serialBean.openPort())
{ {
...@@ -53,14 +55,14 @@ namespace URSoldering.DeviceLibrary ...@@ -53,14 +55,14 @@ namespace URSoldering.DeviceLibrary
} }
else else
{ {
LogUtil.error("烙铁初始化失败!"); LogUtil.error(LogName+ "烙铁初始化失败!");
Release(); Release();
return false; return false;
} }
} }
else else
{ {
LogUtil.error(LOGGER, "烙铁串口打开失败!"); LogUtil.error(LOGGER, LogName + "烙铁串口打开失败!");
IsRun = false; IsRun = false;
return false; return false;
} }
...@@ -109,7 +111,7 @@ namespace URSoldering.DeviceLibrary ...@@ -109,7 +111,7 @@ namespace URSoldering.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.debug(LOGGER, "转换温度出错:" + temp); LogUtil.debug(LOGGER, LogName + "转换温度出错:" + temp);
} }
return tem; return tem;
} }
...@@ -129,7 +131,7 @@ namespace URSoldering.DeviceLibrary ...@@ -129,7 +131,7 @@ namespace URSoldering.DeviceLibrary
} }
else else
{ {
LogUtil.debug("烙铁未初始化,调用了queryActualTemp直接返回0"); LogUtil.debug(LogName + "未初始化,调用了queryActualTemp直接返回0");
return 0; return 0;
} }
...@@ -151,7 +153,7 @@ namespace URSoldering.DeviceLibrary ...@@ -151,7 +153,7 @@ namespace URSoldering.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LOGGER.Info("转换出错:" + ex.ToString()); LOGGER.Info(LogName + "转换出错:" + ex.ToString());
} }
int tem = 0; int tem = 0;
try try
...@@ -160,7 +162,7 @@ namespace URSoldering.DeviceLibrary ...@@ -160,7 +162,7 @@ namespace URSoldering.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.debug(LOGGER, "转换温度出错:" + temp); LogUtil.debug(LOGGER, LogName + "转换温度出错:" + temp);
} }
return tem; return tem;
} }
...@@ -178,7 +180,7 @@ namespace URSoldering.DeviceLibrary ...@@ -178,7 +180,7 @@ namespace URSoldering.DeviceLibrary
} }
else else
{ {
LogUtil.debug("烙铁未初始化,调用了setTemp直接返回false"); LogUtil.debug(LogName + "烙铁未初始化,调用了setTemp直接返回false");
return false; return false;
} }
} }
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
// //
// txtCode // txtCode
// //
this.txtCode.Location = new System.Drawing.Point(131, 96); this.txtCode.Location = new System.Drawing.Point(131, 110);
this.txtCode.MaxLength = 20; this.txtCode.MaxLength = 20;
this.txtCode.Name = "txtCode"; this.txtCode.Name = "txtCode";
this.txtCode.Size = new System.Drawing.Size(221, 23); this.txtCode.Size = new System.Drawing.Size(221, 23);
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(73, 100); this.label1.Location = new System.Drawing.Point(73, 114);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 17); this.label1.Size = new System.Drawing.Size(32, 17);
this.label1.TabIndex = 269; this.label1.TabIndex = 269;
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
// //
this.btnBack.FlatAppearance.BorderSize = 0; this.btnBack.FlatAppearance.BorderSize = 0;
this.btnBack.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnBack.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnBack.Location = new System.Drawing.Point(224, 193); this.btnBack.Location = new System.Drawing.Point(224, 182);
this.btnBack.Name = "btnBack"; this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(107, 37); this.btnBack.Size = new System.Drawing.Size(107, 37);
this.btnBack.TabIndex = 41; this.btnBack.TabIndex = 41;
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
// //
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(91, 193); this.btnSave.Location = new System.Drawing.Point(111, 182);
this.btnSave.Name = "btnSave"; this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(107, 37); this.btnSave.Size = new System.Drawing.Size(107, 37);
this.btnSave.TabIndex = 40; this.btnSave.TabIndex = 40;
...@@ -136,24 +136,26 @@ ...@@ -136,24 +136,26 @@
// //
// txtRobotZHighValue // txtRobotZHighValue
// //
this.txtRobotZHighValue.Location = new System.Drawing.Point(131, 142); this.txtRobotZHighValue.Location = new System.Drawing.Point(131, 156);
this.txtRobotZHighValue.Name = "txtRobotZHighValue"; this.txtRobotZHighValue.Name = "txtRobotZHighValue";
this.txtRobotZHighValue.Size = new System.Drawing.Size(89, 23); this.txtRobotZHighValue.Size = new System.Drawing.Size(89, 23);
this.txtRobotZHighValue.TabIndex = 266; this.txtRobotZHighValue.TabIndex = 266;
this.txtRobotZHighValue.Text = "-20"; this.txtRobotZHighValue.Text = "-20";
this.txtRobotZHighValue.Visible = false;
// //
// label9 // label9
// //
this.label9.AutoSize = true; this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(65, 146); this.label9.Location = new System.Drawing.Point(65, 160);
this.label9.Name = "label9"; this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(51, 17); this.label9.Size = new System.Drawing.Size(51, 17);
this.label9.TabIndex = 265; this.label9.TabIndex = 265;
this.label9.Text = "高位Z轴"; this.label9.Text = "高位Z轴";
this.label9.Visible = false;
// //
// txtBoardName // txtBoardName
// //
this.txtBoardName.Location = new System.Drawing.Point(132, 50); this.txtBoardName.Location = new System.Drawing.Point(132, 64);
this.txtBoardName.MaxLength = 20; this.txtBoardName.MaxLength = 20;
this.txtBoardName.Name = "txtBoardName"; this.txtBoardName.Name = "txtBoardName";
this.txtBoardName.Size = new System.Drawing.Size(220, 23); this.txtBoardName.Size = new System.Drawing.Size(220, 23);
...@@ -162,7 +164,7 @@ ...@@ -162,7 +164,7 @@
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(61, 54); this.label2.Location = new System.Drawing.Point(61, 68);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 17); this.label2.Size = new System.Drawing.Size(56, 17);
this.label2.TabIndex = 1; this.label2.TabIndex = 1;
......
...@@ -78,11 +78,12 @@ ...@@ -78,11 +78,12 @@
this.txtPwd.PasswordChar = '*'; this.txtPwd.PasswordChar = '*';
this.txtPwd.Size = new System.Drawing.Size(215, 33); this.txtPwd.Size = new System.Drawing.Size(215, 33);
this.txtPwd.TabIndex = 276; this.txtPwd.TabIndex = 276;
this.txtPwd.Text = "123456";
this.txtPwd.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPwd_KeyDown); this.txtPwd.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPwd_KeyDown);
// //
// FrmPwd // FrmPwd
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); 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(437, 268); this.ClientSize = new System.Drawing.Size(437, 268);
this.Controls.Add(this.txtPwd); this.Controls.Add(this.txtPwd);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!