Upd connection to OpenPTrack server

Hey there,
Is there a way to connect to a remote udp ip:port to receive data? For what I´ve seen, the UDP network client node only works as a sender.

What I am trying to do is to create a connection to an external OpenPTrack udp server which sends json strings with kinect data on them like this one:

{“header”:{“seq”:71251,“stamp”:{“sec”:1415305737,“nsec”:110138944},“frame_id”:“world”},“tracks”: [{“id”:387,“x”:-0.89131,“y”:2.41851,“height”:1.55837,“age”:29.471,“confidence”:.0500193}]}

From the web page:

OpenPTrack is an open source project launched in 2013 to create a scalable, multi-camera solution for person tracking, to support applications in education, art and culture.
Our objective is to enable “creative coders” to create body-based interfaces for large groups of people—for classrooms, art projects and beyond.

I have a running installation here and realized it would be nice to build a patch for everybody to be able to access the data through vvvv. But so far got stucked if I can´t connect to it!


1 Like

That looks interesting :)
Try UDP(server) I’ve always thought the names seem backwards to me… UDP(connect to server)

Hey! an update from here…

first, sorry about the udp thing…I completely confused server and client terminology there…anyway, the udp listener works like a charm and now I am able to get the tracker data into vvvv.

The tricky part for me is to parse the json string that comes through udp, everything is fine when it comes with only one tracker id, but when when it comes with two or more things get tricky, here is the tracks portion of the json with more than one id:


Now, right out of the parsing section of my patch, I get those fields in a spread (string):

Each udp packet comes with a json string with different amount of ids, so MY problem is how to handle that dynamic length changing spread…right now my two solutions are messy and not elegant at the least…because in the first one I ended up with a lot of getslices and in the second one with an intimidating stallone that sometimes crashes the hell out. In both cases I ended up sort of hardcoding the ammount of IDs, or the field´s position in the spread to get each trackers transform, or even having to create different 3d objects for each damn ID…

Please check the patch to see it more clearly…
udp_listener.v4p (48.4 KB)

In simply words, I need to learn how to handle a dynamic length spread correctly…or maybe I am not doing the parsing section the right way…


well why don’t you use Sort (Spreads) on tracker id
in any case how would you want the output to look?
i would create a buffer with select node, then setslice on index that is id’s and a spread of booleans with enabled…

also you can create some datatype in c# e.g.
class marker { int id; float x; float y; and so on }

and deserialize json directly (i prolly can help you with that)

Hey antokhio,
I don’t think the Sort can help me, what I need is to somehow “group” the 6 slices that belong to each tracking point independently so I can create objects for each one.

The Select node idea sounds good! I’ll check that!

I’ve never coded anything in c# within vvvv, so I’ll be looking into that too,

Thank you!

hey omykron, vl to the rescue, see attached!

OpenPTrack.zip (8.7 KB)

this is a quick sketch of how to deserialize json to objects directly in vl. let me know if this works for you…

If you check out the vl implementation you see that i simply had to create the patchstructure: Header, Track, Stamp as the json is formatted. the rest is done by the Deserialize [Json] node automatically and we can then conveniently access the individual data fields…

@omykron did this help?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.