Tuio Patch

habu's picture

I came across this post: http://kineme.net/TuioClient20071219beta but can't find the file.

Can anyone help me? Anybody here know about a patch for Tuio taht works under Leopard?

thx

cwright's picture
beta patch

In your kineme.net profile, make sure you've checked the "I want to be a beta tester" check box. That will allow you to access experimental patches like this one.

The original author made a leopard-native version, but I don't know if he ever posted it on a website anywhere... I'll try to find it when I get back.

smokris's picture
Official Tuio Client

A few months ago the original reacTIVision developers released a native (non-Java) Tuio Client QC plugin --- see http://mtg.upf.edu/reactable/?software

Please use that instead.

fsk's picture
the official one crashes a

the official one crashes a lot for me. the errors are something like 'collection was mutated while being enumerated'. i looked around and this seems to be a threading thing.

tried to fix the code with some @synchronized stuff, and the crashes went away but it made it slower and caused some other problems like the last object not being removed from the list :/.

franz's picture
Re: TUIO bug

i have the same problem. Any solutions around ?

EDIT: apparently sorted (that was fast...thx google) :

in TuioClient.cpp, around line 174: change :

float xpos, ypos, xspeed, yspeed, maccel; args >> s_id >> xpos >> ypos >> xspeed >> yspeed >> maccel >> EndMessage;

to:

float xpos, ypos, xspeed, yspeed, maccel; float tmp1, tmp2 ,tmp3 ; //add some variables

args >> s_id >> xpos >> ypos >> xspeed >> yspeed >> maccel >> tmp1 >> tmp2 >> tmp3 >> EndMessage;

it seems to work nicely with this modification

s.rozsa's picture
Re: TUIO bug

heya! Nice to see that someone elese on this board is working with TUIO :-)

FYI: there are right now 1-2 different TUIO clients floating around. Depending on what data you are transmitting with your tracker you could run in some serious trouble. I'm not a coder, but far as i understand you are "extending" the datatypes the TUIO client is receiving...

There are anyhow 3 threads i know on this topic and also about the future of TUIO - maybe that's of interrest for you:

http://sourceforge.net/forum/forum.php?thread_id=2859463&forum_id=515398

http://nuigroup.com/forums/viewthread/4218/

http://nuigroup.com/forums/viewthread/3374/P15/

Edit - this is new:

http://www.tuio.org/

gtoledo3's picture
Re: Official Tuio Client

(edit:in response to Steve's link) This one has worked "well" for me since it's release awhile back...

To the denizens of the "fora"...Note that you DO have to either use a tuio board, or you actually DO have to run the .jar (Java) tuio simulator...

I stay away from tuio in general, but I will note that to my memory there is a really specific bug with the sim/ QC comp setup... something about opening one first, before the other, and then maybe having to close the sim before opening up another tuio related file. I don't feel like opening it up to reproduce the bug right now. So... if anyone has glitches/tracking issues like that, or if anything freezes up after closing one or the other... you will have to close out of which ever remains open, and just restart everything again.

s.rozsa's picture
Re: Official Tuio Client

well, i'm working extensively with TUIO stuff (native Xcode applications) since a while and doing some extensive testings with QC and different TUIO plugins/trackers including the Java simulator and our own MT-table (http://vimeo.com/2240537).

The only thing i have noticed with the official TUIO plugin for QC is that you cannot run two or more TUIO-enabled-QC-compositions at the same time. If you do that QC will crash. I think that is becose QC is trying to access the TUIO source (on localhost:3333) simultanously. Aperrently this will not work. I'm not sure becose i did not worked with the patch, but mayebe a "spooky" patch containing the TUIO plugin could serve the data to more than one QC-comps.

Beside this thing i never had any major problems with the official QC-plugin. There is no "order of opening" i could confirm. There is an incompatibility between tBeta (optical tracking software) and the official TUIO plugin - this is because tBeta is sending some "not standard" informations to the plugin (see the discussion on nuigroup).

mkalten's picture
Re: Official Tuio Client

Hello, I'd like to comment that the current CVS version of the TuioClient for QuartzComposer is now finally stable. I am not really an expert in Cocoa Programming, but this should be hopefully good enough for production use. I also updated the demo to get rid of the teapot, but maybe someone wants to send me some more sophicticated examples?

And, I also updated the TuioClient to send coordinates from -1 to 1 as used in Quartz Composer. If someone could tell me how to access the Screen Ratio I could also adjust that value.

If some of you could team up with testing and doing some nice demos, I could release the stable version soon!

cheers, Martin.K

PS: You can now find some general information about TUIO at http://www.tuio.org/

franz's picture
Re: Official Tuio Client

that's good to know. So far my modded version did run well without crashes (so far), but an official client -stable- would be delightful !

Do you have a link for the compiled version of the plug ? (the one that outputs QC coordinates ?) thanks

btw. there are some convincing examples on the BBtouch site.

mkalten's picture
Re: TUIO bug

Hello again, part of the problem was that some trackers added additional arguments to the set message, which of course was not such good idea, since it crashed some TUIO client implementations that strictly expected the standard message format. I modified the TUIO client collection to be more robust against malformed messages now. Also I added some synchronisation regarding the various list updates, which apparently caused some problems as well. Many thanks to Boštjan Čadež for the help with Cocoa here BTW! The only thing I want to add is the correct screen ratio for the QuartzComposer patch, so I'd need a hint where I could retrieve that info from within the Plugin code itself.

thx, Martin.K

mkalten's picture
Re: Official Tuio Client

In general there can't be two instances listening to the same port a the same time. So maybe you should route the TuioClient output internally somehow.

I ran into a similar problem with the Pure Data and Max/MSP plugins, where I managed to use a single initialization to serve all plugin instances. If somebody has a hint how I could do that for a QuartzComposer Plugin, I could add that as well.

mkalten's picture
Re: Official Tuio Client

Answering part of my own question a second ago, apparently I have to move the connection/disconnection of the actual internal TuioClient out of the startExecution method to some other place, where the Plugin is initialized rather than started ...

s.rozsa's picture
Re: Official Tuio Client

Hey Martin,

sorry - missed your posting here. Glad to hear about the new version. I will download an compile the new version today or tomorrow and will do some little testing with. As Franz is saying over at www.xtuio.com are some (unfortunately a bit outdated) QC examples. I will redo some of them with the new plugin (i have to remove the unit conversion stuff - yukk! that's great btw. no more dealing with screenconversions...) - What kind of example(s) would you expect/propose?

Screen ratio (maybe this is useful):

"Quartz Composer uses a three-dimensional homogeneous coordinate system, as shown in Figure 1-8. The origin is at the center of the screen. The x axis is horizontal and the y axis is vertical. The z axis is orthogonal to the x and y axes, so that it comes out of the screen, towards the viewer. The left and right borders of the screen have coordinates –1.0 and +1.0, respectively. (See the x axis in the figure.) The coordinates of the top and bottom borders (the y axis in the figure) depend on the screen aspect ratio (AR). In the case of a 4:3 aspect ratio, the values at the borders are +1.0 / AR = +0.75 and –1.0 / AR = –0.75, respectively.

It’s also possible to have an aspect ratio for which the top and bottom borders of the screen have coordinates –1.0 and +1.0, respectively, while the left and right borders are +1.0 / AR and –1.0 / AR, respectively. For example, a 3:4 aspect ratio."

Cheers,

Sandor

cwright's picture
Re: Official Tuio Client

I think he understands how Aspect Ratios work -- however, he doesn't know how to get the Y max/min values (if he had the aspect, he could do so). Otherwise, they'll just default to -1-+1 or something (which I think is fine -- HID devices are supposed to map from -1 to 1 or 0 to 1, and scaling isn't particularly difficult).

I don't know enough about the official api to chime in with a solution, so I'd just suggest using -1 to +1, and have the user sort it out.

mkalten's picture
Re: Official Tuio Client

Yes, I'd need to access the aspect ratio setting from within the Plugin code so I could pre-scale everything nicely.

Before the TuioClient provided coordinates from 0..1 as defined in TUIO, but I am already providing coordinates from -1..1 now. The only thing that would be left to do is to scale the Y coordinate depending on the currently set aspect ratio. In any case it would be always easy to scale that within the patch, but I just thought it would be more elegant to provide the data as such.

So if anybody has a code snippet on how the get the Aspect Ratio, I'd appreciate it.

cheers, Martin.K

gtoledo3's picture
Re: Official Tuio Client

Can you just make some inputs that would get fed with a rendering destination image size patch outputs? That would allow for an "auto" way of doing it, but also allow the user to shift from that if they should desire for some reason (don't know why).

tobyspark's picture
Re: Official Tuio Client

the context object is passed into your executeAtTime: method, and the context object knows what the bounds are.

bounds
Returns the bounds of the rendering context.
 
- (NSRect) bounds
 
Return Value
The bounds of the rendering context expressed in Quartz Composer units.
 
Availability
Available in Mac OS X v10.5 and later.
Declared In
QCPlugIn.h

file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library....

mkalten's picture
Re: Official Tuio Client

Thanks, this was exactly what I needed! It works just fine that way ... I will publish the new TUIO client Plugin for Quartz Composer this weekend. This will also include some nicer demos made with the help of Sandor. It's a pity that I haven't had any time to dig deeper into QC yet, because it really seems to be quite simple to achieve astonishing visual results with this tools. cheers, Martin.K

tobyspark's picture
Re: Official Tuio Client

my pleasure, and anything to help a proper tuio client along!

initi's picture
Re: Tuio Patch

Hi, i need freeze a final position/coordinators of tracking object, but if i stop sending TUIO data to quartz every value become zero. how can i freeze it, pls? thank you for any suggestion how to solve it! cheerz

gtoledo3's picture
Re: Tuio Patch

You can use a sample and hold patch. You are going to want to use some bit of info on what's changing (does structure count change, for instance?) to maybe cause the appropriate true/false to get generated.

So, you could do something so simple as have a structure count, to a conditional set to give a true when the incoming value equals the second value. The result of that conditional, would supply a true/false to the sample and hold if that given index (or "count") of the structure is active.