Пример #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            string fullpath1 = "P-1-S-53-N-49-W-48-W-47-W-46-N-25-N-4-W-3-S-11-G-D-2";

            //string fullpath = "N,0,S,11,N,3,W,0,S,42,E,46,G,N,0";
            Communication.SendPathData(fullpath1);
        }
Пример #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            string fullpath1 = "N-0-N-55-N-46-E-47-E-48-E-49-S-53-G-N-0";

            //string fullpath = "N,0,S,11,N,3,W,0,S,42,E,46,G,N,0";
            Communication.SendPathData(fullpath1);
            //delay();
        }
Пример #3
0
        private static void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            //string fullpath = "N,0,N,46,E,50,N,8,W,3,S,11,G,N,0";
            string fullpath = "P-2-S-53-N-49-W-44-N-37-G-D-3";

            Communication.SendPathData(fullpath);
            ((System.Timers.Timer)sender).Dispose();
        }
Пример #4
0
        public static void UpdatePathFromTaskOfAGV(AGV agv)
        {
            if (agv.Tasks.Count != 0)
            {
                Task currentTask = agv.Tasks[0];
                if (currentTask.Status == "Waiting")
                {
                    Debug.WriteLine("AAAAA");
                    agv.Path.Clear();
                    agv.Path.Add(Algorithm.A_starFindPath(Node.ListNode, Node.MatrixNodeDistance, agv.CurrentNode, agv.Tasks[0].PickNode));
                    AGV.FullPathOfAGV[agv.ID] = "N-0-" + agv.CurrentOrient + "-" + Navigation.GetNavigationFrame(agv.Path[0], Node.MatrixNodeOrient) + "-N-0";
                    Communication.SendPathData(AGV.FullPathOfAGV[agv.ID]);
                    Display.UpdateComStatus("send", agv.ID, "Send Path 1", Color.Green);

                    // if(DashboardForm.timerToSendPathAgain.Enabled == false)
                    //   DashboardForm.timerToSendPathAgain.Start();

                    //  agv.Tasks[0].Status = "Doing";
                    agv.PathCopmpleted = 0;
                    //  agv.Status = "Running";
                }
                else if (agv.CurrentNode == currentTask.PickNode && currentTask.Status == "Doing" && agv.PathCopmpleted == 1)
                {
                    Debug.WriteLine("BBBB");
                    agv.Path.RemoveAt(0);
                    agv.Path.Add(Algorithm.A_starFindPath(Node.ListNode, Node.MatrixNodeDistance, agv.CurrentNode, agv.Tasks[0].DropNode));
                    string pick, drop;
                    if (currentTask.PickLevel == 1 || currentTask.PickLevel == 2 || currentTask.PickLevel == 3)
                    {
                        pick = "P-" + currentTask.PickLevel.ToString() + "-";
                    }
                    else
                    {
                        pick = "N-0-";
                    }
                    if (currentTask.DropLevel == 1 || currentTask.DropLevel == 2 || currentTask.DropLevel == 3)
                    {
                        drop = "-D-" + currentTask.DropLevel.ToString();
                    }
                    else
                    {
                        drop = "-N-0";
                    }
                    AGV.FullPathOfAGV[agv.ID] = pick + agv.CurrentOrient + "-" + Navigation.GetNavigationFrame(agv.Path[0], Node.MatrixNodeOrient) + drop;
                    Communication.SendPathData(AGV.FullPathOfAGV[agv.ID]);

                    Display.UpdateComStatus("send", agv.ID, "Send Path 2", Color.Green);

                    // if (DashboardForm.timerToSendPathAgain.Enabled == false)
                    //    DashboardForm.timerToSendPathAgain.Start();

                    //  agv.PathCopmpleted = 2;
                }
                else if (agv.CurrentNode == currentTask.DropNode && currentTask.Status == "Doing" && agv.PathCopmpleted == 3)
                {
                    Debug.WriteLine("CCCC");
                    agv.Tasks.RemoveAt(0);
                    agv.Path.Clear();
                    agv.Status = "Stop";
                }
            }
        }