NatNatML vs. NatNet

NatNet, VRPN, TrackD, and Plugins
Post Reply
zeno06
Posts: 7
Joined: Fri Nov 27, 2015 11:49 am

NatNatML vs. NatNet

Post by zeno06 »

Hi,

I am trying to use NatNet to transmit tracking data from a tracking server to a client. At the end, I desire to -from the client- query the server to do a measurement of some rigidbodies, and send them to the client.

Relying on the samples "SimpleServer" and "SampleClient", this seams to work just fine. So from the client program, I just need to make a call like

sFrameOfMocapData* pData = theClient->GetLastFrameOfData();

On the Server side, the server recieves a request with message ID NAT_REQUEST_FRAMEOFDATA

The server then does the following
BuildFrame(g_lCurrentFrame++, &descriptions, &frame);
theServer->PacketizeFrameOfMocapData(&frame, pPacketOut);

As I said, this worked just fine...... Now I tried to do the same with Matlab on the side of the client. I also relied on the NatNetMatlabSample. By debugging, I found that a call like this in the matlab program

data = theClient.GetLastFrameOfData();

would triger nothing on the server. I.e., no message is sent to the server! But if the server has sent a frame, the call will always gets this last frame.

My question is: Is the behavior of the server class in the original library and the matlab library different? Where can I find a dicumentation for the matlab library?

mush thanx
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 720
Joined: Mon Jan 19, 2015 11:52 am

Re: NatNatML vs. NatNet

Post by steven.andrews »

Hello zeno06,

GetLastFrameOfData() behaves differently between the Native client and the .NET client.

Native client : query the server, wait for server response and frame of data from server.
.NET client : immediately return the last cached frame of delivered frame data

2.8 Release notes:
Changed: (NatNet Managed Library (NatNetML) only) Change GetLastFrameOfData() routine in managed client to lock the frame and return a copy of the data (polling clients only), update WinForms sample app to illustrate usage.


The reason for this is MATLAB/Labview .NET clients cannot use the data callback mechanism because of the event signature or because their program cannot support multi-threading. They still needed a performant way to get the most recent frame of data.

I hope you find this information to be useful. If we can do anything else to help, please feel free to open a support ticket with us at help.naturalpoint.com

Best regards,
Steven
--
Steven Andrews
OptiTrack | Customer Support Engineer
Post Reply