//------------------------------------------------------------------------------------------------------------------- // Constructor /// <summary> Extract right-handed coordinate system data from the SenseGlove DLL and convert it into Unity values. </summary> /// <param name="data"></param> /// <param name="packets"></param> /// <param name="totalCSteps"></param> /// <param name="currCStep"></param> public SenseGlove_Data(SenseGloveCs.GloveData data) { if (data != null) { this.dataLoaded = data.dataLoaded; this.gloveSide = SenseGlove_Data.GetSide(data.kinematics.isRight); this.deviceID = data.deviceID; this.firmwareVersion = data.firmwareVersion; this.gloveVersion = data.deviceVersion; this.gloveValues = data.gloveValues; this.imuValues = data.imuValues; this.imuCalibration = data.imuCalibration; this.packetsPerSecond = data.samplesPerSec; this.numberOfSensors = data.numberOfSensors; this.calibrationStep = data.currentCalStep; this.totalCalibrationSteps = data.totalCalSteps; this.absoluteCalibratedWrist = SenseGlove_Util.ToUnityQuaternion(data.wrist.QcalibratedAbs); this.absoluteWrist = SenseGlove_Util.ToUnityQuaternion(data.wrist.QwristAbs); this.relativeWrist = SenseGlove_Util.ToUnityQuaternion(data.wrist.Qrelative); this.commonOriginPos = SenseGlove_Util.ToUnityPosition(data.kinematics.gloveRelPos); this.commonOriginRot = SenseGlove_Util.ToUnityQuaternion(data.kinematics.gloveRelRot); SenseGlove_Data.GetChainVariables(ref data.kinematics.gloveLinks, ref this.glovePositions, ref this.gloveAngles, ref this.gloveRotations, ref this.gloveLengths); SenseGlove_Data.GetChainVariables(ref data.kinematics.fingers, ref this.handPositions, ref this.handAngles, ref this.handRotations, ref this.handLengths); } }
/// <summary> Extract right-handed coordinate system data from the SenseGlove DLL and convert it into Unity values. </summary> /// <param name="data"></param> /// <param name="packets"></param> /// <param name="totalCSteps"></param> /// <param name="currCStep"></param> public SenseGlove_Data(SenseGloveCs.GloveData data) { if (data != null) { this.gloveSide = SenseGlove_Data.GetSide(data.kinematics.isRight); this.deviceID = data.deviceID; this.firmwareVersion = data.firmwareVersion; this.gloveVersion = data.deviceVersion; this.packetsPerSecond = data.samplesPerSec; this.commonOriginPos = SenseGlove_Util.ToUnityPosition(data.kinematics.gloveRelPos); this.commonOriginRot = SenseGlove_Util.ToUnityQuaternion(data.kinematics.gloveRelRot); this.UpdateVariables(data); } }