/// <summary>
        /// Grabs data from accelerometer and gyroscope,normalizes it, and stores it into buffer for comparison later
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnActualSensorNewTData(object sender, InertialSensorData e)
        {
            //TO DO: If data gets pulled into buffer for comparison, it gets tagged with section ID

            //getting acceleration data from accelerometer/gyroscope
            const double angularConst = Math.PI / (16.4 * 180.0);

            double xAcc = e.AccelerationAsVMD3.X;
            double yAcc = e.AccelerationAsVMD3.Y;
            double zAcc = e.AccelerationAsVMD3.Z;


            double xRot = (double)e.gyropscopes[0] * angularConst;
            double yRot = (double)e.gyropscopes[1] * angularConst;
            double zRot = (double)e.gyropscopes[2] * angularConst;

            double[]         tempAngularActualAcc = new double[] { xRot, yRot, zRot };
            double[]         tempActualAcc        = new double[] { xAcc, yAcc, zAcc };
            AccelerationTime tempActualAccTime    = new AccelerationTime();

            tempActualAccTime.setVal(tempActualAcc, tempAngularActualAcc, e.NowInTicks);

            if (!LastVirtualFiltered)
            {
                actualAcc.Enqueue(tempActualAccTime);
            }
        }
Exemple #2
0
        private void OnIdealSensorNewTData(object sender, VirtualSensorData e)
        {
            //derivation and store into buffer
            AccelerationTime t = new AccelerationTime();

            t.setVal(e.acceleration, e.NowInTicks);
        }
        private void MyFunctionToDealWithGettingData(object sender, InertialSensorData e)
        {
            const double angularConst = Math.PI / (16.4 * 180);
            //getting acceleration data from sensors
            double xAcc = (double)e.Accelarometers[0] / 2080;
            double yAcc = (double)e.Accelarometers[1] / 2080;
            double zAcc = (double)e.Accelarometers[2] / 2080;

            double xRot = (double)e.gyropscopes[0] * angularConst;
            double yRot = (double)e.gyropscopes[1] * angularConst;
            double zRot = (double)e.gyropscopes[2] * angularConst;

            double[]         tempAngularActualAcc = new double[] { xRot, yRot, zRot };
            double[]         tempActualAcc        = new double[] { xAcc, yAcc, zAcc };
            AccelerationTime tempActualAccTime    = new AccelerationTime();

            tempActualAccTime.setVal(tempActualAcc, tempAngularActualAcc, e.NowInTicks);

            actualAcc.Enqueue(tempActualAccTime);
        }
        /// <summary>
        /// Stores virtual accleration data into buffer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnIdealSensorNewTData(object sender, VirtualSensorData e)
        {
            //TO DO: IF data gets pulled into buffer, gets tagged with section ID? Wait.. thought we were tagging all data touched??
            //regardless, no longer doing this here.
            //e.section = this.CalibrationCount;
            //DataTracker.CurrentSection = DataTracker.SectionCounter;
            //derivation and store into buffer
            AccelerationTime t = new AccelerationTime();



            if (ICherryPicker.isDataGood(e.acceleration, !e.isinferredornottracked))
            {
                //IF THIS CONDITIONAL IS CHANGED, IT MUST ALSO BE CHANGED IN THE DATA PRODUCERS.
                t.setVal(e.acceleration, e.NowInTicks, !e.isinferredornottracked);  //if it's good, assign the proper current value - maybe we need to move this if statement to sensor producer
                virtualAcc.Enqueue(t);
                LastVirtualFiltered = false;
            }
            else
            {
                LastVirtualFiltered = true;
                //DataTracker.CurrentSection = 0;
            }
        }