Example #1
0
        public void Should_go_to_next_step()
        {
            var step = 0;
            var b    = new Gesture();

            b.AddStep(50000, Movement.Forward(_cam.LeftHand, 10), Movement.Forward(_cam.RightHand, 10));
            b.AddStep(50000, Movement.Left(_cam.LeftHand, 10), Movement.Right(_cam.RightHand, 10));
            b.NextStep += (s, a) => {
                step = a.Step;
            };
            b.Activate();

            _cam.MoveLeftHandZ(30);
            _cam.MoveLeftHandZ(20);
            _cam.MoveRightHandZ(30);
            _cam.MoveRightHandZ(20);

            Assert.AreEqual(1, step);
        }
Example #2
0
        public void Simple_swipe_left()
        {
            var detected = true;
            var b        = new Gesture();

            b.AddStep(50000, Movement.Left(_cam.LeftHand, 10));
            b.GestureDetected += (s, a) => {
                detected = true;
            };
            b.Activate();
            Assert.IsTrue(detected);
        }
Example #3
0
        public void Should_notify_gesture()
        {
            var detected = true;
            var b        = new Gesture();

            b.AddStep(50000, Movement.Forward(_cam.LeftHand, 10), Movement.Forward(_cam.RightHand, 10));
            b.AddStep(50000, Movement.Left(_cam.LeftHand, 10), Movement.Right(_cam.RightHand, 10));
            b.GestureDetected += (s, a) => {
                detected = true;
            };
            b.Activate();

            _cam.MoveLeftHandZ(30);
            _cam.MoveLeftHandZ(20);
            _cam.MoveRightHandZ(30);
            _cam.MoveRightHandZ(20);

            _cam.MoveLeftHandX(30);
            _cam.MoveLeftHandX(20);
            _cam.MoveRightHandX(20);
            _cam.MoveRightHandX(30);

            Assert.IsTrue(detected);
        }
Example #4
0
        public override Wrapper VisitGesture(PreposeGesturesParser.GestureContext context)
        {
            var g = new Gesture(context.ID().GetText());

            foreach (var d in context.pose())
            {
                var converted = (Pose)this.Visit(d);
                g.AddPose(converted);
            }

            foreach (var d in context.execution().execution_step())
            {
                var converted = (ExecutionStep)this.Visit(d);
                g.AddStep(converted);
            }
            return(new Wrapper(g));
        }