示例#1
0
        private void PlayNextVideo()
        {
            if (CurrentExercise != null)
            {
                CurrentExercise.CheckComplianceOfExercise(ExerciseVideo.Position.Seconds);
            }

            CurrentExercise = CurrentTraining.GetNextExercise();

            //if the current exercise is null = meaning the end of playlist
            if (CurrentExercise != null)
            {
                UpdatePlayerAfterExerciseChange();
            }

            //incase of ending the playlist
            else
            {
                CloseAllComponents();

                //show questionere pop-up
                OpenSummaryPopUp();

                //send compliance to server
                UpdateTrainingCompliance();
            }
        }
        public ExerciseService(SnapShot snap, CurrentExercise curr)
        {
            _snap      = snap;
            _curr      = curr;
            _exercises = new List <Tuple <string, Exercise> >();

            Exercise squat = new Exercise();

            squat.SetJoint(0, 90, 90, "Keep your hands straight forward!", "Keep your hands straight forward!", true);
            squat.SetJoint(1, 90, 180, "Raise your right arm!", "", true);
            squat.SetJoint(2, 90, 180, "Raise tour left arm!", "", true);
            squat.SetJoint(3, 90, 180, "", "", true);
            squat.SetJoint(4, 90, 180, "", "", true);
            squat.SetJoint(5, 90, 180, "", "", true);
            squat.SetJoint(6, 90, 180, "", "", true);
            _exercises.Add(Tuple.Create("Squat", squat));

            Exercise shoulderPress = new Exercise();

            shoulderPress.SetJoint(0, 130, 140, "", "", false);
            shoulderPress.SetJoint(1, -140, -70, "Don't put your left arm down too much!", "Raise your left arm to 90 degrees sideways", true);
            shoulderPress.SetJoint(2, 0, 0, "", "", false);
            shoulderPress.SetJoint(3, 0, 0, "", "", false);
            shoulderPress.SetJoint(4, 0, 0, "", "", false);
            shoulderPress.SetJoint(5, 102, 164, "Don't put your right arm down too much!", "Get your right arm all the way down!", true);
            shoulderPress.SetJoint(6, 125, 135, "", "", false);
            _exercises.Add(Tuple.Create("ShoulderPress", shoulderPress));

            Exercise leftLegBack = new Exercise();

            leftLegBack.SetJoint(0, 0, 0, "", "", false);
            leftLegBack.SetJoint(1, 0, 0, "", "", false);
            leftLegBack.SetJoint(2, 0, 0, "", "", false);
            leftLegBack.SetJoint(3, 81, 100, "Make sure your left leg goes back but not too much!", "Push your leg back but not too far!", true);
            leftLegBack.SetJoint(4, 63, 77, "Keep your right leg steady!", "Keep your right leg steady!", true);
            leftLegBack.SetJoint(5, 0, 0, "", "", false);
            leftLegBack.SetJoint(6, 0, 0, "", "", false);
            _exercises.Add(Tuple.Create("LeftLegBack", leftLegBack));
        }
示例#3
0
        private void StartTraceableMode()
        {
            SetUIInTrackingMode();

            //ExerciseVideo.Play();

            _sensor = KinectSensor.GetDefault();

            //todo - check, not working
            if (_sensor != null)
            {
                _sensor.Open();

                // 2) Initialize the background removal tool.
                _backgroundRemovalTool = new BackgroundRemovalTool(_sensor.CoordinateMapper);
                _drawSkeleton          = new DrawSkeleton(_sensor, (int)(KinectSkeleton.Width), (int)(KinectSkeleton.Height));

                _reader = _sensor.OpenMultiSourceFrameReader(FrameSourceTypes.Color | FrameSourceTypes.Depth | FrameSourceTypes.BodyIndex | FrameSourceTypes.Body);
                _reader.MultiSourceFrameArrived += Reader_MultiSourceFrameArrived;

                //Gesture detection
                Exercise tempExercise = CurrentExercise;

                _gestureAnalysis = new GestureAnalysis(ref tempExercise);
                _gestureDetector = new GestureDetector(_sensor, _gestureAnalysis, CurrentExercise);

                _gestureAnalysis.startGestureDeteced += _gestureAnalysis_startGestureDeteced;

                CurrentExercise.CreateRounds();

                //_timer.Start();
            }

            ExerciseVideo.Play();
            inPlayMode = true;
        }
 public SensorsDataController(SnapShot snap, CurrentExercise curr, MongoWriter writer)
 {
     _snap   = snap;
     _curr   = curr;
     _writer = writer;
 }