本文介绍了TangoService_connectOnFrameAvailable()卡或崩溃使用谷歌的探戈莱布尼茨发行1.10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎有一个问题concering在莱布尼茨1.10版彩帧的接收,以及:当已经使用注册的回调 TangoService_connectOnFrameAvailable(TANGO_CAMERA_COLOR,NULL,onFrameAvailable)回调 onFrameAvailable()要么永远不会被调用或 TangoService_connectOnFrameAvailable()崩溃并出现以下错误:

There seems to be an issue concering the reception of color frames in the Leibniz Release 1.10 as well: when having registered a callback usingTangoService_connectOnFrameAvailable(TANGO_CAMERA_COLOR,NULL,onFrameAvailable) the callback onFrameAvailable() will either never ever be called or TangoService_connectOnFrameAvailable() crashes with the following error:

04-20 13:29:44.384:E / tango_client_api(4712):TangoErrorType  TangoService_connectOnFrameAvailable(TangoCameraId,无效*,无效  ()(无效的,TangoCameraId,常量TangoImageBuffer *)):内部错误:  connectSurface(),凸轮ID 0,内部失败。

发行说明中说

[...] config_enable_color_camera已被添加到配置的标志。我们建议您始终明确将此标志设置为true,如果访问彩色摄像机。您必须设置该标志适用于  TangoService_connectOnFrameAvailable()或  TangoService_connectTextureId()后接替  TangoService_connect()被调用。 [...]

因此​​,如果我设置标志设置为true TangoService_connect的电话() TangoService_connectOnFrameAvailable()之间,回调 onFrameAvailable()永远不会被调用,如果设置了该标志为真之前 TangoService_connect() TangoService_connectOnFrameAvailable()总是崩溃。

Thus, if I set that flag to true between the calls of TangoService_connect() and TangoService_connectOnFrameAvailable(), the callback onFrameAvailable() will never ever be called, if I set that flag to true before TangoService_connect() TangoService_connectOnFrameAvailable() will always crash.

因此​​,我究竟做错了什么?是否有一个code段提供什么?这将是的真正的有益的......遗憾的是,没有一个例子使用的颜色帧...

Thus, what am I doing wrong? Is there a code snippet available or something? That would be really helpful... Unfortunately, none of the examples use color frames...

男人,有过类似的问题,卡尔曼1.9版后,我开始怀疑,如果软件开发工具包的全面测试,被释放摆在首位前...

Man, after having had similar problems with the Kalman Release 1.9, I begin to wonder if the SDKs are thoroughly tested before being released in the first place...

推荐答案

好吧,假设这个问题是不是我在评论部分中提到。这里是code段测试onFrameAvailable回调。

Alright assuming that the problem is not what I mentioned in the comments section. Here is code snippet testing the onFrameAvailable Callback.

注:我已经修改了 HelloTangoJni例从这样做的探戈例子-C库。

Note: I have modified the HelloTangoJni Example from the Tango-examples-c repository for this.

在TangoHandler.h添加

In TangoHandler.h add

 TangoErrorType ConnectYUVFrameCallback();

修改TangoHandler.cc

Modify TangoHandler.cc

TangoErrorType TangoHandler::SetupConfig() {
  // TANGO_CONFIG_DEFAULT is enabling Motion Tracking and disabling Depth
  // Perception.
  tango_config_ = TangoService_getConfig(TANGO_CONFIG_DEFAULT);
  if (tango_config_ == nullptr) {
  return TANGO_ERROR;
  }
  TangoConfig_setBool(tango_config_,"config_enable_color_camera",true);
  return TANGO_SUCCESS;
}


TangoErrorType TangoHandler::ConnectYUVFrameCallback() {
    TangoErrorType onFrameErrorType=TangoService_connectOnFrameAvailable( TANGO_CAMERA_COLOR, NULL, onFrameAvailable);
    if( onFrameErrorType!= TANGO_SUCCESS)
    {
         LOGI("GOOGLE TANGO ONFRAMEAVAILABLE FAILED!");
    }
    LOGI("GOOGLE TANGO ONFRAMEAVAILABLE SUCCESS!");
    return onFrameErrorType;
}

static void onFrameAvailable( void* context, const TangoCameraId id, const TangoImageBuffer* buffer )
{
  int width = buffer->width;
  int height = buffer->height;
  LOGI("width and height is: %d,%d",width,height);
}

在TangoNative.cc添加

In TangoNative.cc add

JNIEXPORT jint JNICALLJava_com_projecttango_experiments_nativehellotango_TangoJNINative_connectOnFrameAvailableCallback(
JNIEnv*, jobject) 
{
    return static_cast<int>(tango_handler.ConnectYUVFrameCallback());
}

在TangoJNINative.java添加

In TangoJNINative.java add

// Connect the onFrameAvailable callback.
public static native int connectOnFrameAvailableCallback();

在HelloTangoActivity.java修改onResume()

In HelloTangoActivity.java modify onResume()

protected void onResume() {
   super.onResume();
   // Setup Tango configuraturation.
   TangoJNINative.setupConfig();
   int status = 0;
   TangoJNINative.connect();
   status = TangoJNINative.connectOnFrameAvailableCallback();
   mIsTangoServiceConnected = true;
}

这篇关于TangoService_connectOnFrameAvailable()卡或崩溃使用谷歌的探戈莱布尼茨发行1.10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 10:08