TTAPIFrameAvailable

martinv
Posts: 13
Joined: Tue Aug 21, 2012 5:15 am

TTAPIFrameAvailable

Post 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
martinv
Posts: 13
Joined: Tue Aug 21, 2012 5:15 am

Re: TTAPIFrameAvailable

Post 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
martinv
Posts: 13
Joined: Tue Aug 21, 2012 5:15 am

Re: TTAPIFrameAvailable

Post 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
martinv
Posts: 13
Joined: Tue Aug 21, 2012 5:15 am

Re: TTAPIFrameAvailable

Post 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
jolsonsalem
Posts: 323
Joined: Thu Oct 11, 2012 9:18 am

Re: TTAPIFrameAvailable

Post by jolsonsalem »

I am forwarding this on to one of our developers and will get back to you guys with an answer soon.
jmckisson
Posts: 7
Joined: Tue Apr 30, 2013 9:14 am

Re: TTAPIFrameAvailable

Post 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)
NaturalPoint-Dustin
Posts: 609
Joined: Tue Mar 19, 2013 5:03 pm

Re: TTAPIFrameAvailable

Post by NaturalPoint-Dustin »

Martin,

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

Best Regards
Dustin
Technical Support Engineer
OptiTrack | TrackIR | SmartNav
martinv
Posts: 13
Joined: Tue Aug 21, 2012 5:15 am

Re: TTAPIFrameAvailable

Post by martinv »

Hi,


ok let me know when you will have an answer.

thank you,

martin
beckdo
Posts: 520
Joined: Tue Jan 02, 2007 2:02 pm

Re: TTAPIFrameAvailable

Post 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.
jmckisson
Posts: 7
Joined: Tue Apr 30, 2013 9:14 am

Re: TTAPIFrameAvailable

Post 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?
Post Reply