I am creating an augmented reality app using the Project Tango. An essential part of this is accurate position tracking. Of course I understand that no inertial tracking system is perfect, but the Tango seems to have worked pretty well so far.
However, in the past few days, the translation data (x, y, z) from the Tango appears to be experiencing slight drift, even when the device is held stationary. I have the device writing X, Y, and Z coords to the screen, and when the device is sitting still, with nothing in its field of view changing, the X value slowly rises, and the Y and Z values slowly fall. The rotation values hold steady and are always accurate. The drift occasionally changes direction, and can gain speed as well, sometimes increasing at rates of 0.1 units per second.
Rotating the device also produces strange translation behavior, with large drifting occurring upon rotation about any of the three axes. Moving the device, predictably, causes larger drifts, and appears to increase the "velocity" of the events.
Ordinarily I would chalk this up to the device's inaccuracy, but its performance seems to have suffered since I started using it two weeks ago. The values used to be much more stable. Is there anything I can do to "reset" it to the way it used to be, or is there something that's I've done that could be causing this?
Attached below is the callback function for pose data:
@Override
public void onPoseAvailable(final TangoPoseData tangoPoseData) {
if (tangoPoseData.baseFrame == TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION
&& tangoPoseData.targetFrame == TangoPoseData.COORDINATE_FRAME_DEVICE) {
rotationQuat = new vec4((float) tangoPoseData.rotation[TangoPoseData.INDEX_ROTATION_X],
(float) tangoPoseData.rotation[TangoPoseData.INDEX_ROTATION_Y],
(float) tangoPoseData.rotation[TangoPoseData.INDEX_ROTATION_Z],
(float) tangoPoseData.rotation[TangoPoseData.INDEX_ROTATION_W]);
rotationMat = rotationQuat.toMatrix();
Matrix.rotateM(rotationMat, 0, 90, 1.f, 0.f, 0.f);
position = new vec3(SCALE_FACTOR * (float) tangoPoseData.translation[TangoPoseData.INDEX_TRANSLATION_X],
SCALE_FACTOR * (float) (tangoPoseData.translation[TangoPoseData.INDEX_TRANSLATION_Z]),
SCALE_FACTOR * (float) (-1 * tangoPoseData.translation[TangoPoseData.INDEX_TRANSLATION_Y]));
float[] translationMatrix = new float[16];
Matrix.setIdentityM(translationMatrix, 0);
Matrix.translateM(translationMatrix, 0, -1.0f * position.x, -1.0f * position.y, -1.0f * position.z);
SceneCamera.Instance().setEye(position);
SceneCamera.Instance().setCameraOrientation(rotationMat);
SceneCamera.Instance().setCameraTranslation(translationMatrix);
main.displayVals(position, rotationQuat);
}
}
SceneCamera is a class being used to move the "camera" in space.
SCALE_FACTOR = 1.0
The Y and Z axes being switched in translation was necessary to convert to OpenGL coordinates.
Any guidance on this issue would be greatly appreciated.
EDIT: The drifting appears to be present in the Project Tango Explorer app as well. When using the Area Learning functionality of that app, the device's position jitters and drifts when held still, and when rotated about the Z axis (axis going through the screen), significant translation drift occurs, when it should be remaining in place. This leads me to believe it is a problem with the Tango's calibration and not my code.