Server connected but GetLastFrameOfData() under c++ does not work

NatNet, VRPN, TrackD, and Plugins
Post Reply
Posts: 2
Joined: Fri Aug 03, 2018 11:23 am

Server connected but GetLastFrameOfData() under c++ does not work

Post by aaarthur » Fri Aug 03, 2018 10:57 pm


I am having some trouble using GetLastFrameOfData() in Visual Studio 2017 to get any data from the server. I have two computers, one as server and the other as a client, and I am using NatNet 2.8 x64. I tried the SampleClient.cpp, and "theClient->SetDataCallback( DataHandler, theClient )" works fine and displays the data.

Code: Select all

[Client] Handling packet from Command=7, nDataBytes=212
FrameID : 26576331
Timestamp :  110734.71
Latency :  110734.71
Timecode : 00:00:00:00.0
Other Markers [Count=0]
Rigid Bodies [Count=1]
Rigid Body [ID=1  Error=0.00  Valid=1]
        x       y       z       qx      qy      qz      qw
        0.28    1.08    -0.24   -0.05   0.87    -0.07   0.48
        Rigid body markers [Count=6]
                MarkerID:1      MarkerSize:0.00 MarkerPos:-0.67,0.41,-0.20
                MarkerID:2      MarkerSize:0.00 MarkerPos:-0.67,0.40,-0.26
                MarkerID:3      MarkerSize:0.00 MarkerPos:-0.74,0.43,-0.18
                MarkerID:4      MarkerSize:0.00 MarkerPos:-0.78,0.43,-0.24
                MarkerID:5      MarkerSize:0.00 MarkerPos:-0.74,0.41,-0.28
                MarkerID:6      MarkerSize:0.00 MarkerPos:0.00,0.00,0.00
Skeletons [Count=0]
Labeled Markers [Count=0]
However, when I disabled "theClient->SetDataCallback( DataHandler, theClient )" and tried to receive data by GetLastFrameOfData(). I have added the following codes after it has retrieved Data Descriptions:

Code: Select all

	sFrameOfMocapData* pData = theClient->GetLastFrameOfData();
	cout << "pData->nRigidBodies: " << pData->nRigidBodies << endl;
	cout << "pData->nMarkerSets: " << pData->nMarkerSets << endl;
But all I received were zeros. The result is displayed as follows:

Code: Select all

Connecting to server at
Connecting to server at LocalMachine
NatNet Sample Client (NatNet ver.
[SampleClient] Server application info:
Application: Motive (ver.
NatNet Version:
Client IP:
Server IP:
Server Name: XXXX

Client initialized and ready.
[SampleClient] Sending Test Request

[SampleClient] Requesting Data Descriptions...[SampleClient] Received 3 Data Descriptions:
Data Description # 0 (type=1)
RigidBody Name : Rigid Body 1
RigidBody ID : 1
// More info here, omitted for brevity. 

Client is connected to server and listening for data...
pData->nRigidBodies: 0
pData->nMarkerSets: 0
Does anyone know why? Really appreciate the help!


NaturalPoint Employee
NaturalPoint Employee
Posts: 455
Joined: Mon Jan 19, 2015 11:52 am

Re: Server connected but GetLastFrameOfData() under c++ does not work

Post by steven.andrews » Tue Aug 07, 2018 10:52 am

Hello Arthur,

Thank you for reaching out to the community regarding this question.

GetLastFrameOfData has been deprecated and is no longer supported under C++. Data should be polled from the data callback function instead.

If you encounter any issues with the callback, please feel free to reach out to us directly.

Steven Andrews
OptiTrack | Senior Customer Support Engineer

Post Reply