Commit dd44844a 张东亮

轴判断到位条件改为空闲且到位

1 个父辈 27cb6186
......@@ -23,7 +23,7 @@ namespace OnlineStore.DeviceLibrary
public int LastPosition = 0;
public string AxisName;
public AxisBean(ConfigMoveAxis axisConfig, string deviceName,bool needHome=false)
public AxisBean(ConfigMoveAxis axisConfig, string deviceName, bool needHome = false)
{
this.IsNeedHome = needHome;
this.Config = axisConfig;
......@@ -106,7 +106,7 @@ namespace OnlineStore.DeviceLibrary
}
public void HomeMove(DeviceMoveInfo MoveInfo)
{
if(IsNeedHome)
if (IsNeedHome)
{
Config.TargetPosition = 0;
LogUtil.info(AxisName + "speed[" + Config.TargetSpeed + "]开始原点返回");
......@@ -129,7 +129,7 @@ namespace OnlineStore.DeviceLibrary
{
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, targetPosition, targetSpeed));
Config.TargetPosition = targetPosition;
AxisManager.instance.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed,Config.AddSpeed,Config.DelSpeed);
AxisManager.instance.AbsMove(Config.DeviceName, Config.GetAxisValue(), targetPosition, targetSpeed, Config.AddSpeed, Config.DelSpeed);
LogUtil.info($"{this.AxisName} AbsMove To [{targetPosition}] [speed={targetSpeed}]");
}
}
......@@ -143,8 +143,9 @@ namespace OnlineStore.DeviceLibrary
string deviceName = axis.DeviceName;
short axisNo = axis.GetAxisValue();
bool isOk = AxisManager.instance.GetBusyStatus(deviceName, axisNo).Equals(0);
bool isOk = AxisManager.instance.GetBusyStatus(deviceName, axisNo).Equals(0) && AxisManager.instance.GetInPositionSingle(deviceName, axisNo).Equals(0);
int outCount = AxisManager.instance.GetActualtPosition(deviceName, axisNo);
int targetCount = AxisManager.instance.GetTargetPosition(deviceName, axisNo);
int errorCount = Math.Abs(outCount - targetPosition);
if (isOk)
{
......@@ -158,8 +159,9 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动
if (alarm.Equals(1))
{
msg = " " + MoveInfo.SLog + MoveInfo.Name + axis.DisplayStr + ",目标位置[" + targetPosition + "]当前位置[" + outCount
+ "],误差过大且轴报警";
//msg = " " + MoveInfo.SLog + MoveInfo.Name + axis.DisplayStr + ",目标位置[" + targetPosition + "]当前位置[" + outCount
// + "],误差过大且轴报警";
msg = $" {MoveInfo.SLog}{MoveInfo.Name}{axis.DisplayStr},目标位置[{targetPosition}]当前位置[{outCount}]规划位置[{targetCount}],误差过大且轴报警";
LogUtil.error(msg, 600);
}
else if (MoveInfo.CanWhileCount > 0 && alarm.Equals(0))
......@@ -183,16 +185,14 @@ namespace OnlineStore.DeviceLibrary
AxisManager.instance.SuddenStop(axis.DeviceName, axis.GetAxisValue());
Thread.Sleep(100);
}
LogUtil.error(MoveInfo.Name + axis.DisplayStr + "目标位置[" + targetPosition + "]当前位置[" + outCount +
"],误差过大," + clearMsg + "重新开始运动,剩余[" + MoveInfo.CanWhileCount + "]次");
LogUtil.error($"{MoveInfo.Name}{axis.DisplayStr}目标位置[{targetPosition}]当前位置[{outCount}]规划位置[{targetCount}],误差过大, {clearMsg}重新开始运动,剩余[{MoveInfo.CanWhileCount}]次");
AxisManager.instance.AbsMove(axis.DeviceName, axis.GetAxisValue(), targetPosition, targetSpeed, axis.AddSpeed, axis.DelSpeed);
MoveInfo.CanWhileCount--;
Thread.Sleep(200);
}
else
{
msg = " " + MoveInfo.SLog + MoveInfo.Name + axis.DisplayStr + ",目标位置[" + targetPosition + "]当前位置[" + outCount
+ "],误差过大,需要报警";
msg = $" {MoveInfo.SLog}{MoveInfo.Name}{axis.DisplayStr},目标位置[{targetPosition}]当前位置[{outCount}]规划位置[{targetCount}],误差过大,需要报警";
LogUtil.error(msg, 600);
}
}
......@@ -224,12 +224,12 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil.error(MoveInfo.Name + axis.DisplayStr + "收到原点完成信号,当前位置[" + outCount + "],重新回原点,剩余[" + MoveInfo.CanWhileCount + "]次");
//LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
AxisManager.instance.HomeMove(axis.DeviceName, axis.GetAxisValue(), axis.HomeHighSpeed,axis.HomeLowSpeed,axis.HomeAddSpeed);
AxisManager.instance.HomeMove(axis.DeviceName, axis.GetAxisValue(), axis.HomeHighSpeed, axis.HomeLowSpeed, axis.HomeAddSpeed);
MoveInfo.CanWhileCount--;
}
else
{
msg =MoveInfo.Name+ " " + MoveInfo.SLog + axis.DisplayStr + ",收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
msg = MoveInfo.Name + " " + MoveInfo.SLog + axis.DisplayStr + ",收到原点完成信号,当前位置[" + outCount + "],误差过大,需要报警";
LogUtil.error(msg);
}
}
......@@ -238,10 +238,10 @@ namespace OnlineStore.DeviceLibrary
public int GetAclPosition()
{
int p = AxisManager.instance.GetActualtPosition(Config.DeviceName,Config.GetAxisValue());
int p = AxisManager.instance.GetActualtPosition(Config.DeviceName, Config.GetAxisValue());
return p;
}
public bool IsInPosition(int targetP,int canErrorMax=0)
public bool IsInPosition(int targetP, int canErrorMax = 0)
{
if (canErrorMax <= 0)
{
......@@ -283,7 +283,7 @@ namespace OnlineStore.DeviceLibrary
AxisManager.instance.SuddenStop(Config.DeviceName, Config.GetAxisValue());
}
#region 匀速上升处理
private System.Timers.Timer axisCheckTimer = null;
internal string TargetIoType = "";
......@@ -356,4 +356,4 @@ namespace OnlineStore.DeviceLibrary
#endregion
}
}
......@@ -56,10 +56,20 @@ namespace OnlineStore.DeviceLibrary
public abstract void AbsMove(string portName, short slvAddr, int targetPosition, int targetSpeed , int ptpAcc , int ptpDec );
public abstract void AlarmClear(string portName, short slvAddr);
//public abstract int GetTargetPosition(string portName, short slvAddr);
/// <summary>
/// 编码器值
/// </summary>
/// <param name="portName"></param>
/// <param name="slvAddr"></param>
/// <returns></returns>
public abstract int GetActualtPosition(string portName, short slvAddr);
/// <summary>
/// 规划器值
/// </summary>
/// <param name="portName"></param>
/// <param name="slvAddr"></param>
/// <returns></returns>
public abstract int GetTargetPosition(string portName, short slvAddr);
public abstract int GetAlarmStatus(string portName, short slvAddr);
public abstract int GetBusyStatus(string portName, short slvAddr);
......@@ -75,6 +85,12 @@ namespace OnlineStore.DeviceLibrary
/// 正极限
/// </summary>
public abstract int GetLimitPositiveSingle(string portName, short slvAddr);
/// <summary>
/// 到位信号
/// </summary>
/// <param name="portName"></param>
/// <param name="slvAddr"></param>
/// <returns></returns>
public abstract int GetInPositionSingle(string portName, short slvAddr);
}
}
......@@ -49,12 +49,26 @@ namespace OnlineStore.DeviceLibrary
{
}
/// <summary>
/// 获取编码器位置
/// </summary>
/// <param name="portName"></param>
/// <param name="slvAddr"></param>
/// <returns></returns>
public override int GetActualtPosition(string portName, short slvAddr)
{
return (int)HCBoardManager.GetAxisCurrPos(slvAddr);
}
/// <summary>
/// 获取规划器位置
/// </summary>
/// <param name="portName"></param>
/// <param name="slvAddr"></param>
/// <returns></returns>
public override int GetTargetPosition(string portName, short slvAddr)
{
return (int)HCBoardManager.GetAxisPrfPos(slvAddr);
}
public override int GetAlarmStatus(string portName, short slvAddr)
{
AxisSts axisS= HCBoardManager.GetAxisSts(slvAddr);
......@@ -88,12 +102,11 @@ namespace OnlineStore.DeviceLibrary
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.PEL;
}
//public override int GetTargetPosition(string portName, short slvAddr)
//{
// return (int)HCBoardManager.GetAxisPrfPos(slvAddr);
//}
public override int GetInPositionSingle(string portName, short slvAddr)
{
AxisSts axisS = HCBoardManager.GetAxisSts(slvAddr);
return axisS.INP;
}
public override void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc)
{
HCBoardManager.StartHomeMove(slvAddr,(uint) highVel, (uint)lowVel, (uint)acc);
......
......@@ -18,7 +18,7 @@ namespace OnlineStore.DeviceLibrary
public bool IsDebug = false;
public bool MoveStop = false;
protected int TimerMaxSeconds = 3;
public bool AxisAlarmFlag = false;//轴报警异常标识
protected void SetAllTimer(bool open)
{
......@@ -62,6 +62,7 @@ namespace OnlineStore.DeviceLibrary
if (alarmType.Equals(AlarmType.SuddenStop) || alarmType.Equals(AlarmType.NoAirpressure_Check) ||
alarmType.Equals(AlarmType.AxisAlarm) || alarmType.Equals(AlarmType.AxisMoveError))
{
AxisAlarmFlag = true;
StopMove();
}
}
......@@ -311,23 +312,16 @@ namespace OnlineStore.DeviceLibrary
}
else
{
//if(wait.AxisInfo.DeviceName.Equals("移栽升降轴"))
//{
// string deviceName = wait.AxisInfo.DeviceName;
// short axisNo = wait.AxisInfo.GetAxisValue();
// int outCount = AxisManager.instance.GetActualtPosition(deviceName, axisNo);
// LogInfo($"移栽升降轴 目标位置:{wait.TargetPosition},当前位置:{outCount}");
//}
wait.IsEnd = AxisBean.ACAxisMoveIsEnd(moveInfo, wait.AxisInfo, wait.TargetPosition, wait.TargetSpeed, out msg);
try
{
if (wait.AxisInfo.DeviceName.Equals("料斗拉取进出轴"))
if (wait.AxisInfo.Explain.Equals("料斗拉取进出轴"))
{
short axisNo = wait.AxisInfo.GetAxisValue();
preTor = curTor;
curTor = ((HCAxisManager)AxisManager.instance).GetAxActTorq(axisNo);
if (!preTor.Equals(curTor))
LogInfo($"料斗拉取进出轴 扭矩:{curTor}");
LogUtil.info($"料斗拉取进出轴 扭矩:{curTor}");
}
}
catch (Exception e)
......
......@@ -269,9 +269,25 @@ namespace OnlineStore.DeviceLibrary
#region 复位处理
private bool CanReset()
{
if (!AxisAlarmFlag && (PullAxis_Inout.IsInPosition(Config.PullAxis_Inout_CamA) ||
PullAxis_Inout.IsInPosition(Config.PullAxis_Inout_CamB)||
PullAxis_Inout.IsInPosition(Config.PullAxis_Inout_P1)))
return true;
return false;
}
private void StartReset()
{
if (!CanReset())
if (System.Windows.Forms.MessageBox.Show("检测到可能的撞机风险,请确认进出轴上是否有抽屉!若无抽屉在进出轴上,可继续复位,是否继续?", "警告",
System.Windows.Forms.MessageBoxButtons.YesNo).Equals(System.Windows.Forms.DialogResult.No))
{
SetBoxStatus(DeviceStatus.None, RunStatus.Wait);
MoveInfo.NewMove(MoveType.None);
LogInfo($"复位 {MoveInfo.SLog} :确认取消");
return;
}
SetWarnMsg("");
alarmType = AlarmType.None;
isInSuddenDown = false;
......@@ -388,14 +404,14 @@ namespace OnlineStore.DeviceLibrary
}
else
{
if(resetRtnA)
if (resetRtnA)
{
MoveInfo.MoveParam.PosInfo.PosId.Replace("BB", "AA");
MoveInfo.NextMoveStep(StepEnum.BOX_H003_PullAxis_InoutToP2P4);
LogInfo($"复位 {MoveInfo.SLog}:视觉检测到抽屉在轴上,推到抽屉提取点,料斗拉取进出轴到料屉提取点P2");
PullAxis_Inout_To_P2_P4();
}
else if(resetRtnB)
else if (resetRtnB)
{
MoveInfo.MoveParam.PosInfo.PosId.Replace("AA", "BB");
MoveInfo.NextMoveStep(StepEnum.BOX_H003_PullAxis_InoutToP2P4);
......@@ -760,7 +776,7 @@ namespace OnlineStore.DeviceLibrary
return;
}
}
else if(CheckAOutDoor())
else if (CheckAOutDoor())
{
InOutParam param = null;
bool result = waitAOutStoreList.TryDequeue(out param);
......@@ -774,7 +790,7 @@ namespace OnlineStore.DeviceLibrary
}
if (waitBOutStoreList.Count > 0)//
{
if(CloseOutStoreCheck)
if (CloseOutStoreCheck)
{
InOutParam param = null;
bool result = waitBOutStoreList.TryDequeue(out param);
......@@ -785,7 +801,7 @@ namespace OnlineStore.DeviceLibrary
return;
}
}
else if(CheckBOutDoor())
else if (CheckBOutDoor())
{
InOutParam param = null;
bool result = waitBOutStoreList.TryDequeue(out param);
......@@ -1004,7 +1020,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (CurrSecurityAccess.Equals(1))
{
if (IOValue(IO_Type.LeftDoor_Limit).Equals(IO_VALUE.HIGH) &&
if (IOValue(IO_Type.LeftDoor_Limit).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.RightDoor_Limit).Equals(IO_VALUE.HIGH) &&
IOValue(IO_Type.BackDoor_Limit).Equals(IO_VALUE.HIGH))
{
......
......@@ -892,6 +892,7 @@ namespace OnlineStore.DeviceLibrary
IgnoreCamDect = false;
SetBoxStatus(DeviceStatus.InStoreExecute, RunStatus.Busy, param.PosInfo.PosId,param.PosInfo.barcode);
MoveInfo.NextMoveStep(StepEnum.SI_00_StartInstore);
AxisAlarmFlag = false;
return true;
}
......@@ -1049,7 +1050,7 @@ namespace OnlineStore.DeviceLibrary
|| !runStatus.Equals(RunStatus.Runing)
|| !MoveInfo.MoveType.Equals(MoveType.None))
{
SetWarnMsg(Name + " 启动出库【" + param.PosInfo.ToStr() + "】失败,忙碌或报警中 ,storeStatus:" + runStatus + ",MoveType:" + MoveInfo.MoveType + ",isInSuddenDown:" + isInSuddenDown + ",isNoAirCheck:" + isNoAirpressure_Check);
LogUtil.error(Name + " 启动出库【" + param.PosInfo.ToStr() + "】失败,忙碌或报警中 ,storeStatus:" + runStatus + ",MoveType:" + MoveInfo.MoveType + ",isInSuddenDown:" + isInSuddenDown + ",isNoAirCheck:" + isNoAirpressure_Check);
return false;
}
......@@ -1066,7 +1067,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo("LoadInoutParam:" + JsonHelper.SerializeObject(param.MoveP));
IgnoreCamDect = false;
MoveInfo.NextMoveStep(StepEnum.SO_00_StartOutstore);
AxisAlarmFlag = false;
return true;
}
......
......@@ -758,7 +758,7 @@
this.tabPage6.Location = new System.Drawing.Point(4, 26);
this.tabPage6.Name = "tabPage6";
this.tabPage6.Padding = new System.Windows.Forms.Padding(3);
this.tabPage6.Size = new System.Drawing.Size(1637, 350);
this.tabPage6.Size = new System.Drawing.Size(1637, 352);
this.tabPage6.TabIndex = 2;
this.tabPage6.Text = "B面移栽";
this.tabPage6.UseVisualStyleBackColor = true;
......@@ -978,7 +978,7 @@
this.groupBox13.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox13.Location = new System.Drawing.Point(3, 3);
this.groupBox13.Name = "groupBox13";
this.groupBox13.Size = new System.Drawing.Size(984, 264);
this.groupBox13.Size = new System.Drawing.Size(984, 263);
this.groupBox13.TabIndex = 2;
this.groupBox13.TabStop = false;
this.groupBox13.Text = "库位位置信息";
......@@ -1259,10 +1259,10 @@
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage7);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(3, 418);
this.tabControl1.Location = new System.Drawing.Point(3, 419);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(998, 300);
this.tabControl1.Size = new System.Drawing.Size(998, 299);
this.tabControl1.TabIndex = 3;
//
// tabPage1
......@@ -1271,7 +1271,7 @@
this.tabPage1.Location = new System.Drawing.Point(4, 26);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(990, 270);
this.tabPage1.Size = new System.Drawing.Size(990, 269);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "公共位置信息";
this.tabPage1.UseVisualStyleBackColor = true;
......@@ -1282,7 +1282,7 @@
this.tabPage2.Location = new System.Drawing.Point(4, 26);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(990, 270);
this.tabPage2.Size = new System.Drawing.Size(990, 269);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "库位相关位置信息";
this.tabPage2.UseVisualStyleBackColor = true;
......@@ -1753,7 +1753,7 @@
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(998, 409);
this.tableLayoutPanel2.Size = new System.Drawing.Size(998, 410);
this.tableLayoutPanel2.TabIndex = 4;
//
// axisMoveControl1
......@@ -1771,7 +1771,7 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(503, 3);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(492, 403);
this.panel1.Size = new System.Drawing.Size(492, 404);
this.panel1.TabIndex = 6;
//
// groupBox23
......
......@@ -437,7 +437,7 @@
this.btnIgnoreCam.Name = "btnIgnoreCam";
this.btnIgnoreCam.Size = new System.Drawing.Size(166, 42);
this.btnIgnoreCam.TabIndex = 281;
this.btnIgnoreCam.Text = "忽略相机检测屉";
this.btnIgnoreCam.Text = "忽略相机检测屉";
this.btnIgnoreCam.UseVisualStyleBackColor = false;
this.btnIgnoreCam.Visible = false;
this.btnIgnoreCam.Click += new System.EventHandler(this.btnIgnoreCam_Click);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!