Esempio n. 1
0
    def __init__(self, plex_server, plex_client):
        """
        Establish OSCeleton connection and initialize PlexController and
        Gesture Detectors.
        """
        print "Initializing..."
        self.server = OSCeleton(7110)
        self.frame_count = 0
        """List of users / hands, currently only supporting one concurrently"""
        self.users = {}

        # FIXME: check IP/Client
        self.pc = PlexController(plex_server, plex_client)

        # Set up GestureDetector instances. Since we currently support one
        # hand / user at a time we can initialize all at once.
        gt = settings.THRESHOLDS['GESTURE']
        self.sd = SwipeDetector(self._gesture_detected,
            threshold_x=gt['x'],
            threshold_y=gt['y'],
            threshold_z=gt['z'],
            threshold_cancel_factor=gt['cancel_factor'])

        mt = settings.THRESHOLDS['MOVEMENT']
        self.md = MovementDetector(self._move_detected,
            threshold_x=mt['x'],
            threshold_y=mt['y'],
            threshold_z=mt['z'],
            threshold_cancel_factor=mt['cancel_factor'])

        ht = settings.THRESHOLDS['HOLD']
        self.hd = HoldDetector(self._hold_detected, 
            threshold_x=ht['x'],
            threshold_y=ht['y'],
            threshold_z=ht['z'],
            min_frame_count=12)

        self.repeat_frame_count = 0
        self.repeat_count = 0

        self._set_state('wait_for_hold')

        print 'Done initializing'
        while True:
            self._main_loop()