Hi everyone,
I'm using the VRPN to read data from a Optitrack system, of course, using the tracking tools application. I can read data from one trackable, as shown in the example provided by NatNet (http://www.naturalpoint.com/optitrack/d ... tools.html).
My question is related to that I need to read data from more than one trackable (two, three, or more rigid bodies defined in the Tracking Tools). So, of course, the simplest way to achieve this is hardcode the same pieces of code (a callback function mainly). But this is not portable and "shareable"...I have this problem, because I want to use a class containing all the VRPN stuff, so the user only would need to define the number of trackables, and the class should do all the stuff...but the problem here is that I can not do this because I have to hardcode the callback function. My idea would be to have an array of instance of the mentioned class, but the other issue here is that the callback is a global function, so it is the same function for all the instances of the class.
Any ideas ?? Do you know if it is solved by anyone else ?
Thanks
Leonel
VRPN streaming multiple trackables
Re: VRPN streaming multiple trackables
VRPN has a really nice setup for the callbacks and multiple tracked objects.
When you register the callback via register_change_handler, you have a couple options. 1. You can register a different callback for each tracked object. 2. The first parameter in the register_change_handler function is called 'user data', and you can put anything you want in there and it will be passed to the callback function. You could simply put an integer in there, perhaps the index of what tracked object? If you wanted to store a bunch of information you could pass the pointer of an info structure with all kinds of info in it. It's up to you.
When you register the callback via register_change_handler, you have a couple options. 1. You can register a different callback for each tracked object. 2. The first parameter in the register_change_handler function is called 'user data', and you can put anything you want in there and it will be passed to the callback function. You could simply put an integer in there, perhaps the index of what tracked object? If you wanted to store a bunch of information you could pass the pointer of an info structure with all kinds of info in it. It's up to you.