Page 1 of 2

TTAPIFrameAvailable

Posted: Mon Nov 19, 2012 2:02 pm
by martinv
Hi,

Does anyone has succeeded to use the cTTAPIListener class ?

I have created a derived class and overrided the TTAPIFrameAvailable virtual function.

When I run my application, the TTAPIFrameAvailable is never called.

My application still poll on regular basis to call the TT_Update, and I can see that my rigid body is tracked correctly. So I know my setup (camera, license...) are OK.

Note: I used an OptiTrack Optihub 2 on which 2 OptiTrack Flex13 cameras are connected to.

Is there a setting I need to configure in TrackingTool to have access to this functionality ?

thank,


Martin

Re: TTAPIFrameAvailable

Posted: Mon Nov 19, 2012 2:14 pm
by martinv
Hi,

Originally my application called the TT_AttachListener, before the call to TT_Initialize.

Now I have decided to perform the call TT_AttachListerer AFTER the TT_Initialize, and the TTAPIFrameAvailable is now called!!!

Martin

Re: TTAPIFrameAvailable

Posted: Tue Nov 20, 2012 10:30 am
by martinv
I still have a problem.

When I said it was working, I had a thread running which was performing TT_Update() on regular interval.

I have removed this thread, and now the TTAPIFrameAvailable is never called.

So the initial question remains, does anyone have succeeded to use the TTListener ?

thank you,

Martin

Re: TTAPIFrameAvailable

Posted: Tue Nov 20, 2012 12:45 pm
by martinv
Hi,

I have found that if I call TT_AttachListener before performing a TT_LoadProject, it works (the TTAPIFrameAvailable is called and then I can call the TT_Update)

If I call TT_LoadProject and then call TT_AttachListener, the TTAPIFrameAvailable is not called

I have not seen anything about this behavior in the documentation.

Does someone can confirm this is the expected behavior ?

thank you,


Martin

Re: TTAPIFrameAvailable

Posted: Tue Nov 27, 2012 9:44 am
by jolsonsalem
I am forwarding this on to one of our developers and will get back to you guys with an answer soon.

Re: TTAPIFrameAvailable

Posted: Fri May 03, 2013 12:22 pm
by jmckisson
Has there been any update on this?

I am using the callback approach as well and it only seems to work if I attach the listener object after TT_Initialize and before and calls to LoadProject/Cal/Trackables/etc.

I am using SDK packaged with the latest Motive build (Apr 2013)

Re: TTAPIFrameAvailable

Posted: Fri May 03, 2013 3:38 pm
by NaturalPoint-Dustin
Martin,

I apologize for the delay. I will research this issue for you and have a response shortly.

Best Regards

Re: TTAPIFrameAvailable

Posted: Wed May 08, 2013 11:57 am
by martinv
Hi,


ok let me know when you will have an answer.

thank you,

martin

Re: TTAPIFrameAvailable

Posted: Thu May 09, 2013 12:00 pm
by beckdo
You should be able to attach your callback listener after TT_Initialize without issue. There's one thing you need to watch out for. If you're triggering your TT_Update() from FrameAvailable notifications you have to be mindful that the notifications will stop coming if the frame queues overflow, ie. your app gets behind. In order to prevent this issue from arising, you'll want to make sure to call TT_Update() after attaching your callback listener and then you should be good to go.

Re: TTAPIFrameAvailable

Posted: Thu May 09, 2013 12:33 pm
by jmckisson
Ok that would explain the behavior I have observed. My solution was the proper one in this case, immediately begin calling TT_Update in the listener as soon as it is attached. However I have noticed that the tracking data seems to be invalid for a period of time until the project and calibration etc are successfully loaded.

I had before only been calling Update when a flag (defined by me) had been set indicating that my own code was initialized and ready to receive tracking data. This must have caused the frame queue as you say to overflow, which was happening very shortly after the initialize call.

I suppose the problem is that once the frame queue overflows, it will never recover?