/// <summary> Updates all variables that can change during the simulation.</summary> /// <param name="data"></param> public void UpdateVariables(SenseGloveCs.GloveData data) { this.dataLoaded = data.dataLoaded; this.deviceID = data.deviceID; this.gloveValues = data.gloveValues; this.imuValues = data.imuValues; this.imuCalibration = data.imuCalibration; this.numberOfSensors = data.numberOfSensors; this.packetsPerSecond = data.samplesPerSec; 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); 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); }
//------------------------------------------------------------------------------------------------------------------- // 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); } }