Ejemplo n.º 1
0
 protected bool checkAnyRobotAtElevator(RobotUnity robot)
 {
     foreach (RobotUnity ar in robotService.RobotUnityRegistedList.Values)
     {
         if (this.traffic.RobotIsInArea("ELEVATOR", ar.properties.pose.Position))
         {
             robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_STOP, true);
             return(true);
         }
     }
     robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_NORMAL, false);
     return(false);
 }
Ejemplo n.º 2
0
 protected bool TrafficCheckInBuffer(Pose frontLinePoint, int bayId)
 {
     if (ExtensionService.CalDistance(robot.properties.pose.Position, frontLinePoint.Position) < DISTANCE_CHECk_BAYID)
     {
         /* if (robot.bayId < 0)
          * {
          *   robot.bayId = bayId;
          * }*/
         List <RobotUnity> rCompList = checkAllRobotsHasInsideBayIdNear(bayId, 2);
         if (rCompList == null) // đã có 1 robot đã đăng ký thành công bayid
         {
             robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_STOP, true);
             return(true);// tiep tuc check
         }
         if (rCompList.Count > 0)
         {
             // so sanh vi tri robot voi robot con lai
             if (checkRobotToFrontLineDistanceCtrl(robot, rCompList, frontLinePoint.Position))
             {
                 robot.bayIdReg = true;
                 robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_NORMAL, false);
                 return(false); // ket thuc check
             }
             else
             {
                 robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_STOP, true);
                 return(true); // tiep tuc check
             }
         }
         else
         {
             robot.bayIdReg = true;
             robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_NORMAL, false);
             return(false);// tiep tuc check
         }
     }
     else
     {
         robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_NORMAL, false);
         return(false);// tiep tuc check
     }
 }
        protected bool TrafficCheckInBuffer(Pose frontLinePoint, int bayId)
        {
            // khu vực check in

            List <Point> ListZonePo123 = new List <Point>();
            List <Point> ListAkas123   = new List <Point>();

            // tìm vị trí đầu line có nằm trong khu vực check in
            // nếu có trong check in kiểm tra đã tới vùng check in chưa // check in chia ra cho từng vủng
            // đã tới check in check tiếp vị trí robot khác trong vùng này đang làm việc

            // PO123  { -49,-9}  {-11,-9}  {-11,-23}  {-49,-23}
            // CHECKINPO123_JUJ   {-49,-6} {-39,-6} {-39,-13} {-49,-13}
            // CHECKINPO123_VLP   {-64,-9} {-49,-9} {-49,-18} {-64,-18}
            // AKAS123  { -11,-9}  {6,-9}  {6,-23}  {-11,-23}
            // CHECKINAKAS123 {-12,-6} {-5,-6} {-5,-13} {-12,-13}
            // JULEVO/CHECKINPO123_VLP   {-64,-9} {-49,-9} {-49,-18} {-64,-18}
            // CHECKINJULEVO {-64,-6} {-57,-6} {-57,-13} {-64,-13}


            Point rPFrontLine = frontLinePoint.Position;
            Point rP          = robot.properties.pose.Position;

            if (this.traffic.RobotIsInArea("PO123", rPFrontLine))
            {
                if (this.traffic.RobotIsInArea("CHECKINPO123_JUJ", rP))
                {
                    if (this.traffic.HasOtherRobotUnityinArea("PO123", robot))
                    {
                        robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_STOP, true);
                        return(true);// tiep tuc check
                    }
                    else
                    {
                        robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_NORMAL, false);
                        return(false); // ket thuc check
                    }
                }
                else if (this.traffic.RobotIsInArea("CHECKINPO123_VLP", rP))
                {
                    if (this.traffic.HasOtherRobotUnityinArea("PO123", robot) || this.traffic.HasOtherRobotUnityinArea("CHECKINPO123_JUJ", robot))
                    {
                        robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_STOP, true);
                        return(true);// tiep tuc check
                    }
                    else
                    {
                        robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_NORMAL, false);
                        return(false); // ket thuc check
                    }
                }
            }
            else if (this.traffic.RobotIsInArea("AKAS123", rPFrontLine))
            {
                if (this.traffic.RobotIsInArea("CHECKINAKAS123", rP))
                {
                    if (this.traffic.HasOtherRobotUnityinArea("AKAS123", robot))
                    {
                        robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_STOP, true);
                        return(true);// tiep tuc check
                    }
                    else
                    {
                        robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_NORMAL, false);
                        return(false); // ket thuc check
                    }
                }
            }
            else if (this.traffic.RobotIsInArea("JULEVO", rPFrontLine))
            {
                if (this.traffic.RobotIsInArea("CHECKINJULEVO", rP))
                {
                    if (this.traffic.HasOtherRobotUnityinArea("JULEVO", robot))
                    {
                        robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_STOP, true);
                        return(true);// tiep tuc check
                    }
                    else
                    {
                        robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_NORMAL, false);
                        return(false); // ket thuc check
                    }
                }
            }

            robot.SetSpeedHighPrioprity(RobotSpeedLevel.ROBOT_SPEED_NORMAL, false);
            return(false);// tiep tuc check
        }