public void SetElbow(MotorController.utilities.Side hand, utilities.Position position) { switch (hand) { case MotorController.utilities.Side.Right: RightElbowPosition = position; break; case MotorController.utilities.Side.Left: LeftElbowPosition = position; break; } }
public MotorController.utilities.Position GetHandPosition(MotorController.utilities.Side hand) { MotorController.utilities.Position position = new utilities.Position(); switch (hand) { case MotorController.utilities.Side.Right: position = RightHandPosition; return(position); case MotorController.utilities.Side.Left: position = LeftHandPosition; return(position); default: return(new utilities.Position()); } }
/// <summary> /// get the fram body status and set my classes data from body parameter /// </summary> /// <param name="body">Body to get values from and fill the classes data </param> void SetBodyFrameValues(Body body) { #region Right and left #region elbow utilities.Position elbowPosition = new utilities.Position(); elbowPosition.x = body.Joints[JointType.ElbowRight].Position.X; elbowPosition.y = body.Joints[JointType.ElbowRight].Position.Y; elbowPosition.z = body.Joints[JointType.ElbowRight].Position.Z; elbow.SetElbow(utilities.Side.Right, elbowPosition); ////left Elbow elbowPosition.x = body.Joints[JointType.ElbowLeft].Position.X; elbowPosition.y = body.Joints[JointType.ElbowLeft].Position.Y; elbowPosition.z = body.Joints[JointType.ElbowLeft].Position.Z; elbow.SetElbow(utilities.Side.Left, elbowPosition); #endregion // elbow #region Wrist utilities.Position wristPosition = new utilities.Position(); wristPosition.x = body.Joints[JointType.WristRight].Position.X; wristPosition.y = body.Joints[JointType.WristRight].Position.Y; wristPosition.z = body.Joints[JointType.WristRight].Position.Z; wrist.SetWrist(utilities.Side.Right, wristPosition); ////left Wrist wristPosition.x = body.Joints[JointType.WristLeft].Position.X; wristPosition.y = body.Joints[JointType.WristLeft].Position.Y; wristPosition.z = body.Joints[JointType.WristLeft].Position.Z; wrist.SetWrist(utilities.Side.Left, wristPosition); #endregion // Wrist #region Shoulder /// Right Shoulder utilities.Position shoulderPosition = new utilities.Position(); shoulderPosition.x = body.Joints[JointType.ShoulderRight].Position.X; shoulderPosition.y = body.Joints[JointType.ShoulderRight].Position.Y; shoulderPosition.z = body.Joints[JointType.ShoulderRight].Position.Z; shoulder.SetShoulder(utilities.Side.Right, shoulderPosition); ////left Shoulder shoulderPosition.x = body.Joints[JointType.ShoulderLeft].Position.X; shoulderPosition.y = body.Joints[JointType.ShoulderLeft].Position.Y; shoulderPosition.z = body.Joints[JointType.ShoulderLeft].Position.Z; shoulder.SetShoulder(utilities.Side.Left, shoulderPosition); #endregion // Wrist #region HandsPositions clsHand.datachanged = true; /// Right Hand /// MotorController.utilities.Position handPosition = new utilities.Position(); handPosition.x = body.Joints[JointType.HandRight].Position.X; handPosition.y = body.Joints[JointType.HandRight].Position.Y; handPosition.z = body.Joints[JointType.HandRight].Position.Z; hand.SetHandPosition(MotorController.utilities.Side.Right, handPosition); hand.SetHandState(utilities.Side.Right, body.HandRightState); // left Hand handPosition.x = body.Joints[JointType.HandLeft].Position.X; handPosition.y = body.Joints[JointType.HandLeft].Position.Y; handPosition.z = body.Joints[JointType.HandLeft].Position.Z; hand.SetHandPosition(MotorController.utilities.Side.Left, handPosition); hand.SetHandState(utilities.Side.Left, body.HandLeftState); //End of setting Hands // Debug this.txtRitght = body.Joints[JointType.HandRight].Position.X.ToString(); this.txtLeft = body.Joints[JointType.HandLeft].Position.X.ToString(); #endregion //Hands positions #endregion // Right and left }