Commit bde4b79a 张东亮

轴回原命令异常重发

1 个父辈 b0770b49
......@@ -4,6 +4,7 @@ using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
......@@ -122,12 +123,25 @@ namespace DeviceLibrary
}
Config.TargetPosition = 0;
LogUtil.info(AxisName + "speed[" + Config.HomeHighSpeed + "]开始原点返回");
if (MoveInfo != null)
MoveInfo.WaitList.Add(WaitResultInfo.WaitAxis(Config, true));
var HomeLowSpeed = Config.HomeLowSpeed > 0 ? Config.HomeLowSpeed : Config.HomeHighSpeed / 10;
var HomeAddSpeed = Config.HomeAddSpeed > 0 ? Config.HomeAddSpeed : Config.HomeHighSpeed * 5;
AxisManager.HomeMove(Config.DeviceName, (short)Config.GetAxisValue(), Config.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed);
if (AxisManager.HomeMove(Config.DeviceName, (short)Config.GetAxisValue(), Config.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed))
{
MoveInfo?.WaitList.Add(WaitResultInfo.WaitAxis(Config, true));
}
else
{
Thread.Sleep(50);
LogUtil.error(AxisName + "speed[" + Config.HomeHighSpeed + "]发送原点返回命令失败,重试");
if (AxisManager.HomeMove(Config.DeviceName, (short)Config.GetAxisValue(), Config.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed))
{
MoveInfo?.WaitList.Add(WaitResultInfo.WaitAxis(Config, true));
}
}
}
/// <summary>
......@@ -243,15 +257,18 @@ namespace DeviceLibrary
//判断是否需要重新运动
if (MoveInfo.CanWhileCount > 0)
{
msg = $"{MoveInfo.Name} {axis.DisplayStr} 收到原点完成信号,当前位置{outCount},规划位置{outTarget},重新回原点,剩余[{MoveInfo.CanWhileCount}]]次。{axisS.ToStr()}";
LogUtil.error(msg);
string msg1 = $"{MoveInfo.Name} {axis.DisplayStr} 收到原点完成信号,当前位置{outCount},规划位置{outTarget},重新回原点,剩余[{MoveInfo.CanWhileCount}]]次。{axisS.ToStr()}";
LogUtil.error(msg1);
//LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
AxisManager.HomeMove(axis.DeviceName, axis.GetAxisValue(), axis.HomeHighSpeed, axis.HomeLowSpeed, axis.HomeAddSpeed);
var HomeLowSpeed = axis.HomeLowSpeed > 0 ? axis.HomeLowSpeed : axis.HomeHighSpeed / 10;
var HomeAddSpeed = axis.HomeAddSpeed > 0 ? axis.HomeAddSpeed : axis.HomeHighSpeed * 5;
AxisManager.HomeMove(axis.DeviceName, (short)axis.GetAxisValue(), axis.HomeHighSpeed, HomeLowSpeed, HomeAddSpeed);
MoveInfo.CanWhileCount--;
}
else
{
msg =$"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr} ,收到原点完成信号,当前位置[{outCount}],规划位置{outTarget},误差过大,需要报警。{axisS.ToStr()}";
msg = $"{MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr} ,收到原点完成信号,当前位置[{outCount}],规划位置{outTarget},误差过大,需要报警。{axisS.ToStr()}";
LogUtil.error(msg);
}
}
......
......@@ -49,9 +49,9 @@ namespace DeviceLibrary
{
instance.RelMove(portName, slvAddr, position, targetSpeed, ptpAcc, ptpDec);
}
public static void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc)
public static bool HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc)
{
instance.HomeMove(portName, slvAddr, highVel, lowVel, acc);
return instance.HomeMove(portName, slvAddr, highVel, lowVel, acc);
}
public static void SpeedMove(string portName, short slvAddr, int speed,int acc,int dec)
......
......@@ -74,9 +74,9 @@ namespace DeviceLibrary
return (int)HCBoardManager.GetAxisPrfPos(slvAddr);
}
public void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc)
public bool HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc)
{
HCBoardManager.StartHomeMove(slvAddr,(uint) highVel, (uint)lowVel, (uint)acc);
return HCBoardManager.StartHomeMove(slvAddr,(uint) highVel, (uint)lowVel, (uint)acc);
}
public bool IsHomeMoveEnd(string portName, short slvAddr)
{
......
......@@ -24,7 +24,7 @@ namespace DeviceLibrary
void ServoOn(string portName, short slvAddr);
void ServoOff(string portName, short slvAddr);
void RelMove(string portName, short slvAddr, int position, int targetSpeed , int ptpAcc , int ptpDec );
void HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc);
bool HomeMove(string portName, short slvAddr, int highVel, int lowVel, int acc);
void SpeedMove(string portName, short slvAddr, int speed,int acc,int dec);
void SuddenStop(string portName, short slvAddr);
......
......@@ -35,11 +35,6 @@ namespace DeviceLibrary
ProcessMsgEvent?.Invoke(Msg.get());
//暂停时按下reaet按钮
if (RobotManage.isRunning && UserPause)
{
RobotManage.UserPause("Reset_BTN", false);
}
}
void Run_BTN()
{
......@@ -55,6 +50,11 @@ namespace DeviceLibrary
Msg.add(crc.GetString(L.runbtn_press_with_sudden, "急停中,按下启动按钮,无法启动."), MsgLevel.warning);
}
lastSuddenStop = false;
//暂停时按下reaet按钮
if (RobotManage.isRunning && UserPause)
{
RobotManage.UserPause("Run_BTN", false);
}
LogUtil.info("按下启动按钮");
ProcessMsgEvent?.Invoke(Msg.get());
}
......
......@@ -345,6 +345,7 @@ namespace DeviceLibrary
LogUtil.info("开始停止系统2.");
mstart = false;
AutoInOutTest = false;
ClearOutJob();
ServerCM.StopConnectServer();
Thread.Sleep(300);
Alarm(AlarmType.None);
......
......@@ -16,6 +16,10 @@ namespace DeviceLibrary
StoreJobList OutStoreJobList = new StoreJobList($"批量");
StoreJobList OutSingleJobList = new StoreJobList($"单盘");
public void ClearOutJob()
{
}
public void AddOutStoreTask(string posId, int plateW, int plateH)
{
JobInfo jobInfo = new JobInfo("", posId, plateW, plateH);
......
......@@ -310,6 +310,8 @@ namespace TheMachine
}
private void RobotManage_DataInitEvent(bool state, string msg)
{
try
{
if (this.InvokeRequired)
{
this.Invoke((EventHandler)delegate
......@@ -318,6 +320,12 @@ namespace TheMachine
});
return;
}
}
catch(Exception ex)
{
LogUtil.error($"RobotManage_DataInitEvent,{state},{msg}",ex);
}
ioc.Config = RobotManage.Config;
bd.Config = RobotManage.Config;
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!