private void OnTimerTick(object sender, EventArgs e)
        {
            // Subsequent load, update point positions using a sort of brownian motion by using random
            //

            // Access Raw 'arrays' to the inner data series. This is the fastest way to read and access data, however
            // any operations will not be thread safe, and will not trigger a redraw. This is why we invalidate below
            //
            // See also XyzDataSeries.Append, Update, Remove, Insert which are atomic operations
            //
            // Note that the count of raw arrays may be greater than _xyzData.Count
            double[] xDataRaw = _xyzData.XValues.ToUncheckedList();
            double[] yDataRaw = _xyzData.YValues.ToUncheckedList();
            double[] zDataRaw = _xyzData.ZValues.ToUncheckedList();

            // Update the data positions simulating 3D random walk / brownian motion
            for (int i = 0, count = _xyzData.Count; i < count; i++)
            {
                xDataRaw[i] += _random.NextDouble() - 0.5;
                yDataRaw[i] += _random.NextDouble() - 0.5;
                zDataRaw[i] += _random.NextDouble() - 0.5;
            }

            // Raise DataSeriesChanged event and trigger chart updates
            _xyzData.IsDirty = true;
            _xyzData.OnDataSeriesChanged(DataSeriesUpdate.DataChanged, DataSeriesAction.Update);
        }
Esempio n. 2
0
        private void processRealSenseData(String messageIn)
        {
            messageIn = messageIn.Substring(15);
            string[] data1 = messageIn.Split(",");

            //Append(deviceAcc[0].Count, float.Parse(data1[0]));
            realSenseVel[0].Append(realSenseVel[0].Count, float.Parse(data1[0]));
            realSenseVel[1].Append(realSenseVel[1].Count, float.Parse(data1[1]));
            realSenseVel[2].Append(realSenseVel[2].Count, (float)(float.Parse(data1[2]) / 10000.0));

            var   random      = new Random(0);
            Color?randomColor = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));

            realSensePositionVec.Append(float.Parse(data1[3]), float.Parse(data1[4]), float.Parse(data1[5]), new PointMetadata3D(randomColor, 1));
            realSensePositionVec.OnDataSeriesChanged(DataSeriesUpdate.DataChanged, DataSeriesAction.Update);
        }
Esempio n. 3
0
        private void processGraphData(String messageIn)
        {
            messageIn = messageIn.Substring(10);
            string[] data1 = messageIn.Split(",");

            //Append(deviceAcc[0].Count, float.Parse(data1[0]));
            deviceAcc[0].Append(deviceAcc[0].Count, float.Parse(data1[1]));
            deviceAcc[1].Append(deviceAcc[1].Count, float.Parse(data1[2]));
            deviceAcc[2].Append(deviceAcc[2].Count, float.Parse(data1[2]));

            worldAcc[0].Append(worldAcc[0].Count, float.Parse(data1[3]));
            worldAcc[1].Append(worldAcc[1].Count, float.Parse(data1[4]));
            worldAcc[2].Append(worldAcc[2].Count, float.Parse(data1[5]));

            deviceVel[0].Append(deviceVel[0].Count, float.Parse(data1[6]));
            deviceVel[1].Append(deviceVel[1].Count, float.Parse(data1[7]));
            deviceVel[2].Append(deviceVel[2].Count, float.Parse(data1[8]));

            worldVel[0].Append(worldVel[0].Count, float.Parse(data1[9]));
            worldVel[1].Append(worldVel[1].Count, float.Parse(data1[10]));
            worldVel[2].Append(worldVel[2].Count, float.Parse(data1[11]));


            if (count % 10 == 0)
            {
                var   random      = new Random(0);
                Color?randomColor = Color.FromArgb(0xFF, (byte)random.Next(50, 255), (byte)random.Next(50, 255), (byte)random.Next(50, 255));
                positionVec.Append(float.Parse(data1[12]), float.Parse(data1[13]), float.Parse(data1[14]), new PointMetadata3D(randomColor, 1));
                positionVec.OnDataSeriesChanged(DataSeriesUpdate.DataChanged, DataSeriesAction.Update);
            }

            //positionVec.IsDirty = true;

            compassAngle        = float.Parse(data1[15]);
            deviceTiltAngle     = float.Parse(data1[16]);
            cameraPointingAngle = float.Parse(data1[17]) - 90;
        }