This wiki is intended for older versions of Motive. For the latest documentation, please refer to
docs.optitrack.com

Difference between revisions of "NatNet: Data Types"

Line 43: Line 43:
 
|style = "padding: 0.5em;"|''ServerDescription''
 
|style = "padding: 0.5em;"|''ServerDescription''
 
|style = "padding: 1em;"| Contains basic network information of the connected server application and the host computer that it is running on. Server descriptions are obtained by calling the GetServerDescription method.
 
|style = "padding: 1em;"| Contains basic network information of the connected server application and the host computer that it is running on. Server descriptions are obtained by calling the GetServerDescription method.
|-
+
|- style = "background:white;"
 
|style = "padding: 1em;"|Data Descriptions
 
|style = "padding: 1em;"|Data Descriptions
 
|style = "padding: 0.5em;"|''sDataDescriptions''
 
|style = "padding: 0.5em;"|''sDataDescriptions''
Line 61: Line 61:
 
     char** szMarkerNames;                  // array of marker names
 
     char** szMarkerNames;                  // array of marker names
 
  } sMarkerSetDescription;
 
  } sMarkerSetDescription;
|-
+
|- style = "background:white;"
 
|style = "padding: 1em;"|Rigid Body Description
 
|style = "padding: 1em;"|Rigid Body Description
 
|style = "padding: 0.5em;"|''sRigidBodyDescription''
 
|style = "padding: 0.5em;"|''sRigidBodyDescription''
Line 94: Line 94:
 
     sRigidBodyDescription RigidBodies[MAX_SKELRIGIDBODIES];  // array of rigid body (bone) descriptions  
 
     sRigidBodyDescription RigidBodies[MAX_SKELRIGIDBODIES];  // array of rigid body (bone) descriptions  
 
  } sSkeletonDescription;
 
  } sSkeletonDescription;
|-
+
|- style = "background:white;"
 
|style = "padding: 1em;"|Force Plate Description
 
|style = "padding: 1em;"|Force Plate Description
 
|style = "padding: 0.5em;"|''sForcePlateDescription''
 
|style = "padding: 0.5em;"|''sForcePlateDescription''

Revision as of 00:04, 10 May 2017

Main pageNatNet SDKNatNet: Data Types


This page provides an overview of the general data structure used in the NatNet software development kit (SDK) and how the library is used to parse received tracking information.

Info2.png

For specific details on each of the data types, please refer to the NatNetTypes.h header file.

General Structure


When receiving streamed data using the NatNet SDK library, its data descriptions should be received before receiving the tracking data. NatNet data is packaged mainly into two different formats: data descriptions and frame-specific tracking data. Utilizing this format, the client application can discover which data are streamed out from the server application in advance to accessing the actual tracking data.

For every asset (e.g. reconstructed markers, rigid bodies, skeletons, force plates) included within streamed capture sessions, their descriptions and tracking data are stored separately. This format allows frame-independent parameters (e.g. name, size, and number) to be stored within instances of the description structs, and frame-dependent values (e.g. position and orientation) to be stored within instances of the frame data structs. When needed, two different packets of an asset can be correlated by referencing to its unique identifier values.

When streaming from Motive, received NatNet data will contain only the assets that are enabled in the Project pane and the asset types that are set to true under Streaming Settings in the Data Streaming pane.

  • Dataset Descriptions contains descriptions of the motion capture data sets for which a frame of motion capture data will be generated. (e.g. sSkeletonDescription, sRigidBodyDescription)
  • Frame of Mocap Data contains a single frame of motion capture data for all the datasets described from the Dataset Descriptions. (e.g. sSkeletonData, sRigidBodyData)


Dataset Descriptions


To receive data descriptions from a connected server, use the NatNetClient::GetDataDescriptionList method. Calling this function saves a list of available descriptions in an instance of sDataSetDescriptions.

The sDataSetDescriptions structure stores an array of multiple descriptions for each of assets (MarkerSets, RigidBodies, Skeletons, and Force Plates) involved in a capture and necessary information can be parsed from it. The following table lists out the main data description structs that are available through the SDK. For a complete list of structs and their members, are listed in the NatNetTypes.h header file.

Description Struct
Data Type Saved struct Type Description
Native Library Managed Assembly
Server Description sServerDescription ServerDescription Contains basic network information of the connected server application and the host computer that it is running on. Server descriptions are obtained by calling the GetServerDescription method.
Data Descriptions sDataDescriptions List<DataDescriptor> Contains a list of multiple DataDescriptions each storing description objects for corresponding assets.
MarkerSet Description sMarkerSetDescription MarkerSet MarkerSet description contains a total number of markers in a MarkerSet and each of their labels. Note that rigid body and skeleton assets are included in the MarkerSet as well. Also, for every mocap session, there is a spcial MarkerSet named all, which contains a list of all of the labeld markers from the capture.


typedef struct sMarkerSetDescription
{
    char szName[MAX_NAMELENGTH];            // MarkerSet name
    int nMarkers;                           // # of markers in MarkerSet
    char** szMarkerNames;                   // array of marker names
} sMarkerSetDescription;
Rigid Body Description sRigidBodyDescription RigidBody Rigid body description contains corresponding rigid body names. Skeleton bones are also considered as rigid bodies, and in this case, the description also contains hierarchial relationship for parent/chile rigid bodies.


// Rigid Body Definition
typedef struct sRigidBodyDescription
{
    char szName[MAX_NAMELENGTH];            // RigidBody name
    int ID;                                 // RigidBody identifier
    int parentID;                           // ID of parent Rigid Body (in case hierarchy exists; otherwise -1)
    float offsetx, offsety, offsetz;        // offset position relative to parent
    int nMarkers;                           // Number of markers associated with this rigid body
    MarkerData* MarkerPositions;            // Array of marker locations ( [nMarkers][3] )
    int* MarkerRequiredLabels;              // Array of expected marker active labels - 0 if not specified. ( [nMarkers] )
} sRigidBodyDescription;
Skeleton Description sSkeletonDescription Skeleton Skeleton description contains corresponding skeleton asset name, skeleton ID, and total number of rigid bodies (bones) involved in the asset. The skeleton desciption also contains an array of rigid body descriptions which relates to individual bones of the corresponding skeleton.


// Skeleton Description
typedef struct sSkeletonDescription
{
    char szName[MAX_NAMELENGTH];                             // Skeleton name
    int skeletonID;                                          // Skeleton identifier
    int nRigidBodies;                                        // # of rigid bodies (bones) in skeleton
    sRigidBodyDescription RigidBodies[MAX_SKELRIGIDBODIES];  // array of rigid body (bone) descriptions 
} sSkeletonDescription;
Force Plate Description sForcePlateDescription ForcePlate Force plate description contains names and IDs of the plate and its channels as well as other hardware parameter settings. Please refer to the NatNetTypes.h header file for specific details.


// FrocePlate description
typedef struct sForcePlateDescription
{
    int ID;                                       // used for order, and for identification in the data stream
    char strSerialNo[128];                        // for unique plate identification
    float fWidth;                                 // plate physical width (manufacturer supplied)
    float fLength;                                // plate physical length (manufacturer supplied)
    float fOriginX, fOriginY, fOriginZ;           // electrical center offset (from electrical center to geometric center-top of force plate) (manufacturer supplied)
    float fCalMat[12][12];                        // force plate calibration matrix (for raw analog voltage channel type only)
    float fCorners[4][3];                         // plate corners, in world (aka Mocap System) coordinates, clockwise from plate +x,+y (refer to C3D spec for details)
    int iPlateType;                               // force plate 'type' (refer to C3D spec for details) 
    int iChannelDataType;                         // 0=Calibrated force data, 1=Raw analog voltages
    int nChannels;                                // # of channels (signals)
    char szChannelNames[MAX_ANALOG_CHANNELS][MAX_NAMELENGTH]; // channel names
} sForcePlateDescription;
Device Description sDeviceDescription Device An instance of the sDeviceDescription contains information of the data acquisition (NI-DAQ) devices. It includes information on both the DAQ device (ID, name , serial number) as well as its corresponding channels (channel count, channel data type, channel names). Please refer to the NatNetTypes.h header file for specific details.


// Peripheral Device description (e.g. NIDAQ)
typedef struct sDeviceDescription
{
    int ID;                                         // used for order, and for identification in the data stream
    char strName[128];                              // device name as appears in Motive
    char strSerialNo[128];                          // for unique device identification
    int iDeviceType;                                // device 'type' code 
    int iChannelDataType;                           // channel data type code
    int nChannels;                                  // # of currently enabled/active channels (signals)
    char szChannelNames[MAX_ANALOG_CHANNELS][MAX_NAMELENGTH];   // channel names
} sDeviceDescription;

Frame of Mocap Data


As mentioned in the beginning, frame-specific tracking data are stored separately from the DataDescription instances as this cannot be known ahead of time or out of band but only by per frame basis. These data gets saved into instances of sFrameOfMocapData for corresponding frames, and they will contain arrays of frame-specific data structs (e.g.sRigidBodyData, sSkeletonData) for each types of assets included in the capture. Respective frame number, timecode, and streaming latency values are also saved in these packets.

The sFrameOfMocapData can be obtained by setting up a frame handler function using the NatNetClient::SetFrameReceivedCallback method or by calling the GetLastFrameOfData() method. In most cases, a frame handler function must be assigned in order to make sure every frames are promptly processed. Refer to the provided SampleClient project for an exemplary setup.


FrameOfMocapData
Data Variable name Description
Native Managed
Frame Count iFrame Host (server) defined frame number.
Labeled Markers nLabeledMarkers nMarkers A total number of labeled markers in the frame.
LabeledMarkers A list of ordered, padded, point cloud solved, model filled (where occluded) labeled marker data. The data includes the unique ID, x/y/z positions, marker size, and its residual value from reconstruction.

(labeled markers not associated with a "MarkerSet").

Unlabeled Markers nOtherMarkers A total number of unlabeled markers in the frame.
OtherMarkers A list of point cloud solved 3D positions (X, Y, Z) for all unlabeled markers in the frame.
MarkerSet Data nMarkerSets A total number of markersets.
MocapData MarkerSets

A collection of MarkerSets (MarkerSet, Rigid Body, or Skeletons) in the frame. The struct includes name, number of involved markers, and their corresponding X/Y/Z locations.

Rigid Body Data nRigidBodies A total number of rigid body assets, both tracked and untracked, in the frame.
sRigidBodyData RigidBodyData A named segment with a unique ID, position, and orientation data, and the collection of identified markers used to define it. Its marker data indicates model-solved positions.
Skeleton Data nSkeletons A total number of skeleton assets, both tracked and untracked, in the frame.
sSkeletonData SkeletonData A named, hierarchical collection of RigidBodies. Marker data is model-solved positions.
Force Plate Data nForcePlates A total number of force plates.
ForcePlates Force plate channel data (Fx, Fy, Fz, Mx, My, Mz). Each channel data is saved as an instance of the sAnalogchnnelData which contains values measured from corresponding channel as well as the total number of analog subframes contained per mocap frame. Force plate data will contain multiple samples per mocap frame, depending upon the force plate acquisition rate. The total number of subframes per mocap frame can be quiried from a AnalogChannelData instance of each channel.
Analog Data nDevices A total number of analog devices in the capture. (e.g. NI-DAQ)
Devices An array containing data from each of analog device channels (e.g. NI-DAQ). Each channel data will be saved as an instance of the sAnalogchnnelData which contains values measured from corresponding channel as well as the total number of analog subframes contained per mocap frame.
Latency fSystemLatency For every sFrameOfMocapData received through NatNet, a system latency value is reported. The system latency value represents the total system latency, which is the calculated time between the camera hardware exposure and when Motive is ready to stream the data out; in other words, combining both the hardware and software latency.
fLatency For every sFrameOfMocapData received through NatNet, a software latency value is reported. The software latency value represents the software latency only. This is the time between when Motive receives all of of the camera data and when the data is ready to be streamed out.
Time Information Timecode Timing information for the frame. If SMPTE timecode is detected in the system, this time information is also included. See: OptiTrack Timecode
  • Frame ID
  • Frame Timestamp
  • SMPTE Timecode (If timecode is present)
TimecodeSubframe The subframe value of the timecode. See: OptiTrack Timecode
fTimestamp Software timestamp value. Reports the time since software start.

Additional Notes

  • One reconstructed 3D marker can be stored in two different places (e.g. in LabeledMarkers and in RigidBody) within a frame of mocap data. In those cases, unique identifier values of the marker can be used to correlate them in the client application if necessary.
  • Declarations for these data types are listed in the NatNetTypes.h header files within the SDK. The SampleClient project included in the \NatNet SDK\Sample folder illustrates how to retrieve and interpret the data descriptions and frame data.


Info2.png

Refer to the NatNetTypes.h header file or the NatNetML.dll assembly for the most up to date descriptions of the types.

Unique ID


Most of the NatNet SDK data packets contain ID values. This value is assigned uniquely to individual markers as well as each of assets within a capture. These values can be used to figure out which asset a given data packet is associated with. One common use is for correlating data descriptions and frame data packets of an asset.

Decoding Member IDs

For each member object that is included within a parental model, its unique ID value points to both its parental model and the member itself. Thus, the ID value of a member object needs to be decoded in order to parse which objects and the parent models they are referencing to.

For example, a skeleton asset is a hierarchical collection of bone rigid bodies, and each of its bone rigid bodies has unique ID that references to the involved skeleton model and the rigid body itself. When analyzing skeleton bones, its ID value needs to be decoded in order to extract the segment rigid body ID, and only then, it can be used to reference its descriptions.