Ejemplo n.º 1
0
 private void MoveControl_MoveCompleteEvent(object sender, Agv.EnumMoveComplete e)
 {
     try
     {
         var localData = LocalPackage.MainFlowHandler.localData;
         OnUpdatePositionArgsEvent?.Invoke(sender, new PositionArgs()
         {
             EnumLocalArrival = GetEnumLocalArrival(e),
             MapPosition      = new MapPosition()
             {
                 X = localData.Real.Position.X,
                 Y = localData.Real.Position.Y
             },
             HeadAngle       = (int)localData.Real.Angle,
             MovingDirection = (int)localData.MoveDirectionAngle,
             Speed           = (int)localData.MoveControlData.MotionControlData.LineVelocity
         });
     }
     catch (Exception ex)
     {
         OnLogErrorEvent?.Invoke(this, new MessageHandlerArgs()
         {
             ClassMethodName = GetType().Name + ":" + System.Reflection.MethodBase.GetCurrentMethod().Name,
             Message         = ex.Message
         });
     }
 }
Ejemplo n.º 2
0
        private void FakeMoveEngine()
        {
            while (true)
            {
                if (IsFakeMoveEnginePause)
                {
                    SpinWait.SpinUntil(() => !IsFakeMoveEnginePause, 1000);
                    continue;
                }

                try
                {
                    if (FakeMoveArrivalQueue.Any())
                    {
                        FakeMoveArrivalQueue.TryDequeue(out PositionArgs positionArgs);
                        OnUpdatePositionArgsEvent?.Invoke(this, positionArgs);
                    }
                    else
                    {
                        FakeMoveArrivalQueue.Enqueue(new PositionArgs()
                        {
                            EnumLocalArrival = EnumLocalArrival.Arrival,
                            MapPosition      = MoveStatus.LastMapPosition
                        });
                    }
                }
                catch (Exception ex)
                {
                    OnLogErrorEvent?.Invoke(this, new MessageHandlerArgs()
                    {
                        ClassMethodName = GetType().Name + ":" + System.Reflection.MethodBase.GetCurrentMethod().Name,
                        Message         = ex.Message
                    });
                }

                SpinWait.SpinUntil(() => false, 5000);
            }
        }
Ejemplo n.º 3
0
 private void MoveControl_PassAddressEvent(object sender, string addressId)
 {
     try
     {
         var address   = Vehicle.Instance.MapInfo.addressMap[addressId];
         var localData = LocalPackage.MainFlowHandler.localData;
         OnUpdatePositionArgsEvent?.Invoke(sender, new PositionArgs()
         {
             MapPosition      = address.Position,
             EnumLocalArrival = EnumLocalArrival.Arrival,
             HeadAngle        = (int)localData.Real.Angle,
             MovingDirection  = (int)localData.MoveDirectionAngle,
             Speed            = (int)localData.MoveControlData.MotionControlData.LineVelocity
         });
     }
     catch (Exception ex)
     {
         OnLogErrorEvent?.Invoke(this, new MessageHandlerArgs()
         {
             ClassMethodName = GetType().Name + ":" + System.Reflection.MethodBase.GetCurrentMethod().Name,
             Message         = ex.Message
         });
     }
 }