def __init__(self, name, gesture_iterations, gesture): self.gesture_iterations = gesture_iterations # The array of gesture iterations. self.name = name # Name of the gesture. self.full_gesture = (name, gesture_iterations) # TODO update this to use a parameter for full gestures file when fully implemented self.gesture_creator = GestureCreator('full_gestures.txt') self.gesture = gesture
class FullGesture: def __init__(self, name, gesture_iterations, gesture): self.gesture_iterations = gesture_iterations # The array of gesture iterations. self.name = name # Name of the gesture. self.full_gesture = (name, gesture_iterations) # TODO update this to use a parameter for full gestures file when fully implemented self.gesture_creator = GestureCreator('full_gestures.txt') self.gesture = gesture # Appends a new iteration of a gesture to the end of the current list of iterations. def append_iteration(self, iteration): self.gesture_iterations.append(iteration) # Use particle filtering to decide which iterations should be included in the average. # Older iterations have a smaller chance of being included. def sample_average(self): # TODO implement functionality to average a gesture based on probability. average = self.gesture_creator.average_gesture(self.gesture_iterations) return average def get_name(self): return self.name def get_gesture_iterations(self): return self.gesture_iterations def get_gesture(self): return self.full_gesture
class FullGesture: def __init__(self, name, gesture_iterations, gesture): self.gesture_iterations = gesture_iterations # The array of gesture iterations. self.name = name # Name of the gesture. self.full_gesture = (name, gesture_iterations) # TODO update this to use a parameter for full gestures file when fully implemented self.gesture_creator = GestureCreator("full_gestures.txt") self.gesture = gesture # Appends a new iteration of a gesture to the end of the current list of iterations. def append_iteration(self, iteration): self.gesture_iterations.append(iteration) # Use particle filtering to decide which iterations should be included in the average. # Older iterations have a smaller chance of being included. def sample_average(self): # TODO implement functionality to average a gesture based on probability. average = self.gesture_creator.average_gesture(self.gesture_iterations) return average def get_name(self): return self.name def get_gesture_iterations(self): return self.gesture_iterations def get_gesture(self): return self.full_gesture
def __init__(self, name, gesture_iterations, gesture): self.gesture_iterations = gesture_iterations # The array of gesture iterations. self.name = name # Name of the gesture. self.full_gesture = (name, gesture_iterations) # TODO update this to use a parameter for full gestures file when fully implemented self.gesture_creator = GestureCreator("full_gestures.txt") self.gesture = gesture
stats_file = str(sys.argv[2]) full_gestures_file = 'full_' + gestures_file writer_reader = GestureWriterReader( gestures_file) # Initializes the writer-reader to the either general use or testing. stat = GeStat(stats_file, gestures_file) full_writer_reader = GestureWriterReader(full_gestures_file) # writer-reader for full gestures. wiimotes = wiiuse.init(num_motes) first_wm = wiimotes[0] # Handles button press events of the wiimote. button_handler = ButtonHandler(wiimotes, first_wm, num_motes) # Object to perform gesture comparison. gesture_matcher = GestureMatcher(writer_reader) # Object that creates gesture objects. gesture_creator = GestureCreator(gestures_file, wiimotes, first_wm, num_motes, FRAME_FREQ) # The main prompt of the program def main_prompt(): print "\n\n**********************" print "\nHold B: perform a gesture \n2: Teach a gesture \nA: list all gestures.\nDown: Show gesture statistics \nTo quit, press the + button." print "To erase all gestures, press the - button." print "**********************\n\n" def test(gesture): print gesture_matcher.evaluation_function(gesture) # Pretty star wave to stdout.
full_gestures_file = 'full_' + gestures_file writer_reader = GestureWriterReader( gestures_file ) # Initializes the writer-reader to the either general use or testing. stat = GeStat(stats_file, gestures_file) full_writer_reader = GestureWriterReader( full_gestures_file) # writer-reader for full gestures. wiimotes = wiiuse.init(num_motes) first_wm = wiimotes[0] # Handles button press events of the wiimote. button_handler = ButtonHandler(wiimotes, first_wm, num_motes) # Object to perform gesture comparison. gesture_matcher = GestureMatcher(writer_reader) # Object that creates gesture objects. gesture_creator = GestureCreator(gestures_file, wiimotes, first_wm, num_motes, FRAME_FREQ) # The main prompt of the program def main_prompt(): print "\n\n**********************" print "\nHold B: perform a gesture \n2: Teach a gesture \nA: list all gestures.\nDown: Show gesture statistics \nTo quit, press the + button." print "To erase all gestures, press the - button." print "**********************\n\n" def test(gesture): print gesture_matcher.evaluation_function(gesture) # Pretty star wave to stdout.