Exemplo n.º 1
0
        public void GenerateDataPacket_ValidAzimutDelta_CorrectDifference()
        {
            double packetAzimuthAngleDelta = 2;
            double blockDelta = packetAzimuthAngleDelta / 12;

            LidarFormatPacketGenerator packetGenerator = new LidarFormatPacketGenerator(0, 0, packetAzimuthAngleDelta);

            byte[] packet1 = packetGenerator.GenerateDataPacket(azimuth: 10, packetStartDistance: 0);
            byte[] packet2 = packetGenerator.GenerateDataPacket(azimuth: 10 + packetAzimuthAngleDelta, packetStartDistance: 0);

            List <double> horizontalAngles = GetHorizontalAnglesFromPackets(packet1);

            horizontalAngles.AddRange(GetHorizontalAnglesFromPackets(packet2));

            for (int i = 1; i < horizontalAngles.Count; i++)
            {
                Assert.Equal(blockDelta, horizontalAngles[i] - horizontalAngles[i - 1], 1);
            }
        }
Exemplo n.º 2
0
        private Queue <byte[]> ConvertDistancesToByteArray(float[] distancesAsFloats)
        {
            Queue <byte[]> dataPackets = new Queue <byte[]>();

            for (int i = 0; i < distancesAsFloats.Length; i++)
            {
                dataPackets.Enqueue(_packetGenerator.GenerateDataPacket(azimuth: i, packetStartDistance: distancesAsFloats[i]));
            }

            return(dataPackets);
        }
Exemplo n.º 3
0
        public async Task <Queue <byte[]> > GetQueueOfDataPacketsAsync(byte numberOfCycles)
        {
            int packetsToGenerate = 60;

            Queue <byte[]> dataPackets = new Queue <byte[]>();

            for (int i = 0; i < packetsToGenerate; i++)
            {
                dataPackets.Enqueue(_packetGenerator.GenerateDataPacket(_packetAzimuthAngleDelta * i, _packetDeltaDistance * i));
            }

            await Task.Delay(600);

            return(dataPackets);
        }