Example #1
0
            # Update gestures in memory as necessary.
            gesture_creator.update_gestures()
            gesture_matcher.update_known_gestures()

            # Print statistics regarding the matched gesture and total statistics.
            print "\n" + (matched_gesture.get_name() + " success rate:").ljust(30) + str(
                stat.get_gesture_success_rate(matched_gesture))
            print "Total success rate:".ljust(30) + str(stat.get_total_success_rate())
            main_prompt()

        elif button_pressed == wiiuse.button['2']:
            os.system('clear')
            print "\nLearning gesture.\n"
            # Learn the gesture.
            gesture_creator.learn_gesture(REPETITION_LIMIT)
            # Update gestures in memory as necessary.
            gesture_matcher.update_known_gestures()
            gesture_creator.update_gestures()
            main_prompt()

        elif button_pressed == wiiuse.button['-']:
            os.system('clear')
            print "Are you sure you want to delete all your gestures?  Press A to confirm, or B to cancel."
            confirmed = False
            while not confirmed:
                r = wiiuse.poll(wiimotes, num_motes)
                confirm_button = button_handler.press_event()
                if confirm_button == wiiuse.button['A']:
                    print "Okay! Deleting gestures!"
                    time.sleep(0.5)
Example #2
0
            gesture_creator.update_gestures()
            gesture_matcher.update_known_gestures()

            # Print statistics regarding the matched gesture and total statistics.
            print "\n" + (matched_gesture.get_name() +
                          " success rate:").ljust(30) + str(
                              stat.get_gesture_success_rate(matched_gesture))
            print "Total success rate:".ljust(30) + str(
                stat.get_total_success_rate())
            main_prompt()

        elif button_pressed == wiiuse.button['2']:
            os.system('clear')
            print "\nLearning gesture.\n"
            # Learn the gesture.
            gesture_creator.learn_gesture(REPETITION_LIMIT)
            # Update gestures in memory as necessary.
            gesture_matcher.update_known_gestures()
            gesture_creator.update_gestures()
            main_prompt()

        elif button_pressed == wiiuse.button['-']:
            os.system('clear')
            print "Are you sure you want to delete all your gestures?  Press A to confirm, or B to cancel."
            confirmed = False
            while not confirmed:
                r = wiiuse.poll(wiimotes, num_motes)
                confirm_button = button_handler.press_event()
                if confirm_button == wiiuse.button['A']:
                    print "Okay! Deleting gestures!"
                    time.sleep(0.5)