首页 > 学院 > 开发设计 > 正文

What Are Tango Poses

2019-11-09 14:18:42
字体:
来源:转载
供稿:网友

What Are Tango Poses?

As your device moves through 3D space, it calculates where it is (position) andhow it’s rotated (orientation) up to 100 times per second. A single instance ofthis combined calculation is called the device’spose. The pose is anessential concept when working with motion tracking, area learning, or depthperception.

To calculate the poses, you must choose base and target frames of reference, which may use different coordinate systems. You can view apose as the translation and rotation required to transform vertices from thetarget frame to the base frame.

Here is a simplified version of a Tango pose structin C:

struct PoseData { double orientation[4]; double translation[3]; }

The two key components of a pose are:

A quaternion that defines the rotation of the target frame with respect to the base frame.A 3D vector that defines the translation of the target frame with respect to the base frame.

An actual pose struct contains other fields, such as a timestamp and a copy ofthe frame pair, as you’ll see below. Note: The examples on this page use the C API, but function calls and datastructures are similar for java. In Unity, there are PRefabs which handle a lotof these details for you. Pose data

You can request pose data in two ways: Request Method #1

Poll for poses using TangoService_getPoseAtTime().This returns the pose closest to a given timestamp from the base to the targetframe. Here is the code for this function in the C API:

TangoErrorType TangoService_getPoseAtTime( double timestamp, TangoCoordinateFramePair frame_pair, TangoPoseData* pose);

The TangoCoordinateFramePairstruct specifies the base frame and the target frame. Note: If you are making an augmented reality app, we recommend that you useTangoService_getPoseAtTime() orTangoSupport_getPoseAtTime() because, in addition to polling for poses, they allow you to align the pose timestamps with the video frames.

The following code gets a pose of the device frame with respect to the start-of-service frame:

TangoPoseData pose_start_service_T_device; TangoCoordinateFramePair frame_pair; frame_pair.base = TANGO_COORDINATE_FRAME_START_OF_SERVICE; frame_pair.target = TANGO_COORDINATE_FRAME_DEVICE; TangoService_getPoseAtTime( timestamp, frame_pair, &pose_start_service_T_device);

In this example, including the names of the base and target frames in the posevariable name makes the name more descriptive:

TangoPoseData pose_start_service_T_device;

Request Method #2

Receive pose updates as they become available. To do so,attach an onPoseAvailable() callback toTangoService_connectOnPoseAvailable().This sample is from ourhello_motion_trackingexample project and can be found in thetango_handler.cc file:

TangoCoordinateFramePair pair; pair.base = TANGO_COORDINATE_FRAME_START_OF_SERVICE; pair.target = TANGO_COORDINATE_FRAME_DEVICE; if (TangoService_connectOnPoseAvailable(1, &pair, onPoseAvailable) != TANGO_SUCCESS) { LOGE(“TangoHandler::ConnectTango, connectOnPoseAvailable error.”); std::exit(EXIT_SUCCESS);

In both cases, you receive a TangoPoseData struct:

typedef struct TangoPoseData { int version; double timestamp; // In milliseconds double orientation[4]; // As a quaternion double translation[3]; // In meters TangoPoseStatusType status_code; TangoCoordinateFramePair frame; int confidence; // Currently unused float accuracy; // Currently unused } TangoPoseData;

Pose status

TangoPoseData contains a state, denoted by theTangoPoseStatusTypeenum, which provides information about the status of the pose estimationsystem. The available TangoPoseStatusType members are:

typedef enum { TANGO_POSE_INITIALIZING = 0, TANGO_POSE_VALID, TANGO_POSE_INVALID, TANGO_POSE_UNKNOWN } TangoPoseStatusType;

INITIALIZING: The motion tracking system is either starting or recovering froman invalid state, and the pose data should not be used.

VALID: The system believes the poses being returned are valid and should beused.

INVALID: The system has encountered difficulty of some kind, so poseestimations are likely incorrect.

UNKNOWN: The system is in an unknown state. Lifecycle of pose status Figure 1: Tango Pose data lifecycle

The TANGO_POSE_INITIALIZING status code indicates that the Tangoframework is initializing and pose data is not yet available. If you are usingcallbacks, you will receive only one pose update with the status code set toTANGO_POSE_INITIALIZING while the framework is initializing.

After initialization finishes, poses are in the TANGO_POSE_VALID state. If youare using callbacks, you will receive updates as frequently as they areavailable.

If the system encounters difficulty and enters the TANGO_POSE_INVALID state,recovery depends on your configuration during initialization. Ifconfig_enable_auto_recovery is set toTrue, the system immediately resetsthe motion tracking system and enters theTANGO_POSE_INITIALIZING state. Ifconfig_enable_auto_recovery is set toFalse, pose data remains in theTANGO_POSE_INVALID state and no updates are received until you callTangoService_resetMotionTracking(). Using pose status

Your application should react to the status being returned within the posedata. For example, wait until the pose data you are interested in becomes validbefore starting interactions in your application. If the pose becomes invalid,pause interactions until after the system recovers. Depending on yourapplication, what you do after the system recovers will vary. If you are usingmotion tracking alone, you can simply resume your application. If you are usingarea learning or ADFs, instruct your user to move around until the device canlocalize itself.


上一篇:Okhttp缓存配置

下一篇:什么是Tango姿势

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表