Exemplo n.º 1
0
        private void MiidlerInfo()
        {
            /// 充電相關資訊.
            ///
            bool 正在充電 = localData.MIPCData.Charging;
            /// SOC
            double soc      = localData.BatteryInfo.SOC;
            double 到站充電高水位  = localData.MIPCData.Config.ChargingSOC_High;
            double 在站點上充電水位 = localData.MIPCData.Config.ChargingSOC_Low;

            /// 這邊訊號在充電送出成功時就會on,會做delay,middler不用再做delay.
            /// 開始充電、結束充電.
            StartChargingByAddressID("48001??");
            StopCharging();

            /// 上報位置相關.

            /// 目前位置(座標)
            MapAGVPosition nowPosition = localData.Real;

            /// 這邊迷航是會是null 但如果config設定迷航時殘留上次數值,就會迷航前的資料.
            if (nowPosition != null)
            {
                double x     = nowPosition.Position.X;
                double y     = nowPosition.Position.Y;
                double angle = nowPosition.Angle;
            }

            double 移動方向  = localData.MoveDirectionAngle;
            double 移動速度  = localData.MoveControlData.MotionControlData.LineVelocity;
            bool   避車停止  = localData.MoveControlData.ReserveStop;
            bool   障礙物停止 = localData.MoveControlData.SafetySensorStop;

            bool AlarmBit = AlarmHandler.HasAlarm;

            bool Auto中 = (localData.AutoManual == EnumAutoState.Auto);

            /// Address Section Distance.

            VehicleLocation nowVehicleLocation = localData.Location;

            string NowSection = nowVehicleLocation.NowSection;
            /// 迷航時為空白.
            string LastAddress = nowVehicleLocation.LastAddress;
            /// 迷航時為空白.
            ///
            bool 是否在LastAddress上 = nowVehicleLocation.InAddress;

            double distance = nowVehicleLocation.DistanceFormSectionHead;


            /// 走行相關.
            /// 移動命令
            ///
            bool 現在可以下命令 = localData.MoveControlData.Ready && !localData.MoveControlData.ErrorBit;
            /// ErrorBit理論上等同AlarmHandler.HasAlarm,因此應該不會發生兩邊狀態不一致.

            bool 現在MoveControl有命令 = (localData.MoveControlData.MoveCommand != null);

            string errorMessage = "";

            MoveControl.VehicleMove(null, ref errorMessage);
            /// 這樣好了 你呼叫的地方就先打null沒關係 只是上面要有三行
            string        CommandID = "???";
            List <string> movingAddressList;
            List <string> movingSectionList;

            /// 停車.
            MoveControl.VehicleStop();

            /// Pause.Continue.

            MoveControl.VehiclePause();
            MoveControl.VehicleContinue();

            /// Cancel 下了會自己先pause在Stop.

            MoveControl.VehicleCancel();

            /// Override需要自己寫.



            /// 下面一個為完成上報,一個為過站上報.
            /// MoveControl.MoveCompleteEvent += MoveControl_MoveComplete;
            /// MoveControl.PassAddressEvent += MoveControl_PassAddress;



            /// 取放相關.
            /// 開始命令
            ///

            bool Fork現在可以下命令 = localData.LoadUnloadData.Ready && !localData.LoadUnloadData.ErrorBit;

            /// 可以視為友達版本的ForkHome訊號.

            /// LoadUnloadCommand(addressID, load or unload)
            /// return true = 開始執行, false = 無法執行
            ///
            /// 應該不會需要停止, 停止這樣下.
            /// 這邊要考慮一下 取放貨到底能不能中斷.
            StopLoadUnload();

            ///
            /// 取放 結束Event
            /// LoadUnloadControl.ForkCompleteEvent
            ///

            /// 更新loading 和CSTID
            UpdateLoadingAndCSTID();
            bool   臺車有貨物 = localData.LoadUnloadData.Loading;
            string 卡夾ID  = localData.LoadUnloadData.CstID;
        }