public EnumMoveCommandControlErrorCode SensorSafety(EnumControlStatus motionDriverStatus, EnumControlStatus locationControlStatus) { EnumMoveCommandControlErrorCode temp; if (localData.MoveControlData.MoveCommand.CommandStatus != EnumMoveCommandStartStatus.Start) { return(EnumMoveCommandControlErrorCode.None); } else if (locationControlStatus != EnumControlStatus.Ready) { return(EnumMoveCommandControlErrorCode.安全保護停止_定位Control異常); } else if (localData.MoveControlData.MoveCommand.VehicleStopFlag) { return(EnumMoveCommandControlErrorCode.安全保護停止_人為控制); } else if (localData.MIPCData.SafetySensorStatus == EnumSafetyLevel.Alarm) { return(EnumMoveCommandControlErrorCode.安全保護停止_SafetySensorAlarm); } else if (localData.MIPCData.SafetySensorStatus == EnumSafetyLevel.EMO || localData.MIPCData.SafetySensorStatus == EnumSafetyLevel.IPCEMO) { return(EnumMoveCommandControlErrorCode.安全保護停止_EMO停止); } else if (localData.MIPCData.MotionAlarmCount != 0) { return(EnumMoveCommandControlErrorCode.安全保護停止_MotionAlarm); } else if (!VChangeSafetyNormal()) { return(EnumMoveCommandControlErrorCode.安全保護停止_速度變化異常); } else { temp = AxisErrorCheck(motionDriverStatus); if (temp != EnumMoveCommandControlErrorCode.None) { return(temp); } // temp = ForkNotHomeCheck(); // if (temp != EnumMoveCommandControlErrorCode.None) // return temp; temp = AGVPathSafety(); if (temp != EnumMoveCommandControlErrorCode.None) { return(temp); } temp = SafetyTurnOutAndLineBarcodeIntervalInRange(); if (temp != EnumMoveCommandControlErrorCode.None) { return(temp); } } return(EnumMoveCommandControlErrorCode.None); }
public void UpdateLocateControlData() { LocateAGVPosition newLocateAGVPosition = null; int order; if (localData.MoveControlData.LocateControlData.SelectOrder == null) { order = LocateControlDriverList.Count - 1; } else { order = localData.MoveControlData.LocateControlData.SelectOrder.Order + (int)((DateTime.Now - localData.MoveControlData.LocateControlData.SelectOrder.GetDataTime).TotalMilliseconds / config.OrderLowerDelay); } EnumControlStatus newStatus = EnumControlStatus.Ready; for (int i = 0; i < LocateControlDriverList.Count && i <= order; i++) { if (newLocateAGVPosition == null) { newLocateAGVPosition = LocateControlDriverList[i].GetLocateAGVPosition; } if ((int)newStatus < (int)LocateControlDriverList[i].Status) { newStatus = LocateControlDriverList[i].Status; } } status = newStatus; if (setAGVPositionByAdmin) { if (setAGVPosition != null) { setAGVPositionByAdmin = false; newLocateAGVPosition = setAGVPosition; } } localData.MoveControlData.LocateControlData.LocateAGVPosition = newLocateAGVPosition; }
public LocateControlHandler(AlarmHandler alarmHandler, string normalLogName) { this.alarmHandler = alarmHandler; this.normalLogName = normalLogName; string errorMessage = ""; if (ReadLocateControlConfig(ref errorMessage)) { //ReadResetPointCSV(); status = EnumControlStatus.Initial; InitailControlDriver(); } else { WriteLog(1, "", errorMessage); SendAlarmCode(EnumMoveCommandControlErrorCode.LocateControl初始化失敗); } }
private EnumMoveCommandControlErrorCode AxisErrorCheck(EnumControlStatus motionDriverStatus) { if (motionDriverStatus != EnumControlStatus.Ready) { return(EnumMoveCommandControlErrorCode.安全保護停止_軸異常); } //if (vehicleData.CommandFlags.AxisError != EnumVehicleSafetyAction.Normal) //{ // if (vehicleData.CommandFlags.OnlyAxisError && // vehicleData.CommandFlags.AxisErrorDelayTimer.ElapsedMilliseconds > // vehicleData.MoveControlConfig.TimeValueConfig.DelayTimeList[EnumDelayTimeType.AxisErrorDelayTime]) // { // vehicleData.CommandFlags.AxisErrorDelayTimer.Stop(); // return EnumMoveCommandControlErrorCode.安全保護停止_軸異常; // } //} return(EnumMoveCommandControlErrorCode.None); }
public void CloseLoadUnloadControlHanlder() { Stopwatch closeTimer = new Stopwatch(); Status = EnumControlStatus.Closing; closeTimer.Restart(); /// if forkCommand /// { /// Stop /// And Wait /// timeout >> EMO & log /// /// } /// else if (fork jog) /// Stop /// And Wait /// timeout >> EMO & log /// Status = EnumControlStatus.WaitThreadStop; closeTimer.Restart(); while (thread != null && thread.IsAlive) { if (closeTimer.ElapsedMilliseconds > 1000 /*config.TimeValueConfig.TimeoutValueList[EnumTimeoutValueType.EndTimeoutValue]*/) { // log. // abort break; } Thread.Sleep(10); } Status = EnumControlStatus.Closed; }
public void UpdateData() { if (driver == null) { return; } if (triggerOnOff != driver.PoolingOnOff) { triggerOnOff = driver.PoolingOnOff; if (triggerOnOff) { label_TriggerValue.Text = "On"; label_TriggerValue.ForeColor = Color.Green; button_TriggerOnOff.Text = "關閉"; driver.PoolingOnOff = true; } else { label_TriggerValue.Text = "Off"; label_TriggerValue.ForeColor = Color.Red; button_TriggerOnOff.Text = "開啟"; driver.PoolingOnOff = false; } } EnumControlStatus status = driver.Status; label_DriverStatusValue.Text = status.ToString(); switch (status) { case EnumControlStatus.Initial: case EnumControlStatus.Error: case EnumControlStatus.NotReady: label_DriverStatusValue.ForeColor = Color.Red; break; case EnumControlStatus.ResetAlarm: label_DriverStatusValue.ForeColor = Color.Yellow; break; case EnumControlStatus.Ready: label_DriverStatusValue.ForeColor = Color.Green; break; default: label_DriverStatusValue.ForeColor = Color.DarkRed; break; } button_TriggerOnOff.Enabled = (localData.LoginLevel >= EnumLoginLevel.Engineer); LocateAGVPosition locateAGVPosition = null; if (index == -1) { locateAGVPosition = driver.GetLocateAGVPosition; } else { if (((LocateDriver)driver).LocateType == EnumLocateType.SLAM) { locateAGVPosition = ((LocateDriver_SLAM)driver).GetOriginAGVPosition; } else { switch (driver.DriverConfig.LocateDriverType) { case EnumLocateDriverType.BarcodeMapSystem: locateAGVPosition = ((LocateDriver_BarcodeMapSystem)driver).GetLocateAGVPositionByIndex(index); break; default: locateAGVPosition = driver.GetLocateAGVPosition; break; } } } if (locateAGVPosition != null) { if (((LocateDriver)driver).LocateType == EnumLocateType.SLAM) { label_SpecialTurnValue.ForeColor = Color.Green; } label_SpecialTurnValue.Text = locateAGVPosition.Value.ToString("0"); label_DataTypeValue.Text = locateAGVPosition.Type.ToString(); label_MapXValue.Text = locateAGVPosition.AGVPosition.Position.X.ToString("0.0"); label_MapYValue.Text = locateAGVPosition.AGVPosition.Position.Y.ToString("0.0"); label_MapThetaValue.Text = locateAGVPosition.AGVPosition.Angle.ToString("0.0"); } else { if (((LocateDriver)driver).LocateType == EnumLocateType.SLAM) { label_SpecialTurnValue.ForeColor = Color.Red; locateAGVPosition = ((LocateDriver_SLAM)driver).GetOriginAGVPosition; } if (locateAGVPosition != null) { label_SpecialTurnValue.Text = locateAGVPosition.Value.ToString("0"); } else { label_SpecialTurnValue.Text = ""; } label_DataTypeValue.Text = ""; label_MapXValue.Text = ""; label_MapYValue.Text = ""; label_MapThetaValue.Text = ""; } }