Page 2 of 4

Re: Tracking tools - Matlab

Posted: Sun Jan 24, 2010 3:58 pm
by litch09
I have also posted the Matlab demo on Mathworks file exchange - ... ange/26449?

Re: Tracking tools - Matlab

Posted: Mon Mar 29, 2010 2:30 pm
by smith32
Hi guys,

I'm also trying to use the TrackingTools through MATLAB, except in my case I'm trying to implement it in a Simlink C coded MEX function.

I was able to run the code posted by litch09 (thanks a lot) without any issue. However, when I compile my S-Function code (that works without any TrackingTools calls) I get a LNK2019: unresolved external sympbol error pointing to any TT_ function I tried to call. When I call the compiler (mex mySFunction.c NPTrackingTools.lib) I include the NPTrackingTools.lib file but I still get the errors. Right now I've got all the files located in the same directory, but I tried referencing them their initial location and I get the same result. I've also tried compiling using the Real-Time Workshop but I get the same linking error.

I'd appreciate any insight or suggestions anyone can provide, thanks a lot.

Re: Tracking tools - Matlab

Posted: Mon Mar 29, 2010 3:43 pm
by smith32
Quick update, I searched around and realized that I could just rename and compile my C coded S-Function as C++. As soon as I did this, all the errors went away. Hopefully this will help out others if they're looking to do something similar.

I plan on developing a TrackingTools Simulink block and some NatNet streaming blocks, when it's finished I'll post a link to the files for others to use.


Re: Tracking tools - Matlab

Posted: Thu Jun 24, 2010 1:10 am
by Drorm

I'm trying to use the VI program ( for capturing data about the rigid body but it said that �No cameras have been found to be connected� although I see the rigid body in the tracking tools program.


Re: Tracking tools - Matlab

Posted: Thu Jun 24, 2010 8:52 am
by chrisjordan22

I'm looking to create a Simulink S-Function TrackingTools block and was wondering if you made any progress.



Re: Tracking tools - Matlab

Posted: Wed Jun 30, 2010 7:54 pm
by litch09
Hi Drorm,

I'd need to know what you've done in more detail. It is necessary to have setup your project in Tracking Tools first (with hardware key). Then close down the Tracking Tools program and open the Labview VI ( When you run the VI, it should work automatically, if it worked in Tracking Tools and the position and orientation data should display in 'real-time'.


Re: Tracking tools - Matlab

Posted: Wed Jun 30, 2010 7:58 pm
by litch09
I should also note, that it is probably best to rebuild the NPTrackingTools VI library from the DLL (see comments on how to import shared library in previous posts) for each new version of the Tracking Tools software that is released.

Re: Tracking tools - Matlab

Posted: Fri May 27, 2011 5:26 pm
by c.s.chapman

Has anyone tried the Tracking Tools API to Matlab interface with a newer version of Matlab and Tracking tools? I am running Matlab 7.10.0 (R2010a) and Tracking Tools 2.3.2. The load library seems to function OK (typical warnings and functions not found), but I seem get no respone from my Optitrak system. That is, when I run:

>> calllib('NPTrackingTools', 'TT_Initialize');

Nothing happens and a 0 is returned. I'm assuming this is not what is supposed to happen.

When I run:

>> calllib('NPTrackingTools', 'TT_LoadProject', project_file);

It returns a value of 3. What do these return values mean, and where can we learn more about them?

In any case, all of my functions don't do much of anything. However, it does seem to be able to count the cameras. That is, running:

>> calllib('NPTrackingTools', 'TT_CameraCount')

Correctly identifies the number of cameras that are currently attached. Similarly, if I unplug a camera, run "update" and then count the cameras again, it correctly identifies that I have one less.

In any case, I am looking for any way to get the Optitrak data into Matlab in realtime. Any suggestions?


Re: Tracking tools - Matlab

Posted: Wed Aug 10, 2011 7:45 am
by heath789
I am also attempting to use the demo code posted by litch09 (Thanks!) but can't get things to work entirely.

The library seems to load okay, and the TT program stops accepting commands directly, but the calllib functions do not seem to work.

Am I supposed to have TT running when I run the demo code?



Re: Tracking tools - Matlab

Posted: Thu Aug 11, 2011 10:54 am
by NaturalPoint - Mike
If you're using the Tracking Tools API, Tracking Tools should not be running at the time. What version of Tracking Tools are you using? Are you compiling against the header files and binaries included with that version? What IDE are you using?