예제 #1
0
        /// <summary>
        /// Prueft die history, ob die jeweilige Bewegung ausgelöst wird oder nicht.
        /// </summary>
        /// <param name="history">The history.</param>
        /// <returns></returns>
        public ErkennerStatus Pruefe(Skeleton[] history)
        {
            var headY = history.Select(x => x.Joints[JointType.Head].Position.Y);
            var leftFootY = history.Select(x => x.Joints[JointType.FootLeft].Position.Y);

            bool unten = (headY.Max() - headY.First() > 0.15) && (leftFootY.First() - leftFootY.Min()) < 0.02;
            bool oben = (headY.First() - headY.Min() > 0.1) && (leftFootY.Max()-leftFootY.First()) < 0.02;

            if (Blocked)
            {
                if (BlockStopwatch.ElapsedMilliseconds > 700)
                {
                    Blocked = false;
                    BlockStopwatch = null;
                }
            }

            if (!Blocked)
            {
                if (_geduckt && oben)
                {
                    _geduckt = false;
                    MotionFunctions.SendAction(MotionFunctions.DownUp());
                    return ErkennerStatus.NichtAktiv;
                }
                if (!_geduckt && unten)
                {
                    _geduckt = true;
                    MotionFunctions.SendAction(MotionFunctions.DownDown());
                    return ErkennerStatus.Aktiv;
                }
            }

            return _geduckt ? ErkennerStatus.Aktiv : ErkennerStatus.NichtAktiv;
        }
예제 #2
0
        /// <summary>
        /// Prueft die history, ob die jeweilige Bewegung ausgelöst wird oder nicht.
        /// </summary>
        /// <param name="history">The history.</param>
        /// <returns></returns>
        public ErkennerStatus Pruefe(Skeleton[] history)
        {
            var rightFootZ = history.Select(x => x.Joints[JointType.FootRight].Position.Z);
            var rightFootY = history.Select(x => x.Joints[JointType.FootRight].Position.Y);

            Ok = rightFootZ.Max() > rightFootZ.First() + 0.5 && (rightFootY.First() > rightFootY.Min() + 0.2);

            return ErkennerHandler.SinglePress(this);
        }
예제 #3
0
        /// <summary>
        /// Prueft die history, ob die jeweilige Bewegung ausgelöst wird oder nicht.
        /// </summary>
        /// <param name="history">The history.</param>
        /// <returns></returns>
        public ErkennerStatus Pruefe(Skeleton[] history)
        {
            var leftFootY = history.Select(x => x.Joints[JointType.FootLeft].Position.Y);
            var rightFootY = history.Select(x => x.Joints[JointType.FootRight].Position.Y);

            Ok = (leftFootY.First() - leftFootY.Min()> Paramters.JumpSchwelle) &&
                (rightFootY.First() - rightFootY.Min() > Paramters.JumpSchwelle);

            return ErkennerHandler.SinglePress(this);
        }
예제 #4
0
        /// <summary>
        /// Prueft die history, ob die jeweilige Bewegung ausgelöst wird oder nicht.
        /// </summary>
        /// <param name="history">The history.</param>
        /// <returns></returns>
        public ErkennerStatus Pruefe(Skeleton[] history)
        {
            var leftHandZ    = history.Select(x => x.Joints[JointType.HandLeft].Position.Z);
            var leftHandY    = history.Select(x => x.Joints[JointType.HandLeft].Position.Y);
            var leftShoulderY = history.Select(x => x.Joints[JointType.ShoulderLeft].Position.Y);
            var rightHandZ     = history.Select(x => x.Joints[JointType.HandRight].Position.Z);

            Ok = leftHandZ.First() < leftHandZ.Max() - 0.27 && (leftHandY.First() < leftShoulderY.First() + 0.1) && (rightHandZ.Max() - rightHandZ.First() < 0.15);

            return ErkennerHandler.SinglePress(this);
        }
예제 #5
0
        public ErkennerStatus Pruefe(Skeleton[] history)
        {
            var rightHandZ = history.Select(x => x.Joints[JointType.HandRight].Position.Z);
            var leftHandZ = history.Select(x => x.Joints[JointType.HandLeft].Position.Z);

            Ok = (rightHandZ.Max() - rightHandZ.First()  > Paramters.rhWieWeitNachVorneMitDenHaenden)
                 && (leftHandZ.Max() - leftHandZ.First() > Paramters.rhWieWeitNachVorneMitDenHaenden)
                 && (leftHandZ.First() - leftHandZ.First() < Paramters.rhWieParallelDieHaendeSeinSollten);

            return ErkennerHandler.SinglePress(this);
        }
예제 #6
0
        /// <summary>
        /// Prueft die history, ob die jeweilige Bewegung ausgelöst wird oder nicht.
        /// </summary>
        /// <param name="history">The history.</param>
        /// <returns></returns>
        public ErkennerStatus Pruefe(Skeleton[] history)
        {
            var rightFootX = history.Select(x => x.Joints[JointType.FootRight].Position.X);
            var leftFootX = history.Select(x => x.Joints[JointType.FootLeft].Position.X);

            bool rechts = rightFootX.Min() + Paramters.RlAktivierungsSchwelle < rightFootX.First() && (leftFootX.Max() - leftFootX.Min()) < Paramters.RlAndereFussLimite;
            bool mitte = Math.Abs(rightFootX.First() - leftFootX.First()) < Paramters.RlMitteSchwellenwert;

            if (_rechtsLaufend && mitte)
            {
                _rechtsLaufend = false;
                MotionFunctions.SendAction(MotionFunctions.RightUp());
                return ErkennerStatus.NichtAktiv;
            }
            if (!_rechtsLaufend && rechts)
            {
                _rechtsLaufend = true;
                MotionFunctions.SendAction(MotionFunctions.RightDown());
                return ErkennerStatus.Aktiv;
            }
            return _rechtsLaufend ? ErkennerStatus.Aktiv : ErkennerStatus.NichtAktiv;
        }
예제 #7
0
 private void RemoveUnusedMarkers(Skeleton[] skeletons)
 {
     _skeletonTrackingIds.ForEach(id =>
         {
             if (!skeletons.Select(s => s.TrackingId).Contains(id))
             {
                 var marker = canvas.FindName(BaseMarkerName + id) as Ellipse;
                 if (marker != null)
                 {
                     canvas.Children.Remove(marker);
                 }
             }
         });
 }
예제 #8
0
        /// <summary>
        /// Prueft die history, ob die jeweilige Bewegung ausgelöst wird oder nicht.
        /// </summary>
        /// <param name="history">The history.</param>
        /// <returns></returns>
        public ErkennerStatus Pruefe(Skeleton[] history)
        {
            var rightHandY    = history.Select(x => x.Joints[JointType.HandRight].Position.Y);
            var rightHandX = history.Select(x => x.Joints[JointType.HandRight].Position.X);
            var headX = history.Select(x => x.Joints[JointType.Head].Position.X);
            var leftShoulderY = history.Select(x => x.Joints[JointType.ShoulderLeft].Position.Y);

            Ok = rightHandX.First() < rightHandX.Max() - 0.2 && (rightHandY.First() > leftShoulderY.First()) && (rightHandX.First() < headX.First() - 0.2);

            return ErkennerHandler.SinglePress(this);
        }
예제 #9
0
        private void k_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            using (var s = e.OpenSkeletonFrame())
            {
                if (s == null)
                    return;

                var t = e.OpenSkeletonFrame();

                // No skeleton yet
                if (t == null) return;

                var v = new Skeleton[t.SkeletonArrayLength];
                s.CopySkeletonDataTo(v);

                // Find tracked heads
                foreach (var head in
                        v.Select(sk => sk.Joints[JointType.Head]).Where(head => head.TrackingState != JointTrackingState.NotTracked))
                {
                    // Move the laser and shoot!
                    _lastX = head.Position.X;
                    _lastY = head.Position.Y;
                    _lastZ = head.Position.Z;

                    // Nothing more to do
                    return;
                }
            }
        }