private static void timer5_Elapsed(object sender, System.Timers.ElapsedEventArgs e, AGVInitPacket sendFrame)
        {
            AGVInitPacket resendFrame = sendFrame;

            if (ackReceived.AGVID == resendFrame.AGVID &&
                ackReceived.FunctionCode == (byte)FUNC_CODE.RESP_ACK_INIT &&
                ackReceived.ACK == (byte)'Y')
            {
                ackReceived = default(AckReceivePacket);
                ((System.Timers.Timer)sender).Dispose();
                return;
            }

            var agv = AGV.ListAGV.Find(a => a.ID == (int)resendFrame.AGVID);

            if (agv == null)
            {
                return;
            }
            try { Communicator.SerialPort.Write(resendFrame.ToArray(), 0, resendFrame.ToArray().Length); }
            catch { return; }

            // Display ComStatus
            Display.UpdateComStatus("timeout", resendFrame.AGVID, "Initialize", System.Drawing.Color.Red);
            Display.UpdateComStatus("send", resendFrame.AGVID, "Initialize", System.Drawing.Color.Blue);
        }
        public static void SendAGVInitRequest(uint agvID)
        {
            AGVInitPacket sendFrame = new AGVInitPacket();

            sendFrame.Header = new byte[2] {
                0xAA, 0xFF
            };
            sendFrame.FunctionCode   = (byte)FUNC_CODE.REQ_AGV_INIT;
            sendFrame.AGVID          = Convert.ToByte(agvID);
            sendFrame.Initialization = (byte)'I';
            // calculate check sum
            ushort crc = 0;

            crc += sendFrame.Header[0];
            crc += sendFrame.Header[1];
            crc += sendFrame.FunctionCode;
            crc += sendFrame.AGVID;
            crc += sendFrame.Initialization;
            sendFrame.CheckSum   = crc;
            sendFrame.EndOfFrame = new byte[2] {
                0x0A, 0x0D
            };

            // send data via serial port
            try { Communicator.SerialPort.Write(sendFrame.ToArray(), 0, sendFrame.ToArray().Length); }
            catch { };

            // Display ComStatus
            Display.UpdateComStatus("send", sendFrame.AGVID, "Initialize", System.Drawing.Color.Blue);

            // wait ack
            System.Timers.Timer timer5 = new System.Timers.Timer(timeout);
            timer5.Elapsed += (sender, e) => timer5_Elapsed(sender, e, sendFrame);
            timer5.Start();
        }