Commit 91fe69b0 张东亮

三色灯

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