googlearchive / tango-examples-c

JNI example projects for Project Tango [deprecated] C-API
https://developers.google.com/ar
Apache License 2.0
337 stars 204 forks source link

Bad flags in cpp_mesh_builder_example #91

Open Sabotaz opened 7 years ago

Sabotaz commented 7 years ago

Hello, Trying to use the cpp_mesh_builder_example app, I see that when the function TangoSupport_getMatrixTransformAtTime is used, the status code used is TANGO_SUCCESS.

It should be status_code == TANGO_POSE_VALID, as described in the doc : https://developers.google.com/tango/apis/c/support/reference/struct/tango-matrix-transform-data.

In file mesh_builder_app.cc:

  TangoMatrixTransformData matrix_transform;
  TangoSupport_getMatrixTransformAtTime(
      0, TANGO_COORDINATE_FRAME_START_OF_SERVICE, TANGO_COORDINATE_FRAME_DEVICE,
      TANGO_SUPPORT_ENGINE_OPENGL, TANGO_SUPPORT_ENGINE_OPENGL, ROTATION_0,
      &matrix_transform);
  if (matrix_transform.status_code == TANGO_SUCCESS) {
    start_service_T_device_ = glm::make_mat4(matrix_transform.matrix);
  } else {
    LOGE(
        "MeshBuilderApp: Could not find a valid matrix transform at "
        "current time for the device.");
  }

The data structure TangoMatrixTransformData is using a TangoPoseStatusType and not a TangoErrorType, as show in files (beside in doc) : In file tango_support_api.h:

typedef struct TangoMatrixTransformData {
  /// Timestamp of the time that this pose estimate corresponds to.
  double timestamp;

  /// Matrix in column major order.
  float matrix[16];

  /// The status of the pose, according to the pose lifecycle.
  TangoPoseStatusType status_code;
} TangoMatrixTransformData;

In file tango_client_api.h:

typedef enum {
  TANGO_POSE_INITIALIZING = 0,  ///< Motion estimation is being initialized
  TANGO_POSE_VALID,             ///< The pose of this estimate is valid
  TANGO_POSE_INVALID,           ///< The pose of this estimate is not valid
  TANGO_POSE_UNKNOWN            ///< Could not estimate pose at this time
} TangoPoseStatusType;

Thank you !