Im using the NatNet SDK to stream data. Everything works fine apart from getting the number of visible markers of a rigid body. Here the data structure of the rigidbody data:
typedef struct sRigidBodyData
{
int ID; // RigidBody identifier
float x, y, z; // Position
float qx, qy, qz, qw; // Orientation
int nMarkers; // Number of markers associated with this rigid body
* Markers; // Array of marker data ( [nMarkers][3] )
int* MarkerIDs; // Array of marker IDs
float* MarkerSizes; // Array of marker sizes
float MeanError; // Mean measure-to-solve deviation
sRigidBodyData()
{
Markers = 0; MarkerIDs = 0; MarkerSizes = 0;
}
} sRigidBodyData;
unfortunately nMarkers is the real number of markers and number of visible markers.
Is there a way of getting the number of visible markers for a rigid body?
The NatNet SDK reports marker data in several places:
RigidBody Data : Rigid Body Marker data contains the back-calculated, rigid-body "solved" positions of the Rigid Body's markers. This means if a marker is occluded, the marker position will still contain the solved location of where the marker "should have been" according to the solved position of the Rigid Body.
MarkerSet Data : sFrameOfMocapData::MocapData contains the "Point Cloud" (or observed) positions of the markers as calculated by the PointCloud (triangulation) engine. If a marker is occluded, this value will be filled by its model-solved value.
Labeled Markers : sFrameOfMocapData::LabeledMarkers. This is a raw list of Point-Cloud solved markers. If a marker is occluded it's value for that frame is (0.0,0.0,0.0)
For now, one solution is to cross reference the marker id from the Rigid Body Marker Data into the Labeled Markers list to detect occlusion, or else just use the Labeled Marker Data directly.
We are adding simpler occlusion identification in the next NatNet release.
Thanks a lot for your prompt reply. I implemented the proposed method now and it works. however there is one concern the marker ID's are not unique.
Rigid Body 1:
Marker 1
Marker 2
......
Rigid Body 2:
Marker 1
Marker 2
......
I can see that so far the order of the sets is everywhere the same:
Rigid Body Marker Data
LabeledMarkers
MocapData
Is your code implemented in such a way that the order in these three types is always the same for these three sets within a single frame?
For me so far the use of MarkerSet Data is a little unclear, i seems obsolete with respect to the other two.
It would be nice for the future to have unique marker ID's over multiple bodies and the name of the rigid body could be provided within the structure, like in MarkerSet Data. And i found out that the Rigid Body ID must not be unique, which i found strange, i assume internally you use a unique ID for every object.
RE RigidBody data, yes the order of the markers within the rigid body remains consistent. The IDS are indexes into the RigidBody. The RigidBody ID itself should be unique.
RE MarkerSet data, yes this is more of a legacy data type we keep to support older NatNet clients.
Should the tracking models list change, you should call GetDataDescriptions() to update your mode list.
The next NatNet release will include additional in-band IDS for easier correlating of RigidBodies and unique Marker IDS.