[! Urgent] TUIO support

23 views
Skip to first unread message

Athul Devin

unread,
Mar 31, 2019, 6:34:48 AM3/31/19
to Kivy users support
[! Urgent]
I am developing a custom gesture recognition app in kivy i have two separate applications one kivy touch tracer and another is my gesture recognition app. My gesture recognition app provides x and y coordinates and i need to send that coordinates to my kivy app using TUIO. I read about OSC protocol and created below code ,It sends OSC packets correctly but my kivy app is not receiving or processing it . Please can you help

Geasture app simplified
from oscpy.client import OSCClient
import pyautogui

osc = OSCClient('127.0.0.1', 3334)
while (True):
(m1,m2)=pyautogui.position()
s=pyautogui.size()
m1=m1/s[0]
m2=m2/s[1]
osc.send_message(b'/tuio/Gest',(m1,m2))

KIVY app

TUIO motion event class

class TuioGestMotionEvent(MotionEvent):
def __init__(self, id, args):
super(TuioGestMotionEvent, self).__init__(id, args)

def depack(self, args):
self.is_touch = True
# In this method, implement 'unpacking' for the received
# arguments. you basically translate from TUIO args to Kivy
# MotionEvent variables. If all you receive are x and y
# values, you can do it like this:
if len(args) <= 5:
print (args)
self.sx, self.sy = args[0:2]
self.profile = ('pos', )
self.sy = 1 - self.sy
super(TuioGestMotionEvent, self).depack(args)

Inside BUILD

def build(self):
Config.set('input', 'Gesture', 'tuio,127.0.0.1:3334')
TuioMotionEventProvider.register(b'/tuio/Gest', TuioGestMotionEvent)
return Touchtracer()

Athul Devin

unread,
Apr 6, 2019, 5:11:53 AM4/6/19
to Kivy users support
guys thanks for supporting me,
I found the solution my bug is in tuio OSC packet format see the OSC client program and i am using built in tuio 2Dcur implementation instead of my Gest implementation
 
Gesture app simplified

from oscpy.client import OSCClient
import pyautogui

osc = OSCClient('127.0.0.1', 3334)
while (True):
(m1,m2)=pyautogui.position()
s=pyautogui.size()
m1=m1/s[0]
m2=m2/s[1]
osc.send_message(b'/tuio/2Dcur',(b'alive',100))
osc.send_message(b'/tuio/2Dcur',(b'set',100,m1,m2))

main program inside build

def build(self):
Config.set('input', 'default', 'tuio,127.0.0.1:3334')
return Touchtracer()
Reply all
Reply to author
Forward
0 new messages