In this post I’ll tell you a little about the experience of working with Optitrack SDK and connecting the TrackIR.

TrackIR and Optitrack SDK

TrackIR can be managed from Optitrack SDK, but there are some features:

– Vector 6DOF value defined by the TrackIR device or used TrackClip. And you may receive only one vector per frame.

– Each frame when using TrackIR has zero id’s in contrast to Optitrack cameras.

– TrackIR has a fixed FPS and when you try to change the value then -1 is setting as the current fps value for the camera without an error of a function execution. So it is better don’t even do that for TrackIR.

Data lag

When working with Optitrack SDK there could be a lag (delay) in receiving data. The reason for this was the use of smoothing vector, although such an operation is recommended in the documentation for Optitrack SDK. But all the same information can always be filtered when you will need it, but sometimes you need to get them to the greatest possible accuracy.

The very same smoothing is performed through an interface INPSmoothing

CComPtr<INPSmoothing> m_spSmoothingYaw;

CComPtr<INPSmoothing> m_spSmoothingPitch;

CComPtr<INPSmoothing> m_spSmoothingRoll;

CComPtr<INPSmoothing> m_spSmoothingX;

CComPtr<INPSmoothing> m_spSmoothingY;

CComPtr<INPSmoothing> m_spSmoothingZ;

And the code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// now smooth the values
m_spSmoothingYaw->Update(varYaw, varEmpty);
m_spSmoothingPitch->Update(varPitch, varEmpty);
m_spSmoothingRoll->Update(varRoll, varEmpty);
m_spSmoothingX->Update(varX, varEmpty);
m_spSmoothingY->Update(varY, varEmpty);
m_spSmoothingZ->Update(varZ, varEmpty);
// get the smoothed data
m_spSmoothingYaw->get_X(&varYaw);
m_spSmoothingPitch->get_X(&varPitch);
m_spSmoothingRoll->get_X(&varRoll);
m_spSmoothingX->get_X(&varX);
m_spSmoothingY->get_X(&varY);
m_spSmoothingZ->get_X(&varZ);
// now smooth the values        m_spSmoothingYaw->Update(varYaw, varEmpty);     m_spSmoothingPitch->Update(varPitch, varEmpty);     m_spSmoothingRoll->Update(varRoll, varEmpty);       m_spSmoothingX->Update(varX, varEmpty);     m_spSmoothingY->Update(varY, varEmpty);     m_spSmoothingZ->Update(varZ, varEmpty);
// get the smoothed data        m_spSmoothingYaw->get_X(&varYaw);       m_spSmoothingPitch->get_X(&varPitch);       m_spSmoothingRoll->get_X(&varRoll);     m_spSmoothingX->get_X(&varX);       m_spSmoothingY->get_X(&varY);       m_spSmoothingZ->get_X(&varZ);

Skip empty frames

By default, sdk is configured so that without any data in the scope of the camera, the frame is not processed. This may not always be convenient. Switching to the mode in a permanent job, even if there is no data is the following method:

1
2
3
4
5
CComVariant var = (bool) true;

// don't skip empty frames

m_spCamera->SetOption( NP_OPTION_SEND_EMPTY_FRAMES, var );
A little about Optitrack SDK and TrackIR
Tagged on:                 

Leave a Reply

Your email address will not be published. Required fields are marked *