Ejemplo n.º 1
0
 def __init__(self, *args, **kwargs):
     super(TuioDispatcher, self).__init__(*args, **kwargs)
     self.tracking = tuio.Tracking()
     self.assignments = {}
     self.bound_objects = set()
     self.bindings = {}
     self.last_cursors = set()
Ejemplo n.º 2
0
    def __init__(self, host = '127.0.0.1', port = 3333, threaded = False):
        """
        sets up the TuioCallback instance

        parameters:

            host: which address to listen on. localhost by default
            port: the port to listen on
            threaded: decide whether it should be threaded or not.
        """

        # according to python docs we have to call this first
        threading.Thread.__init__(self,group=None, target=None, name=None, args=(), kwargs={})


        self._event = threading.Event()
        self._event.set()

        self._host = host
        self._port = port
        self._tracking = tuio.Tracking(host=host,port=port)
        self._callback = _TuioCallbackListener("Callback",
                                               self._tracking.eventManager,
                                               self)
        self.daemon = False


        
        if threaded:
            self.start()
Ejemplo n.º 3
0
def det_fm_info_end():  #function to retrieve information of goal/end point
    tracking = tuio.Tracking()
    while 1:
        tracking.update()
        for obj in tracking.objects():
            if (obj.id == 3):
                print obj
                tracking.stop()
                return obj.angle, obj.xpos, obj.ypos
Ejemplo n.º 4
0
def det_fm_info_start(): #function to retrieve initial information of robot's starting point
	tracking = tuio.Tracking()
	while 1:
			tracking.update()
			for obj in tracking.objects():
					if(obj.id == 0):
						print obj
						tracking.stop()
						return obj.angle, obj.xpos, obj.ypos 
Ejemplo n.º 5
0
    def __init__(self, device_id, port, bus):

        dbus.service.Object.__init__(self, bus,
                                     '/Drivers/InteracTable/%d' % port)
        self.device_id = device_id
        self.bus = bus

        listen = '/Bridge/Drivers/%d' % (self.device_id)
        self.bus.add_signal_receiver(self.new_update, path=listen)
        print 'interacTable: listening for %s' % listen

        self.tracking = tuio.Tracking(host='', port=port)
        self.markers = {}

        gobject.timeout_add(UPDATE_TIME, self.update)
        gobject.io_add_watch(self.tracking.socket.fileno(), gobject.IO_IN,
                             self.track)
Ejemplo n.º 6
0
import tuio
tracking = tuio.Tracking()
print "loaded profiles:", tracking.profiles.keys()
print "list functions to access tracked objects:", tracking.get_helpers()

try:
    while 1:
        tracking.update()
        for obj in tracking.objects():
            print obj
except KeyboardInterrupt:
    tracking.stop()
Ejemplo n.º 7
0
def init_tuio(args):
    tracking = tuio.Tracking(args.ip, args.port)
    print("loaded profiles:", tracking.profiles.keys())
    print("list functions to access tracked objects:", tracking.get_helpers())
    return tracking
Ejemplo n.º 8
0
import tuio
import stomp

s = stomp.Connection()
s.start()
s.connect()

cnt = 0

current = []
ld = {}

t = tuio.Tracking()
try:
    while True:
        t.update()

        active = []
        for c in t.cursors():
            active.append(c.sessionid)

        tbr = []
        for c in current:
            if c not in active:
                tbr.append(c)

        tba = []
        for c in active:
            if c not in current:
                tba.append(c)
Ejemplo n.º 9
0
		port = int(arg)
	if opt in ('--xoffset'):
		xOffset = int(arg)
	if opt in ('--yoffset'):
		yOffset = int(arg)
	if opt in ('--xsize'):
		xRes = int(arg)
	if opt in ('--ysize'):
		yRes = int(arg)
	if opt in ('--xcombined'):
		xCombined = int(arg)
	if opt in ('--ycombined'):
		yCombined = int(arg)

    device = DeviceWME()

    if noWME:
	device = Device()

    tracking=tuio.Tracking(host, port)    
    try:
        while 1:
            tracking.update()
            objects=tracking.objects()
            cursors=tracking.cursors()
            device.update(objects,cursors)
            device.display()
            time.sleep(0.01)
    except KeyboardInterrupt:
        tracking.stop()
Ejemplo n.º 10
0
 def __init__(self):
     self.tracking = tuio.Tracking()
     self.tracker = None
Ejemplo n.º 11
0
def update():
  #function to update the all parameters like frequency etc. from the tuio position

def map_object(obj):
  if get_id(obj) < 4:
    a = Controller(tuio_obj=obj)#LFO(freq=100)
    return a
  if 4 <= get_id(obj) < 10:
    b = Sine(freq=440)
    return b
  else:
    pass

def get_new_obj(new,old):
  return new[np.logical_not(np.in1d(new, old))]

def get_alive_obj(new,old):
  return new[np.in1d(new, old)]

def get_dead_obj(new,old):
  return old[np.logical_not(np.in1d(old, new))]

tracking = tuio.Tracking()
print "loaded profiles:", tracking.profiles.keys()
print "list functions to access tracked objects:", tracking.get_helpers()

s = Server().boot()
s.start()
objects_old = np.empty((0))
objects_new = np.empty((0))
objects_new_id = np.empty((0))
sound_objects = np.asarray([])
tuio_objects = np.asarray([])
print sound_objects
print tuio_objects
try:
    while 1:
        tracking.update()
        #print tracking.objects()
        objects_new = np.asarray([obj for obj in tracking.objects()])
        #print objects_new
        #objects_new_id = map(get_id,objects_new)
        #print objects_new_id

        if not np.array_equal(objects_new,objects_old):
          new = get_new_obj(objects_new,objects_old)
          alive = get_alive_obj(objects_new,objects_old)
          dead = get_dead_obj(objects_new,objects_old)
          print 'new: ' +str(new)
          print 'alive: ' +str(alive)
          print 'dead: ' +str(dead)
          #time.sleep(2)
          
          mask = np.in1d(tuio_objects,dead,invert=True)
          sound_objects = sound_objects[mask]
          tuio_objects = tuio_objects[mask]
          tuio_objects = np.append(tuio_objects,new)
          sound_objects = np.append(sound_objects,map(output,map(map_object,new)))
          #print sound_objects
          #print tuio_objects
          #for tuObj, soObj in zip(tuio_objects, sound_objects):
          #  soObj.set_Freq
          
          

        #for obj in objects_new:
        #  if not obj in objects_old:

        objects_old = objects_new
        objects_old_id = objects_new_id
       	    
except KeyboardInterrupt:
    tracking.stop()
Ejemplo n.º 12
0
 def __init__(self):
     self.tracking = tuio.Tracking()
     self.tracker = None
     self.my_id = 0
     self.target_id = 2