public SensorFusion(RiftHeadsetDevice sensor = null) { Stage = 0; RunningTime = 0; DeltaT = 0.001f; Gain = 0.05f; EnableGravity = true; EnablePrediction = true; PredictionDT = 0.03f; PredictionTimeIncrement = 0.001f; FRawMag = new SensorFilter(10); FAngV = new SensorFilter(20); GyroOffset = new Vector3f(); TiltAngleFilter = new SensorFilterBase_float(1000); EnableYawCorrection = false; MagCalibrated = false; MagNumReferences = 0; MagRefIdx = -1; MagRefScore = 0; MotionTrackingEnabled = true; if (sensor != null) AttachToSensor(sensor); MagCalibrationMatrix = new Matrix4f(); MagCalibrationMatrix.SetIdentity(); }
// *** Setup // Attaches this SensorFusion to a sensor device, from which it will receive // notification messages. If a sensor is attached, manual message notification // is not necessary. Calling this function also resets SensorFusion state. public bool AttachToSensor(RiftHeadsetDevice sensor) { // clear the cached device information CachedSensorInfo = sensor.GetDeviceInfo(); // save the device information Reset(); // Automatically load the default mag calibration for this sensor //LoadMagCalibration(); return true; }