public LimbOrientation(SharedContent.BodyPartID limbID, Vector3D upperLimbInclination, Vector3D lowerLimbInclination) { this.limbID = limbID; this.upperLimbInclination = upperLimbInclination; this.lowerLimbInclination = lowerLimbInclination; this.bendInLimb = Vector3D.AngleBetween(upperLimbInclination, lowerLimbInclination); this.calibratedUpperLimbInclination = this.upperLimbInclination; this.calibratedLowerLimbInclination = this.lowerLimbInclination; this.calibratedBendInLimb = this.bendInLimb; }
public Exercise(SharedContent.Commands name, string description, Pose[] exercisePoses, ExerciseStep[] exerciseSteps) { this.currentStepIndex = 0; this.name = name; this.description = description; this.exercisePoses = exercisePoses; this.exerciseSteps = exerciseSteps; this.exerciseStatus = ExerciseStatus.NotStarted; this.statusMessage = "Waiting for user to assume the starting pose of the first exercise step"; }
public void unregisterSpeechCommand(SharedContent.Commands searchedCommand) { string searchedCommandString = SharedContent.GetCommandString(searchedCommand); for (int i = 0; i < commandDelegates.Length; i++) { if (SharedContent.CommandStrings[i] == searchedCommandString) { commandDelegates[i] = null; } } }
public LimbOrientation(SharedContent.BodyPartID limbID, SkeletonData bodyPartData) { this.limbID = limbID; this.upperLimbInclination = LimbOrientation.CalculateUpperLimbInclination(limbID, bodyPartData); this.upperLimbInclination.Normalize(); this.lowerLimbInclination = LimbOrientation.CalculateLowerLimbInclination(limbID, bodyPartData); this.lowerLimbInclination.Normalize(); this.bendInLimb = Vector3D.AngleBetween(this.upperLimbInclination, this.lowerLimbInclination); this.calibratedUpperLimbInclination = this.upperLimbInclination; this.calibratedLowerLimbInclination = this.lowerLimbInclination; this.calibratedBendInLimb = this.bendInLimb; }
public void registerSpeechCommand(SharedContent.Commands searchedCommand, SpeechCommandReceived commandDelegate) { if (sre == null) { initialize(); } string searchedCommandString = SharedContent.GetCommandString(searchedCommand); for (int i = 0; i < commandDelegates.Length; i++) { if (SharedContent.CommandStrings[i] == searchedCommandString) { commandDelegates[i] = commandDelegate; } } }
/// <summary> /// Returns an array of the joints comprising the limb, from upper joint to lower joint /// </summary> /// <param name="limbID"></param> /// <param name="bodyPartData"></param> /// <returns></returns> public static Vector[] GetLimbJoints(SharedContent.BodyPartID limbID, SkeletonData bodyPartData) { Vector[] limbJoints = new Vector[3]; switch (limbID) { case SharedContent.BodyPartID.RightArm: limbJoints[0] = bodyPartData.Joints[JointID.ShoulderRight].Position; limbJoints[1] = bodyPartData.Joints[JointID.ElbowRight].Position; limbJoints[2] = bodyPartData.Joints[JointID.HandRight].Position; break; case SharedContent.BodyPartID.LeftArm: limbJoints[0] = bodyPartData.Joints[JointID.ShoulderLeft].Position; limbJoints[1] = bodyPartData.Joints[JointID.ElbowLeft].Position; limbJoints[2] = bodyPartData.Joints[JointID.HandLeft].Position; break; case SharedContent.BodyPartID.RightLeg: limbJoints[0] = bodyPartData.Joints[JointID.HipRight].Position; limbJoints[1] = bodyPartData.Joints[JointID.KneeRight].Position; limbJoints[2] = bodyPartData.Joints[JointID.FootRight].Position; break; case SharedContent.BodyPartID.LeftLeg: limbJoints[0] = bodyPartData.Joints[JointID.HipLeft].Position; limbJoints[1] = bodyPartData.Joints[JointID.KneeLeft].Position; limbJoints[2] = bodyPartData.Joints[JointID.FootLeft].Position; break; } return limbJoints; }
public static Vector3D CalculateUpperLimbInclination(SharedContent.BodyPartID limbID, SkeletonData bodyPartData) { Vector[] limbJoints = LimbOrientation.GetLimbJoints(limbID, bodyPartData); return new Vector3D(limbJoints[1].X - limbJoints[0].X, limbJoints[1].Y - limbJoints[0].Y, limbJoints[1].Z - limbJoints[0].Z); }