/// <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); } }
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); }
public InertialSensorData(InertialSensorData c) { this.accelarometers = new short[c.accelarometers.Length]; for (int i = 0; i < this.accelarometers.Length; i++) { this.accelarometers[i] = c.accelarometers[i]; } this.gyropscopes = new short[c.gyropscopes.Length]; for (int i = 0; i < this.gyropscopes.Length; i++) { this.gyropscopes[i] = c.gyropscopes[i]; } this.quaternion = new int[c.quaternion.Length]; for (int i = 0; i < this.quaternion.Length; i++) { this.quaternion[i] = c.quaternion[i]; } this.NowInTicks = c.NowInTicks; this.section = c.section; }
public void OnISDNewTData(object sender, InertialSensorData e) { this.ISDQuatQueue.Add(e.QuaternionAsQMD3); }