LogoLogo
WebsiteSupportDownloadsForumsQuick LinksContact Us
v3.2
v3.2
  • OptiTrack Documentation
  • WHAT'S NEW
    • What's New in Motive 3.2
  • QUICK START GUIDES
    • Quick Start Guide: Getting Started
    • Quick Start Guide: Prime Color Camera Setup
    • Quick Start Guide: Precision Capture
    • Quick Start Guide: Tutorial Videos
    • Quick Start Guide: Active Marker Tracking
    • Quick Start Guide: Outdoor Tracking Setup
  • HARDWARE
    • Cameras
      • Ethernet Cameras
        • PrimeX 120
        • PrimeX 41
        • PrimeX 22
        • PrimeX 13
        • PrimeX 13W
        • SlimX 13
        • Prime Color
        • VersaX 22
        • VersaX 41
        • VersaX 120
      • USB Cameras
        • Slim 3U
        • Flex 13
        • Flex 3
        • V120:Duo
        • V120:Trio
        • Adjusting Global Origin for Tracking Bars
    • Prepare Setup Area
    • Camera Mount Structures
    • Camera Placement
    • Ethernet Camera Network Setup
      • General Overview and Specs
      • Windows 10 Network Settings
      • Cabling and Load Balancing
      • Switch Configuration for PrimeX 120
      • NETGEAR ProSafe GSM7228S: Disabling the Broadcast Storm Control
      • White/Blacklisting Cameras
    • USB Camera System Setup
      • USB Camera Network Overview and Specs
      • V120:Duo and Trio Setup
      • Tracking Bar Coordinate System
        • Transforming Coordinate System: Global to Local
    • Aiming and Focusing
    • Camera Status Indicators
  • MOTIVE
    • Installation and License Activation
    • Motive Basics
    • Calibration
      • .mcal XML Calibration Files
      • Continuous Calibration
      • Continuous Calibration (Info Pane)
      • Calibration Squares
    • Markers
    • Assets
      • Gizmo Tool: Translate, Rotate, and Scale
    • Rigid Body Tracking
      • Aligning Rigid Body Pivot Point with a Replicated 3D Model
    • Skeleton Tracking
    • Trained Markersets
    • IMU Sensor Fusion
    • Data Recording
      • Data Types
    • Labeling
    • Data Editing
    • Data Export
      • Data Export: BVH
      • Data Export: C3D
      • Data Export: CSV
      • Data Export: FBX
      • Data Export: TRC
    • Data Streaming
    • Camera Video Types
    • Audio Recording
    • Motive HotKeys
    • Measurement Probe Kit Guide
    • Motive Batch Processor
    • Reconstruction and 2D Mode
  • MOTIVE UI PANES
    • Settings
      • Settings: General
      • Settings: Assets
      • Settings: Live Pipeline
      • Settings: Streaming
      • Settings: Views
      • Settings: Mouse and Keyboard
      • Settings: Audio
    • Assets Pane
    • Builder Pane
    • Constraints Pane
      • Constraints XML Files
    • Calibration Pane
    • Data Pane
    • Devices Pane
    • Edit Tools Pane
    • Graph View Pane
    • Info Pane
    • Labels Pane
    • Log Pane
    • Probe Pane
    • Properties Pane
      • Properties Pane: Camera
      • Properties Pane: Force Plates
      • Properties Pane: NI-DAQ
      • Properties Pane: OptiHub2
      • Properties Pane: Rigid Body
      • Properties Pane: Skeleton
      • Properties Pane: Take
      • Properties Pane: Trained Markerset
      • Properties Pane: eSync2
    • Status Panel
    • Toolbar/Command Bar
    • Control Deck
    • Viewport
  • PLUGINS
    • OptiTrack Blender Plugin
      • OptiTrack Blender Plugin
    • OptiTrack Unreal Engine Plugin
      • Unreal Engine: OptiTrack Live Link Plugin
        • Quick Start Guide: Real-Time Retargeting in Unreal Engine with Live Link Content
        • Unreal Editor for Fortnite (UEFN): OptiTrack Plugin for Live Link Hub
        • Unreal Engine: Live Link Camera Stream Setup
        • Live Link Content: Active Puck Static Meshes
      • Unreal Engine: MotionBuilder Workflow
      • Unreal Engine: HMD Setup
      • Unreal Engine VCS Inputs
    • OptiTrack Unity Plugin
      • Unity: HMD Setup
    • OptiTrack OpenVR Driver
    • OptiTrack MATLAB Plugin
    • Autodesk Maya
      • Autodesk Maya: OptiTrack Insight VCS Plugin
    • Autodesk MotionBuilder
      • Autodesk MotionBuilder Plugin
      • Autodesk MotionBuilder: OptiTrack Skeleton Plugin
      • Autodesk MotionBuilder: OptiTrack Optical Plugin
      • Autodesk MotionBuilder: OptiTrack Insight VCS Plugin
      • Autodesk MotionBuilder: Timecode Data
    • OptiTrack Peripheral API
    • External Plugins
      • Houdini 19 Integration
  • ACTIVE COMPONENTS
    • Active Components Hardware
      • Active Puck
      • Wired AnchorPuck
      • CinePuck
      • Wired CinePuck
      • BaseStation
      • Information for Assembling the Active Tags
      • Manus Glove Setup
    • Configuration
      • Active Batch Programmer
      • Active Hardware Configuration: PuTTY
      • Active Component Firmware Compatibility
    • Active Marker Tracking
      • Active Finger Marker Set
  • SYNCHRONIZATION
    • Synchronization Hardware
      • External Device Sync Guide: eSync 2
      • External Device Sync Guide: OptiHub2
    • Synchronization Setup
    • OptiTrack Timecode
  • VIRTUAL PRODUCTION
    • Unreal Engine: OptiTrack InCamera VFX
    • Entertainment Marker Sets
    • PrimeX 41
  • MOVEMENT SCIENCES
    • Movement Sciences Hardware
      • General Motive Force Plate Setup
      • AMTI Force Plate Setup
      • Bertec Force Plate Setup
      • Kistler Force Plate Setup
      • Delsys EMG Setup
      • NI-DAQ Setup
      • Multiple Device Setup
    • Movement Sciences Marker Sets
      • Biomechanics Marker Sets
      • Biomech (57)
      • Rizzoli Marker Sets
    • For Visual3D Users
    • Prime Color Camera Setup
      • Prime Color Setup: Required Components
      • Prime Color Setup: Hardware Setup
      • Prime Color Camera Setup: Camera Settings
      • Prime Color Camera Setup: Prime Color FS Calibration
      • Prime Color Setup: Data Recording / Export
      • Prime Color Camera Setup: FAQ / Troubleshooting
      • Prime Color Camera Setup: Windows Network Settings
  • VIRTUAL REALITY
    • VR Plugins
      • VR Unreal Engine
        • OptiTrack Unreal Engine Plugin
        • Unreal Engine: OptiTrack Live Link Plugin
          • UE5.1 Live Link Retarget External Workaround
        • Unreal Engine VCS Inputs
      • VR Unity
        • OptiTrack Unity Plugin
      • VR OpenVR
        • OptiTrack OpenVR Driver
    • VR HMD Setup
      • Unreal Engine: HMD Setup
      • Unity: HMD Setup
      • Manually Calibrating the HMD Pivot Point
      • Sync Configuration with an HTC Vive System
    • SlimX 13
    • Active Marker Tracking
      • Active Finger Marker Set
    • Synchronization Hardware
      • External Device Sync Guide: eSync 2
      • External Device Sync Guide: OptiHub2
  • ANIMATION
    • Autodesk Maya
      • Autodesk Maya: OptiTrack Insight VCS Plugin
    • Autodesk MotionBuilder
      • Autodesk MotionBuilder Plugin
      • Autodesk MotionBuilder: OptiTrack Skeleton Plugin
      • Autodesk MotionBuilder: OptiTrack Optical Plugin
      • Autodesk MotionBuilder: OptiTrack Insight VCS Plugin
      • Autodesk MotionBuilder: Timecode Data
  • ROBOTICS
    • MoCap4ROS2 Setup
    • OptiTrack Robot Applications
    • Outdoor Tracking Setup
  • DEVELOPER TOOLS
    • Developer Tools Overview
    • Camera SDK
      • Class: cCameraModule
      • Class: cUID
    • Motive API
      • Motive API: Quick Start Guide
      • Motive API Overview
      • Motive API: Function Reference
      • Motive API Camera Calibration
    • NatNet SDK
      • NatNet 4.1
      • NatNet: Class/Function Reference
      • NatNet: Creating a Managed (C sharp) Client Application
      • NatNet: Creating a Native (C++) Client Application
      • NatNet: Data Types
      • NatNet: Matlab Wrapper
      • NatNet: Migration to NatNet 3.0 libraries
      • NatNet: Remote Requests/Commands
      • NatNet: Sample Projects
      • NatNet: Unicast Data Subscription Commands
      • Latency Measurements
    • VRPN Sample
    • Peripheral API: Glove Devices
  • SKELETON MARKER SETS
    • Full Body
      • Baseline (41)
      • Core (50)
      • Biomech (57)
      • Conventional (39)
    • Full Body + Fingers
      • Baseline + Passive Fingers (49)
      • Baseline + Active Fingers (57)
      • Core + Passive Fingers (54)
      • Core + Active Fingers (62)
    • Upper
      • Baseline Upper (25)
      • Conventional Upper (27)
    • Lower
      • Baseline Lower (20)
      • Helen Hayes Lower (19)
      • Conventional Lower (16)
    • Hand and Fingers
      • Left/Right Hand (4) Active
      • Left/Right Hand (10) Active + Passive
      • Active Finger Marker Set
    • Glove Device Setup
      • Manus Glove Setup
      • StretchSense Glove Setup
    • Rizzoli Marker Sets
    • Entertainment Marker Sets
    • Rigid Body Skeleton Marker Set
  • GENERAL TROUBLESHOOTING
    • Licensing Troubleshooting
    • Windows 11 Optimization for Realtime Applications
    • Network Troubleshooting
    • Troubleshooting Q&A
    • Running Motive on High DPI Displays
    • Firewall Settings
Powered by GitBook
On this page
  • Remote Requests/Commands
  • NatNetClient::SendMessageAndWait
  • Remote Commands
  • Subscription Commands
  • Sample Use

Was this helpful?

Export as PDF
  1. DEVELOPER TOOLS
  2. NatNet SDK

NatNet: Remote Requests/Commands

PreviousNatNet: Migration to NatNet 3.0 librariesNextNatNet: Sample Projects

Last updated 1 month ago

Was this helpful?

Remote Requests/Commands

The NatNet SDK features sending remote commands/requests from a client application over to a connected server application (i.e. Motive).

The SendMessageAndWait method under NatNetClient class is the core method for sending remote commands. This function takes in a string value of the command and sends it over to the connected Motive server each time it's called, and once the server receives the remote command, corresponding actions will be performed. Please note that only a selected set of commands can be understood by the server, which are listed under the chart below.

NatNet commands are sent via the UDP connection, 1510 port by default.

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

NatNetClient::SendMessageAndWait

ErrorCode	SendMessageAndWait( const char* szRequest,
				    void** ppServerResponse, 
					int* pResponseSize );
ErrorCode	SendMessageAndWait( const char* szRequest,
				    int tries, int timeout, 
				    void** ppServerResponse,
				    int* pResponseSize );

Description

Sends a NatNet command to the NatNet server and waits for a response.

Input Parameters:

  • szRequest: NatNet command string, which is one of the commands listed on the below chart. If the command requires input parameters, corresponding parameters should be included in the command with comma delimiters. (e.g. string strCommand = "SetPlaybackTakeName," + TakeName;).

  • 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: Server response for the remote command. The response format depends on which command is sent out.

  • pResponseSize: Number of bytes in response

Returns:

ErrorCode, On success, it returns 0 or ErrorCode_OK.

Remote Commands

Motive Supported NatNet Commands/Requests

string command = "LiveMode";
UnitsToMillimeters

Sending this command requests current system’s measurement units, in terms of millimeters.

Parameters (String): None

Returns: Float

Sample command string:

string command = "UnitsToMillimeters";
FrameRate

Queries for the tracking framerate of the system. Returns a float value representing the system framerate.

Parameters (String): None

Returns: Float

Sample command string:

string command = "FrameRate";
CurrentMode

Requests current mode that Motive is in. Returns 0 if Motive is in Live mode. Returns 1 if Motive is in Edit mode.

Parameters (String): None

Returns: Int

Sample command string:

string command = "CurrentMode";
StartRecording

This command initiates recording in Motive.

Parameters (String): None

Returns: None

Sample command string:

string command = "StartRecording";
StopRecording

This command stops recording in Motive.

Parameters (String): None

Returns: None

Sample command string:

string command = "StopRecording";
LiveMode

This command switches Motive to Live mode.

Parameters (String): None

Returns: None

Sample command string

string command = "LiveMode";
EditMode

This command switches Motive to Edit mode.

Parameters (String): None

Returns: None

Sample command string:

string command = "EditMode";
TimelinePlay

Starts playback of a Take that is loaded in Motive.

Parameters (String): None

Returns: None

Sample command string:

string command = "TimelinePlay";
TimelineStop

Stops playback of the loaded Take.

Parameters (String): None

Returns: None

Sample command string:

string command = "TimelineStop";
SetPlaybackTakeName

Set playback take.

Parameters (String): Take name

Returns: None

Sample command string:

string command = "SetPlaybackTakeName," + stringTakeName;
SetRecordTakeName

Set a take name to record.

Parameters (String): Take name

Returns: None

Sample command string:

string command = "SetRecordTakeName," + stringTakeName;
SetCurrentSession

Set current session. If the session name already exists, Motive switches to that session. If the session does not exist, Motive will create a new session. You can use absolute paths to define folder locations.

Parameters (String): Session name

Returns: None

Sample command string:

string command = "SetCurrentSession," + stringSessionName;</source><source>string command = "SetCurrentSession," + "c:/folder"
CurrentSessionPath

Gets the unix-style path to the current session folder as a string value, including trailing delimiter.

Parameters (String): none

Returns: string

Sample command string:

string folder = "CurrentSessionPath";
SetPlaybackStartFrame

Set start frame.

Parameters (String): Frame Number

Returns: None

Sample command string:

string command = "SetPlaybackStartFrame," + stringFrameNumber;
SetPlaybackStopFrame

Sets stop frame.

Parameters (String): Frame Number

Returns: None

Sample command string:

string command = "SetPlaybackStopFrame," + stringFrameNumber;
SetPlaybackCurrentFrame

Set current frame.

Parameters (String): Frame Number

Returns: None

Sample command string:

string command = "SetPlaybackCurrentFrame," + stringFrameNumber;
SetPlaybackLooping

Enable or disable looping in the playback. To disable, zero must be sent along with the command.

Parameters (String): None

Returns: None

Sample command string:

string enablelooping = "SetPlaybackLooping"; 

string disablelooping = "SetPlaybackLooping, 0";
EnableAsset

Enables tracking of corresponding asset (rigid body / skeleton) from Motive.

Parameters (String): Asset name

Returns: None

Sample command string:

string command = "EnableAsset," + stringNodeName;
DisableAsset

Disables tracking of a corresponding asset (rigid body / skeleton) from Motive.

Parameters (String): Asset name

Returns: None

Sample command string:

string command = "DisableAsset," + stringNodeName;
GetProperty

Queries the server for configured value of a property in Motive. The property name must exactly match the displayed name. This request string must have the following inputs along with the command, each of them separated by a comma.

  • Node name

  • Property name

Parameters (String):

  • Node name (if applicable)

  • Property name

Returns: Int

Sample command string:

string command = "GetProperty," + stringNodeName + "," + stringPropertyName;

For rigid body assets, Streaming ID of rigid bodies can be used in place of the stringNodeName. For example, string command for getting name of a rigid body with streaming ID of 3 would be:

string command = "GetProperty," + "3"+ "," + "Name";

eSync:2:

Accessing the eSync 2 requires '#' to be included at the beginning of the eSync 2's serial number. If the '#' is not present, it will make the eSync 2 inaccessible. ie. GetProperty, eSync 2 #ES002005, Source Value

SetProperty

Parameters (String):

  • Node name (Leave empty if not applicable)

  • Property name

  • Desired value

Returns: Int

Sample command string:

string command = "SetProperty," + stringNodeName + "," + stringPropertyName + "," + stringPropertyValue;
//Sets the frame rate of the camera system to 180FPS.
string command = "SetProperty,Master Rate,180";
// Sets the gain on camera #13003 to 2.
"SetProperty," + "Prime 13 #13003", + "," + "Gain" + "," + "2";

For rigid body assets, Streaming ID of rigid bodies can be used in place of the stringNodeName. For example, string command for enabling rigid body with streaming ID of 3 would be:

string command = "SetProperty," + "3"+ "," + "Enable" + "," + "True";

eSync:2:

Accessing the eSync 2 requires '#' to be included at the beginning of the eSync 2's serial number. If the '#' is not present, it will make the eSync 2 inaccessible. ie. GetProperty, eSync 2 #ES002005, Source Value

GetTakeProperty

Parameters (String):

  • Take Name. Leave empty for currently loaded take.

Returns: Depends on the property type.

Sample command string:

string command = "GetTakeProperty," + takeName + "," + propertyName;
//Querying for EndFrame number on the currently loaded take. string command = "GetTakeProperty,,End Frame";
CurrentTakeLength

Request length of current take.

Parameters (String): None

Returns: Int

Sample command string:

string command = "CurrentTakeLength";
RecalibrateAsset

Recalibrates the asset. Returns integer indicating if command was successful. Zero if successful.

Parameters (String): Asset Name

Returns: Int

Sample command string:

string command = "RecalibrateAsset";
ResetAssetOrientation

Reorients the asset. Returns integer indicating if command was successful. Zero if successful.

Parameters (String): Asset Name

Returns: Int

Sample command string:

string command = "ResetAssetOrientation";

Subscription Commands

Supported for Motive 3.0 or above.

Following is a general format used for the subscription command strings:

  • SubscribeToData,[DataType],[All or specific asset]

  • SubscribeByID,[DataType],[ID]

Sample Use

Start Recording

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");
	}
	else
	{
		int opResult = System.BitConverter.ToInt32(response, 0);
		if (opResult == 0)
			OutputMessage(command + " handled and succeeded.");
		else
			OutputMessage(command + " handled but failed.");
	}
}

Framerate Query

// [NatNet] [optional] Query mocap server for the current camera framerate
int nBytes = 0;
byte[] response = new byte[10000];
int rc;
rc = m_NatNet.SendMessageAndWait("FrameRate", out response, out nBytes);

if (rc == 0)
{
    try
    {
        m_ServerFramerate = BitConverter.ToSingle(response, 0);
        OutputMessage(String.Format("   Camera Framerate: {0}", m_ServerFramerate));
    }
    catch (System.Exception ex)
    {
        OutputMessage(ex.Message);
    }
}

Setting name of the recorded Take

private void SetRecordingTakeButton_Click(object sender, EventArgs e)
{
    int nBytes = 0;
    byte[] response = new byte[10000];
    String strCommand = "SetRecordTakeName," + RecordingTakeNameText.Text;
    int rc = m_NatNet.SendMessageAndWait(strCommand, out response, out nBytes);
}

Setting Motive Properties

private void SetPropertyButton_Click(object sender, EventArgs e)
{
    int nBytes = 0;
    byte[] response = new byte[10000];
    string command = "SetProperty," + NodeNameText.Text + "," + PropertyNameText.Text + "," + PropertyValueText.Text;
    int rc = m_NatNet.SendMessageAndWait(command, out response, out nBytes);
    if (rc != 0)
    {
         OutputMessage(command + " not handled by server");
     }
    else
    {
        int opResult = System.BitConverter.ToInt32(response, 0);
        if (opResult == 0)
            OutputMessage(command + " handled and succeeded.");
        else
            OutputMessage(command + " handled but failed.");
    }
}

Requests Motive to configure specified properties. The property name must exactly match the respective name of setting displayed in Motive. Please refer to the page for the list of properties. Master Rate can be used for controlling the frame rate of the camera system. For configuring camera settings remotely, use the "model #[serial]" string format.

Request property of a Take. You can query property of a specific Take by entering the name, or enter empty string to query the currently loaded take. Most of the properties available in the can be queried through this command.

Name of the property. See .

Subscription commands work with Unicast streaming protocol only. When needed, unicast clients can send subscription commands to receive only specific data types through the data stream. This allows users to minimize the size of streaming packets. For more information, read through the page.

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

Properties pane
Properties: Take
Properties: Take
NatNet: Unicast Data Subscription Commands
WinFormsSample
WinFormSample
remote commands
remote commands