2017-01-24 54 views
1

我正在嘗試編寫一個應用程序,該應用程序使用Google Tango Java API收集RGB和點雲數據。到目前爲止,我設法使用TangoCameraPreview在屏幕上顯示來自RGB相機的圖像,並且它似乎正在工作。但只要我點設備向牆壁,並開始捕捉到一些真正深入立刻與下面的異常崩潰:JNI錯誤:嘗試將TangoPointCloudData的實例傳遞給onXyzIjAvailable

I/tango_client_api: TangoErrorType TangoService_connectOnTangoEvent(void (*)(void*, const TangoEvent*), ...): Connecting callbacks... 
I/tango_client_api: TangoErrorType TangoService_connectOnTangoEvent(void (*)(void*, const TangoEvent*), ...): Done connecting callbacks. 
E/art: JNI ERROR (app bug): attempt to pass an instance of com.google.atap.tangoservice.TangoPointCloudData as argument 1 to void com.threedvideo.threedvideograbber.MainActivity$2.onXyzIjAvailable(com.google.atap.tangoservice.TangoXyzIjData) 
A/art: art/runtime/check_jni.cc:64] JNI DETECTED ERROR IN APPLICATION: bad arguments passed to void com.threedvideo.threedvideograbber.MainActivity$2.onXyzIjAvailable(com.google.atap.tangoservice.TangoXyzIjData) (see above for details) 
A/art: art/runtime/check_jni.cc:64] "Binder_3" prio=5 tid=17 Runnable 
A/art: art/runtime/check_jni.cc:64] | group="main" sCount=0 dsCount=0 obj=0x64946ba0 self=0x4ab112f8 
A/art: art/runtime/check_jni.cc:64] | sysTid=10535 nice=0 cgrp=apps sched=0/0 handle=0x4ab11028 
A/art: art/runtime/check_jni.cc:64] | state=R schedstat=(67362009 19616160 284) utm=3 stm=3 core=1 HZ=100 
A/art: art/runtime/check_jni.cc:64] | stack=0x4ab81000-0x4ab85000 stackSize=1016KB 
A/art: art/runtime/check_jni.cc:64] (no managed stack frames) 
A/art: art/runtime/check_jni.cc:64] 
A/art: art/runtime/runtime.cc:203] Runtime aborting... 
A/art: art/runtime/runtime.cc:203] Aborting thread: 
A/art: art/runtime/runtime.cc:203] "Binder_3" prio=5 tid=17 Runnable 
    | group="main" sCount=0 dsCount=0 obj=0x64946ba0 self=0x4ab112f8 
    | sysTid=10535 nice=0 cgrp=apps sched=0/0 handle=0x4ab11028 
    | state=R schedstat=(67965509 19729327 285) utm=3 stm=3 core=1 HZ=100 
    | stack=0x4ab81000-0x4ab85000 stackSize=1016KB 
    native: art::Thread::DumpStack(std::ostream&) const+87 [0x41714b78] (libart.so) 
    native: ??? [0x4170cc62] (libart.so) 
    native: art::Runtime::Abort()+79 [0x4170d204] (libart.so) 
    native: art::LogMessage::~LogMessage()+507 [0x415b889c] (libart.so) 
    native: ??? [0x415c0ad4] (libart.so) 
    native: art::JniAbortF(char const*, char const*, ...)+51 [0x415c1254] (libart.so) 
    native: ??? [0x41667ee2] (libart.so) 
    native: ??? [0x41668444] (libart.so) 
    native: ??? [0x416c6e56] (libart.so) 
    native: ??? [0x415ca020] (libart.so) 
    native: _JNIEnv::CallVoidMethod(_jobject*, _jmethodID*, ...)+19 [0x489d97c8] (libtango_client_api.so) 
    native: onXYZijParcelAvailable+217 [0x489d98d6] (libtango_client_api.so) 
    native: TangoListener::onXYZijParcelAvailable(android::Parcel const&)+47 [0x489cf8f8] (libtango_client_api.so) 
    native: Tango::ClientListener::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+261 [0x489dd0ee] (libtango_client_api.so) 
    native: android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+57 [0x401dc222] (libbinder.so) 
    native: android::IPCThreadState::executeCommand(int)+505 [0x401e0796] (libbinder.so) 
    native: android::IPCThreadState::getAndExecuteCommand()+37 [0x401e0b16] (libbinder.so) 
    native: android::IPCThreadState::joinThreadPool(bool)+47 [0x401e0b8c] (libbinder.so) 
    native: ??? [0x401e49a8] (libbinder.so) 
    native: android::Thread::_threadLoop(void*)+213 [0x401afa56] (libutils.so) 
    native: android::AndroidRuntime::javaThreadShell(void*)+65 [0x4023ceae] (libandroid_runtime.so) 
    native: ??? [0x401af588] (libutils.so) 
    native: __thread_entry+72 [0x401341b0] (libc.so) 
    native: pthread_create+240 [0x40134348] (libc.so) 
    (no managed stack frames) 

在我看來,像某種庫不兼容的,但我敢肯定, Tango Core和Tango Java API都是最新版本,都是昨天更新的。我錯過了什麼?

這是相當多的應用程序的所有代碼:

package com.threedvideo.threedvideograbber; 

import android.support.v7.app.AppCompatActivity; 
import android.os.Bundle; 
import android.util.Log; 

import com.google.atap.tangoservice.Tango; 
import com.google.atap.tangoservice.TangoCameraIntrinsics; 
import com.google.atap.tangoservice.TangoCameraPreview; 
import com.google.atap.tangoservice.TangoConfig; 
import com.google.atap.tangoservice.TangoCoordinateFramePair; 
import com.google.atap.tangoservice.TangoErrorException; 
import com.google.atap.tangoservice.TangoEvent; 
import com.google.atap.tangoservice.TangoInvalidException; 
import com.google.atap.tangoservice.TangoOutOfDateException; 
import com.google.atap.tangoservice.TangoPointCloudData; 
import com.google.atap.tangoservice.TangoPoseData; 
import com.google.atap.tangoservice.TangoXyzIjData; 

import java.util.ArrayList; 


public class MainActivity extends AppCompatActivity { 

    private static final String TAG = "MainActivity"; 

    private Tango tango; 
    private TangoConfig tangoConfig; 
    private TangoCameraPreview tangoCameraPreview; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
    } 

    @Override 
    protected void onStart() { 
     super.onStart(); 

     tango = new Tango(MainActivity.this, new Runnable() { 
      @Override 
      public void run() { 
       synchronized (MainActivity.this) { 
        try { 
         tangoConfig = setupTangoConfig(tango); 
         tango.connect(tangoConfig); 

         tangoCameraPreview = (TangoCameraPreview) findViewById(R.id.tango_camera_preview); 
         tangoCameraPreview.connectToTangoCamera(tango, TangoCameraIntrinsics.TANGO_CAMERA_COLOR); 

         startupTango(); 
        } catch (TangoOutOfDateException e) { 
         Log.e(TAG, "Tango service out of date", e); 
        } catch (TangoErrorException e) { 
         Log.e(TAG, "Tango service error", e); 
        } catch (TangoInvalidException e) { 
         Log.e(TAG, "Tango invalid exception", e); 
        } 
       } 
      } 
     }); 
    } 

    @Override 
    protected void onPause() { 
     super.onPause(); 

     synchronized (MainActivity.this) { 
      tangoCameraPreview.disconnectFromTangoCamera(); 
      tango.disconnect(); 
     } 
    } 

    private TangoConfig setupTangoConfig(Tango t) { 
     TangoConfig config = t.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT); 

     config.putBoolean(TangoConfig.KEY_BOOLEAN_DEPTH, true); 
     config.putBoolean(TangoConfig.KEY_BOOLEAN_COLORCAMERA, true); 
     config.putBoolean(TangoConfig.KEY_BOOLEAN_MOTIONTRACKING, true); 
     config.putBoolean(TangoConfig.KEY_BOOLEAN_AUTORECOVERY, true); 
     config.putBoolean(TangoConfig.KEY_BOOLEAN_HIGH_RATE_POSE, true); 
     config.putBoolean(TangoConfig.KEY_BOOLEAN_SMOOTH_POSE, true); 

     return config; 
    } 

    private void startupTango() { 
     final ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<>(); 
     framePairs.add(new TangoCoordinateFramePair(TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE, TangoPoseData.COORDINATE_FRAME_DEVICE)); 
     tango.connectListener(framePairs, new Tango.OnTangoUpdateListener() { 
      @Override 
      public void onPoseAvailable(TangoPoseData tangoPoseData) { 
      } 

      @Override 
      public void onXyzIjAvailable(TangoXyzIjData tangoXyzIjData) { 
      } 

      @Override 
      public void onFrameAvailable(int cameraId) { 
       if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) 
        tangoCameraPreview.onFrameAvailable(); 
      } 

      @Override 
      public void onTangoEvent(TangoEvent tangoEvent) { 
      } 

      @Override 
      public void onPointCloudAvailable(TangoPointCloudData tangoPointCloudData) { 
      } 
     }); 
    } 
} 
+1

表面上看,這不是你的錯誤,你可以做的事情很少。也許,降級Tango版本。 –

+0

@AlexCohn謝謝,我會盡力的。你的意思是下載以前版本的.jar包?還有一個工廠重置平板電腦的選項(我猜)。 –

+0

我不知道什麼能解決你的問題,但它在框架中聞起來像一個錯誤。我不認爲你可以做很多事情,除非等待修復,或者尋找一個沒有這個bug的舊版本。在https://developers.google.com/tango/apis/java –

回答

3

退房答案here相同或至少非常類似的問題。該解決方案需要添加

config.putInt(TangoConfig.KEY_INT_DEPTH_MODE, TangoConfig.TANGO_DEPTH_MODE_POINT_CLOUD); 

到設置代碼(setupTangoConfig())。

+0

謝謝你的回答!這似乎是解決方案。我會盡快檢查我的探戈,並接受你的答案,如果它的工作。雖然) –

+0

奇怪的是,Google並沒有找到你提到的答案,即使我從那篇文章中搜索錯誤的確切文本。 –

相關問題