NatNet: Remote Requests/Commands

Back to the Main pageBack to the NatNet SDK page

Remote Requests/Commands[edit]

The NatNet SDK features methods for sending remote commands and requests from a client application over to a connected server application. The SendMessageAndWait method within a NatNetClient object passes one of the NatNet commands each time it's called. NatNet commands are sent via the UDP connection; 1510 port by default. Once a NatNet server application (e.g. Motive) receives the remote command, corresponding actions will be performed.

For a sample use of NatNet commands, refer to the provided WinFormSample.


ErrorCode	SendMessageAndWait( const char* szRequest,
				    void** ppServerResponse, 
					int* pResponseSize );
ErrorCode	SendMessageAndWait( const char* szRequest,
				    int tries, int timeout, 
				    void** ppServerResponse,
				    int* pResponseSize );
Sends a NatNet command to the NatNet server and waits for a response.
Input Parameters:[edit]
  • szRequest: NatNet command.
  • tries: Number of attempts to send the command. Default: 10.
  • timeout: Number of milliseconds to wait for a response from the server before the call times out. Default: 20.
  • ppServerResponse: Application defined response.
  • pResponseSize: Number of bytes in response
ErrorCode, On success, it returns 0 or ErrorCode_OK indicating that the remmote message have been successfully delivered.

Motive Supported NatNet Commands/Requests[edit]

Command (string) Description Parameters Returns
UnitsToMillimeters Request current system’s units, in terms of millimeters none float
FrameRate Request current system’s tracking framerate none float
StartRecording Start recording none none
StopRecording Stop recording none none
LiveMode Switch to Live mode none none
EditMode Switch to Edit mode none None
CurrentMode Request current mode none int
TimelinePlay Start take playback none none
TimelineStop Stop take playback none none
SetPlaybackTakeName Set playback take Take name None
SetRecordTakeName Set record take name Take name None
SetCurrentSession Set current session Session name None
SetPlaybackStartFrame Set start frame Frame number None
SetPlaybackStopFrame Set stop frame Frame number None
SetPlaybackCurrentFrame Set current frame Frame number None
CurrentTakeLength Request length of current take None Number of frames (int)
AnalogSamplesPerMocapFrame Request number of analog samples per motion capture frame None int

Sample Use[edit]

Below is a sample use of the NatNet commands from the WinFormsSample application.

private void RecordButton_Click(object sender, EventArgs e)
	string command = "StartRecording";

	int nBytes = 0;
	byte[] response = new byte[10000];
	int rc = m_NatNet.SendMessageAndWait(command, 3, 100, out response, out nBytes);
	if (rc != 0)
		OutputMessage(command + " not handled by server");
		int opResult = System.BitConverter.ToInt32(response, 0);
		if (opResult == 0)
			OutputMessage(command + " handled and succeeded.");
			OutputMessage(command + " handled but failed.");