public CurrentLocation(byte[] data, ref int offset)
        {
            UInt32 curX = MyBitConverter.ToUInt32(data, ref offset);
            UInt32 curY = MyBitConverter.ToUInt32(data, ref offset);

            this.curNode = new CellPoint(curX, curY);
            UInt32 desX = MyBitConverter.ToUInt32(data, ref offset);
            UInt32 desY = MyBitConverter.ToUInt32(data, ref offset);

            this.desNode  = new CellPoint(desX, desY);
            this.speed    = MyBitConverter.ToUInt16(data, ref offset);
            this.moveDir  = (MoveDirection)data[offset++];
            this.agvAngle = new AgvDriftAngle(MyBitConverter.ToUInt16(data, ref offset));//车头方向采用的是高位在后
        }
Пример #2
0
        public byte[] GetBytes()
        {
            byte[] packData = new byte[19];
            int    offset   = 0;

            Buffer.BlockCopy(MyBitConverter.GetBytes(midPoint.X), 0, packData, offset, 4);
            offset += 4;
            Buffer.BlockCopy(MyBitConverter.GetBytes(midPoint.Y), 0, packData, offset, 4);
            offset += 4;
            Buffer.BlockCopy(MyBitConverter.GetBytes(desPoint.X), 0, packData, offset, 4);
            offset += 4;
            Buffer.BlockCopy(MyBitConverter.GetBytes(desPoint.Y), 0, packData, offset, 4);
            offset += 4;
            Buffer.BlockCopy(MyBitConverter.GetBytes(desAngle.Angle), 0, packData, offset, 2);
            offset            += 2;
            packData[offset++] = (byte)desMotion;
            return(packData);
        }