You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 2, 2018. It is now read-only.
05-30 12:00:43.132 21775-21824/com.projecttango.experiments.javamotiontracking E/AndroidRuntime: FATAL EXCEPTION: GLThread 1267
Process: com.projecttango.experiments.javamotiontracking, PID: 21775
java.lang.ArrayIndexOutOfBoundsException: length=11; index=11
at com.google.atap.tangoservice.TangoPoseData.toString(TangoPoseData.java:278)
at com.projecttango.examples.java.motiontracking.MotionTrackingRajawaliRenderer.onRender(MotionTrackingRajawaliRenderer.java:108)
at org.rajawali3d.renderer.RajawaliRenderer.onRenderFrame(RajawaliRenderer.java:387)
at org.rajawali3d.surface.RajawaliSurfaceView$RendererDelegate.onDrawFrame(RajawaliSurfaceView.java:228)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
i've digged a bit and i've discovered that when the class TangoPoseData builds the string
statusCode is equal to 11 and STATUS_NAMES has 11 items, this wouldn't be a big issue except that when i use Messages to communicate with the main thread and UI the method in some way gets called, i suspect, and the app crash.
this is the code that i use:
publicclassMotionTrackingRajawaliRendererextendsRajawaliRenderer {
.....
publicMessagemessageToSend = newMessage();
@OverrideprotectedvoidonRender(longellapsedRealtime, doubledeltaTime) {
// Update the scene objects with the latest device position and orientation information.// Synchronize to avoid concurrent access from the Tango callback thread below.try {
TangoPoseDatapose =
TangoSupport.getPoseAtTime(0.0, TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
TangoPoseData.COORDINATE_FRAME_DEVICE,
TangoSupport.TANGO_SUPPORT_ENGINE_OPENGL,
mCurrentScreenRotation);
if (pose.statusCode == TangoPoseData.POSE_VALID) {
getCurrentCamera().setPosition((float) pose.translation[0],
(float) pose.translation[1],
(float) pose.translation[2]);
QuaternioninvOrientation = newQuaternion((float) pose.rotation[3],
(float) pose.rotation[0],
(float) pose.rotation[1],
(float) pose.rotation[2]);
// For some reason, rajawalli's orientation is inversed.Quaternionorientation = invOrientation.inverse();
getCurrentCamera().setOrientation(orientation);
// here i send the pose, that is validmessageToSend.obj = pose;
mta.handler.sendMessage(messageToSend);
}
} catch (TangoErrorExceptione) {
Log.e(TAG, "TangoSupport.getPoseAtTime error", e);
}
// Perform the actual OpenGL rendering of the updated objectssuper.onRender(ellapsedRealtime, deltaTime);
}
}
publicclassMotionTrackingActivityextendsActivity {
......
publicTextViewtextViewRawTangoData;
publicHandlerhandler;
@OverrideprotectedvoidonCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_motion_tracking);
mRenderer = setupGLViewAndRenderer();
textViewRawTangoData = (TextView) findViewById(R.id.textViewRawTangoData);
handler = newHandler(Looper.getMainLooper()) {
@OverridepublicvoidhandleMessage(Messagemsg) {
super.handleMessage(msg);
TangoPoseDatapose = (TangoPoseData) msg.obj;
if (pose == null) return;
Stringtxt = customPoseToString(pose);
if (txt == null) return;
textViewRawTangoData.setTextColor(Color.RED);
textViewRawTangoData.setText(txt);
}
};
// Check the current screen rotation and set it to the renderer.WindowManagermWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
DisplaymDisplay = mWindowManager.getDefaultDisplay();
mRenderer.setCurrentScreenRotation(mDisplay.getOrientation());
}
publicStringcustomPoseToString(TangoPoseDatapose) {
intstatusCode = pose.statusCode;
StringstatusName = pose.STATUS_NAMES[pose.statusCode];
doubletimestamp = pose.timestamp;
intbaseFrame = pose.baseFrame;
StringstringBaseFrame;
if (baseFrame < pose.FRAME_NAMES.length)
stringBaseFrame = pose.FRAME_NAMES[baseFrame];
elsestringBaseFrame = "NULL";
StringstringTargetFrame;
inttargetFrame = pose.targetFrame;
if (targetFrame < pose.FRAME_NAMES.length)
stringTargetFrame = pose.FRAME_NAMES[targetFrame];
elsestringTargetFrame = "NULL_2";
StringinfoString = String.format("TangoPoseData: status: %d (%s), time: %f, base: %d (%s), target: %d (%s)\n",
statusCode, statusName, timestamp, baseFrame, stringBaseFrame, targetFrame, stringTargetFrame);
StringposeString = String.format(" p: [%.3f, %.3f, %.3f], q: [%.4f, %.4f, %.4f, %.4f]\n",
pose.translation[0], pose.translation[1], pose.translation[2],
pose.rotation[0], pose.rotation[1], pose.rotation[2], pose.rotation[3]);
returninfoString + poseString;
}
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
if i call pose.toString() in the example Motion Tracking Activity, in the method:
of the class:
MotionTrackingRajawaliRenderer()
it thorws:
05-30 12:00:43.132 21775-21824/com.projecttango.experiments.javamotiontracking E/AndroidRuntime: FATAL EXCEPTION: GLThread 1267
Process: com.projecttango.experiments.javamotiontracking, PID: 21775
java.lang.ArrayIndexOutOfBoundsException: length=11; index=11
at com.google.atap.tangoservice.TangoPoseData.toString(TangoPoseData.java:278)
at com.projecttango.examples.java.motiontracking.MotionTrackingRajawaliRenderer.onRender(MotionTrackingRajawaliRenderer.java:108)
at org.rajawali3d.renderer.RajawaliRenderer.onRenderFrame(RajawaliRenderer.java:387)
at org.rajawali3d.surface.RajawaliSurfaceView$RendererDelegate.onDrawFrame(RajawaliSurfaceView.java:228)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
i've digged a bit and i've discovered that when the class TangoPoseData builds the string
statusCode
is equal to 11 andSTATUS_NAMES
has 11 items, this wouldn't be a big issue except that when i use Messages to communicate with the main thread and UI the method in some way gets called, i suspect, and the app crash.this is the code that i use:
The text was updated successfully, but these errors were encountered: