Commit 91fe69b0 张东亮

三色灯

1 个父辈 ecdf645f
...@@ -100,8 +100,14 @@ namespace DeviceLibrary ...@@ -100,8 +100,14 @@ namespace DeviceLibrary
} }
if (IOMonitor.IODebound(IO_F_Stop_Out,Config,IO_VALUE.LOW,2000)) { if (IOMonitor.IODebound(IO_F_Stop_Out,Config,IO_VALUE.LOW,2000)) {
MoveInfo.log($"检测到周转箱已离开,结束出库"); MoveInfo.log($"检测到周转箱已离开,结束出库");
RobotManage.mainMachine.IsClearWarnMsg = true;
MoveInfo.EndMove(); MoveInfo.EndMove();
} }
else if(MoveInfo.IsTimeOut(30))
{
Msg.add($"等待周转箱离开超时", MsgLevel.warning);
RobotManage.mainMachine.IsClearWarnMsg = false;
}
break; break;
case MoveStep.Out08: case MoveStep.Out08:
if (IOValue(IO_F_Stop_Out).Equals(IO_VALUE.LOW) if (IOValue(IO_F_Stop_Out).Equals(IO_VALUE.LOW)
......
...@@ -113,7 +113,7 @@ namespace DeviceLibrary ...@@ -113,7 +113,7 @@ namespace DeviceLibrary
foreach (var ledcolor in ledcfg.Keys) foreach (var ledcolor in ledcfg.Keys)
{ {
if (ledcfg[ledcolor] == LedState.none) if (ledcfg[ledcolor] == LedState.none)
return; continue;
Led.LedColors[ledcolor].LedState = ledcfg[ledcolor]; Led.LedColors[ledcolor].LedState = ledcfg[ledcolor];
} }
} }
......
...@@ -19,7 +19,8 @@ namespace DeviceLibrary ...@@ -19,7 +19,8 @@ namespace DeviceLibrary
get { return _canRunning; } get { return _canRunning; }
set set
{ {
if (_canRunning != value) { if (_canRunning != value)
{
Msg.setlogones(); Msg.setlogones();
} }
_canRunning = value; _canRunning = value;
...@@ -29,8 +30,11 @@ namespace DeviceLibrary ...@@ -29,8 +30,11 @@ namespace DeviceLibrary
public bool isAlarm { get; set; } = false; public bool isAlarm { get; set; } = false;
public RunStatus runStatus { get; set; } = RunStatus.Stop; public RunStatus runStatus { get; set; } = RunStatus.Stop;
public Robot_Config Config { get; set; } public Robot_Config Config { get; set; }
/// <summary>
/// 用户暂停
/// </summary>
public bool UserPause { get; set; } = false; public bool UserPause { get; set; } = false;
public bool IsClearWarnMsg { get; set; } = true;
public MoveInfo ResetMoveInfo; public MoveInfo ResetMoveInfo;
/// <summary> /// <summary>
...@@ -69,7 +73,8 @@ namespace DeviceLibrary ...@@ -69,7 +73,8 @@ namespace DeviceLibrary
public MainMachine(Robot_Config _config) { public MainMachine(Robot_Config _config)
{
Config = _config; Config = _config;
StoreMoveInfo = new MoveInfo("行走机构"); StoreMoveInfo = new MoveInfo("行走机构");
...@@ -104,7 +109,7 @@ namespace DeviceLibrary ...@@ -104,7 +109,7 @@ namespace DeviceLibrary
//BoxTransport_InOutEndProcessEvent; //BoxTransport_InOutEndProcessEvent;
//ProcessMsgEvent += MainMachine_ProcessMsgEvent; //ProcessMsgEvent += MainMachine_ProcessMsgEvent;
CodeManager.LoadCamera(true); CodeManager.LoadCamera(true);
AlarmBuzzer.SetOnOffAction(() =>{ IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW); }); AlarmBuzzer.SetOnOffAction(() => { IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.HIGH); }, () => { IOMove(IO_Type.Alarm_Buzzer, IO_VALUE.LOW); });
//IOMonitor.RegisterIO(IO_Type.OutLeave_BTN, Config, IO_VALUE.HIGH, OutLeave_BTN,2500,100); //IOMonitor.RegisterIO(IO_Type.OutLeave_BTN, Config, IO_VALUE.HIGH, OutLeave_BTN,2500,100);
//IOMonitor.RegisterIO(IO_Type.Reset_BTN, Config, IO_VALUE.HIGH, Reset_BTN, 2500,100); //IOMonitor.RegisterIO(IO_Type.Reset_BTN, Config, IO_VALUE.HIGH, Reset_BTN, 2500,100);
...@@ -112,7 +117,7 @@ namespace DeviceLibrary ...@@ -112,7 +117,7 @@ namespace DeviceLibrary
} }
private (bool, string) ZAxis_interference(int from, int to) private (bool, string) ZAxis_interference(int from, int to)
{ {
if (to==Config.Zaxis_P1) if (to == Config.Zaxis_P1)
return (false, ""); return (false, "");
if (XAxis.GetAclPosition() > Config.Xaxis_P1 + Config.XAxis.CanErrorCountMax) if (XAxis.GetAclPosition() > Config.Xaxis_P1 + Config.XAxis.CanErrorCountMax)
...@@ -137,8 +142,10 @@ namespace DeviceLibrary ...@@ -137,8 +142,10 @@ namespace DeviceLibrary
//if (to=Config.y) //if (to=Config.y)
} }
else { ///在料仓 else
if (!ZAxis.IsInPosition(Config.Zaxis_P1) && Math.Abs(from - to) > 1000 * 10) { { ///在料仓
if (!ZAxis.IsInPosition(Config.Zaxis_P1) && Math.Abs(from - to) > 1000 * 10)
{
return (true, "进出轴伸出时升降轴不可以大幅运动"); return (true, "进出轴伸出时升降轴不可以大幅运动");
} }
...@@ -148,7 +155,8 @@ namespace DeviceLibrary ...@@ -148,7 +155,8 @@ namespace DeviceLibrary
private (bool, string) XAxis_interference(int from, int to) private (bool, string) XAxis_interference(int from, int to)
{ {
if (!ZAxis.IsInPosition(Config.Zaxis_P1)) { if (!ZAxis.IsInPosition(Config.Zaxis_P1))
{
return (true, "周转箱托盘没有收回,无法移动行走机构"); return (true, "周转箱托盘没有收回,无法移动行走机构");
} }
return (false, ""); return (false, "");
...@@ -157,10 +165,12 @@ namespace DeviceLibrary ...@@ -157,10 +165,12 @@ namespace DeviceLibrary
/// <summary> /// <summary>
/// 整机启动变量,设置为false后将退出线程,只在停止时调用 /// 整机启动变量,设置为false后将退出线程,只在停止时调用
/// </summary> /// </summary>
bool mstart=true; bool mstart = true;
public void Run() { public void Run()
{
mstart = true; mstart = true;
while (mstart) { while (mstart)
{
try try
{ {
canRunning = DeviceCheck(); canRunning = DeviceCheck();
...@@ -195,7 +205,8 @@ namespace DeviceLibrary ...@@ -195,7 +205,8 @@ namespace DeviceLibrary
Msg.add(ex.ToString(), MsgLevel.warning); Msg.add(ex.ToString(), MsgLevel.warning);
Msg.setlogones(); Msg.setlogones();
} }
finally { finally
{
var m = Msg.get(); var m = Msg.get();
ProcessMsgEvent?.Invoke(m); ProcessMsgEvent?.Invoke(m);
ServerCM.ProcessMsg(m); ServerCM.ProcessMsg(m);
...@@ -220,7 +231,10 @@ namespace DeviceLibrary ...@@ -220,7 +231,10 @@ namespace DeviceLibrary
} }
//ProcessMoveinfoEvent?.Invoke(MoveInfo.List); //ProcessMoveinfoEvent?.Invoke(MoveInfo.List);
if (!UserPause) if (!UserPause)
{
if (IsClearWarnMsg)
Msg.clear(); Msg.clear();
}
else else
currnetstoreStatus = StoreStatus.Debugging; currnetstoreStatus = StoreStatus.Debugging;
...@@ -230,11 +244,13 @@ namespace DeviceLibrary ...@@ -230,11 +244,13 @@ namespace DeviceLibrary
} }
LogUtil.info("主线程已退出."); LogUtil.info("主线程已退出.");
} }
public void Start() { public void Start()
{
ServerCM.StartConnectServer(); ServerCM.StartConnectServer();
Run(); Run();
} }
public void Stop() { public void Stop()
{
mstart = false; mstart = false;
ServerCM.StopConnectServer(); ServerCM.StopConnectServer();
Thread.Sleep(300); Thread.Sleep(300);
...@@ -244,7 +260,8 @@ namespace DeviceLibrary ...@@ -244,7 +260,8 @@ namespace DeviceLibrary
IOMove(IO_Type.Right_Moto_Run, IO_VALUE.LOW); IOMove(IO_Type.Right_Moto_Run, IO_VALUE.LOW);
} }
public void BeginHomeReset(bool firstRun=false) { public void BeginHomeReset(bool firstRun = false)
{
if (!firstRun) if (!firstRun)
{ {
StopMove(); StopMove();
...@@ -258,7 +275,7 @@ namespace DeviceLibrary ...@@ -258,7 +275,7 @@ namespace DeviceLibrary
ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000)); ResetMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
} }
//强制回原 //强制回原
bool forceHome=false; bool forceHome = false;
void HomeReset() void HomeReset()
{ {
if (CheckWait(ResetMoveInfo)) if (CheckWait(ResetMoveInfo))
...@@ -304,8 +321,8 @@ namespace DeviceLibrary ...@@ -304,8 +321,8 @@ namespace DeviceLibrary
case MoveStep.H06_HomeReset: case MoveStep.H06_HomeReset:
ResetMoveInfo.NextMoveStep(MoveStep.H07_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H07_HomeReset);
ResetMoveInfo.log("正在回原,行走机构,升降轴,到P1待机点,入口顶升下降,出口顶升上升"); ResetMoveInfo.log("正在回原,行走机构,升降轴,到P1待机点,入口顶升下降,出口顶升上升");
YAxis.AbsMove(ResetMoveInfo, Config.Yaxis_P1,Config.Yaxis_P1_speed); YAxis.AbsMove(ResetMoveInfo, Config.Yaxis_P1, Config.Yaxis_P1_speed);
XAxis.AbsMove(ResetMoveInfo, Config.Xaxis_P1,Config.Xaxis_P1_speed); XAxis.AbsMove(ResetMoveInfo, Config.Xaxis_P1, Config.Xaxis_P1_speed);
RightInOut.Lift.LiftUp(ResetMoveInfo); RightInOut.Lift.LiftUp(ResetMoveInfo);
LeftInOut.Lift.LiftDown(ResetMoveInfo); LeftInOut.Lift.LiftDown(ResetMoveInfo);
...@@ -329,13 +346,15 @@ namespace DeviceLibrary ...@@ -329,13 +346,15 @@ namespace DeviceLibrary
RobotManage.UserPause("回源时料叉上有物料"); RobotManage.UserPause("回源时料叉上有物料");
return; return;
} }
else { else
{
ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.HEND_HomeReset);
ResetMoveInfo.log("进出轴上没有周转箱"); ResetMoveInfo.log("进出轴上没有周转箱");
} }
break; break;
case MoveStep.H08_HomeReset: case MoveStep.H08_HomeReset:
if (InOutDevice.GetOutStoreFreeSide(out InOutSideE inOutSide2, out InOutDevice iod2)){// && IsOutLiftEmpty) { if (InOutDevice.GetOutStoreFreeSide(out InOutSideE inOutSide2, out InOutDevice iod2))
{// && IsOutLiftEmpty) {
iod2.TurnToOut(new JobInfo("ReturnHome", "ReturnHome", "ReturnHome")); iod2.TurnToOut(new JobInfo("ReturnHome", "ReturnHome", "ReturnHome"));
ResetMoveInfo.NextMoveStep(MoveStep.H09_HomeReset); ResetMoveInfo.NextMoveStep(MoveStep.H09_HomeReset);
boxTransport.Start(null, new BoxStorePosition(Config, inOutSide2), StoreMoveType.ReturnHome, "ReturnHome"); boxTransport.Start(null, new BoxStorePosition(Config, inOutSide2), StoreMoveType.ReturnHome, "ReturnHome");
...@@ -365,20 +384,26 @@ namespace DeviceLibrary ...@@ -365,20 +384,26 @@ namespace DeviceLibrary
} }
} }
bool _IgnoreSafecheck = false; bool _IgnoreSafecheck = false;
public bool IgnoreSafecheck { get => _IgnoreSafecheck; set { public bool IgnoreSafecheck
{
get => _IgnoreSafecheck; set
{
if (value) if (value)
{ {
IOMove(IO_Type.DoorSafe_Disable, IO_VALUE.HIGH); IOMove(IO_Type.DoorSafe_Disable, IO_VALUE.HIGH);
} }
else { else
{
IOMove(IO_Type.DoorSafe_Disable, IO_VALUE.LOW); IOMove(IO_Type.DoorSafe_Disable, IO_VALUE.LOW);
} }
_IgnoreSafecheck = value; _IgnoreSafecheck = value;
} } }
}
public bool IgnoreGratingSignal = false; public bool IgnoreGratingSignal = false;
bool lastSafeCheckStatus = true; bool lastSafeCheckStatus = true;
bool SafeCheck() { bool SafeCheck()
{
bool ok = true; bool ok = true;
if (IOValue(IO_Type.FrontDoor_Check).Equals(IO_VALUE.LOW)) if (IOValue(IO_Type.FrontDoor_Check).Equals(IO_VALUE.LOW))
...@@ -407,7 +432,8 @@ namespace DeviceLibrary ...@@ -407,7 +432,8 @@ namespace DeviceLibrary
return ok; return ok;
} }
void DeviceSuddenStop() { void DeviceSuddenStop()
{
if (lastSafeCheckStatus) if (lastSafeCheckStatus)
{ {
//lastSafeCheckStatus = false; //lastSafeCheckStatus = false;
...@@ -421,7 +447,8 @@ namespace DeviceLibrary ...@@ -421,7 +447,8 @@ namespace DeviceLibrary
} }
} }
} }
void DeviceResume() { void DeviceResume()
{
LeftInOut.Line.Resume(); LeftInOut.Line.Resume();
RightInOut.Line.Resume(); RightInOut.Line.Resume();
} }
...@@ -432,7 +459,8 @@ namespace DeviceLibrary ...@@ -432,7 +459,8 @@ namespace DeviceLibrary
DateTime lastAirCloseTime = DateTime.MinValue; DateTime lastAirCloseTime = DateTime.MinValue;
internal DateTime checkAlarmTime = DateTime.Now; internal DateTime checkAlarmTime = DateTime.Now;
public bool DeviceCheck() { public bool DeviceCheck()
{
bool ok = true; bool ok = true;
if (UserPause) if (UserPause)
{ {
...@@ -447,7 +475,8 @@ namespace DeviceLibrary ...@@ -447,7 +475,8 @@ namespace DeviceLibrary
Msg.add("急停中", MsgLevel.alarm); Msg.add("急停中", MsgLevel.alarm);
ok = false; ok = false;
} }
else if (alarmType == AlarmType.SuddenStop) { else if (alarmType == AlarmType.SuddenStop)
{
//if (IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.Left_BTN).Equals(IO_VALUE.HIGH)) //if (IOValue(IO_Type.Right_BTN).Equals(IO_VALUE.HIGH) || IOValue(IO_Type.Left_BTN).Equals(IO_VALUE.HIGH))
//{ //{
// Alarm(AlarmType.None); // Alarm(AlarmType.None);
...@@ -475,10 +504,11 @@ namespace DeviceLibrary ...@@ -475,10 +504,11 @@ namespace DeviceLibrary
Msg.add("气压不足", MsgLevel.warning); Msg.add("气压不足", MsgLevel.warning);
} }
} }
else { else
{
lastAirCloseTime = DateTime.MinValue; lastAirCloseTime = DateTime.MinValue;
} }
if (alarmType!=AlarmType.SuddenStop) if (alarmType != AlarmType.SuddenStop)
{ {
TimeSpan span = DateTime.Now - checkAlarmTime; TimeSpan span = DateTime.Now - checkAlarmTime;
if (span.TotalSeconds > 2) if (span.TotalSeconds > 2)
...@@ -497,7 +527,8 @@ namespace DeviceLibrary ...@@ -497,7 +527,8 @@ namespace DeviceLibrary
return ok; return ok;
} }
int GetYAxisLevel() { int GetYAxisLevel()
{
if (IOValue(IO_Type.Lift_1Level_Check).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.Lift_1Level_Check).Equals(IO_VALUE.HIGH))
return 1; return 1;
if (IOValue(IO_Type.Lift_2Level_Check).Equals(IO_VALUE.HIGH)) if (IOValue(IO_Type.Lift_2Level_Check).Equals(IO_VALUE.HIGH))
...@@ -513,7 +544,8 @@ namespace DeviceLibrary ...@@ -513,7 +544,8 @@ namespace DeviceLibrary
return 0; return 0;
} }
public void IgnoreX09() { public void IgnoreX09()
{
boxTransport.IgnoreX09 = true; boxTransport.IgnoreX09 = true;
LogUtil.info("按下X05忽略"); LogUtil.info("按下X05忽略");
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!