What Are Tango Poses? 什么是Tango姿勢(shì)?
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.
當(dāng)您的設(shè)備移動(dòng)通過(guò)3D空間時(shí),它計(jì)算它的位置(位置)及其旋轉(zhuǎn)(方向)高達(dá)每秒100次。此組合計(jì)算的單個(gè)實(shí)例稱為設(shè)備的姿勢(shì)。當(dāng)使用運(yùn)動(dòng)跟蹤,區(qū)域?qū)W習(xí)或深度感知時(shí),姿勢(shì)是一個(gè)基本概念。
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.
要計(jì)算姿勢(shì),您必須選擇基準(zhǔn)和目標(biāo)參考系,這可能使用不同的坐標(biāo)系。您可以將姿勢(shì)視為將頂點(diǎn)從目標(biāo)幀轉(zhuǎn)換為基本幀所需的平移和旋轉(zhuǎn)。
Here is a simplified version of a Tango pose structin C:
這里是一個(gè)簡(jiǎn)化版本的探戈姿勢(shì)結(jié)構(gòu)在C:
struct PoseData { double orientation[4]; double translation[3]; }
The two key components of a pose are:
姿勢(shì)的兩個(gè)關(guān)鍵組成部分是:
A quaternion that defines the rotation of the target frame with respect to the base frame. 定義目標(biāo)幀相對(duì)于基本幀的旋轉(zhuǎn)的四元數(shù)。A 3D vector that defines the translation of the target frame with respect to the base frame. 定義目標(biāo)幀相對(duì)于基本幀的平移的3D向量。An actual pose struct contains other fields, such as a timestamp and a copy ofthe frame pair, as you’ll see below.
實(shí)際的姿態(tài)結(jié)構(gòu)包含其他字段,如時(shí)間戳和幀對(duì)的副本,如下所示。
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. 注意:此頁(yè)面上的示例使用C API,但對(duì)于Java,函數(shù)調(diào)用和數(shù)據(jù)結(jié)構(gòu)類似。在Unity中,有預(yù)處理為你處理很多這些細(xì)節(jié)。 Pose data 姿勢(shì)數(shù)據(jù)
You can request pose data in two ways: 您可以通過(guò)兩種方式請(qǐng)求姿勢(shì)數(shù)據(jù): Request Method #1 請(qǐng)求方法#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:
使用TangoService_getPoseAtTime()調(diào)查姿勢(shì)。這將返回最接近給定時(shí)間戳的從基址到目標(biāo)幀的姿態(tài)。這里是C API中此函數(shù)的代碼:
TangoErrorType TangoService_getPoseAtTime( double timestamp, TangoCoordinateFramePair frame_pair, TangoPoseData* pose);
The TangoCoordinateFramePairstruct specifies the base frame and the target frame.
TangoCoordinateFramePair結(jié)構(gòu)指定基本幀和目標(biāo)幀。
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.
注意:如果您正在制作增強(qiáng)現(xiàn)實(shí)應(yīng)用程序,我們建議您使用TangoService_getPoseAtTime()或TangoSupport_getPoseAtTime(),因?yàn)槌溯喸冏藙?shì),他們?cè)试S您將姿勢(shì)時(shí)間戳與視頻幀對(duì)齊。
The following code gets a pose of the device frame with respect to the start-of-service frame:
以下代碼獲取設(shè)備幀相對(duì)于服務(wù)啟動(dòng)幀的姿態(tài):
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: 在此示例中,在姿勢(shì)變量名稱中包括基準(zhǔn)和目標(biāo)框架的名稱使名稱更具描述性:
TangoPoseData pose_start_service_T_device;
Request Method #2 請(qǐng)求方法#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:
接收姿勢(shì)更新,因?yàn)樗鼈冏兊每捎?。為此,?qǐng)將onPoseAvailable()回調(diào)附加到TangoService_connectOnPoseAvailable()。這個(gè)示例來(lái)自我們的hello_motion_tracking示例項(xiàng)目,可以在tango_handler.cc文件中找到:
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:
在這兩種情況下,您都會(huì)收到一個(gè)TangoPoseData結(jié)構(gòu):
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 姿勢(shì)狀態(tài)
TangoPoseData contains a state, denoted by theTangoPoseStatusTypeenum, which provides information about the status of the pose estimationsystem. The available TangoPoseStatusType members are:
TangoPoseData包含由TangoPoseStatusType枚舉指示的狀態(tài),其提供關(guān)于姿態(tài)估計(jì)系統(tǒng)的狀態(tài)的信息。可用的TangoPoseStatusType成員是:
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.
INITIALIZING:運(yùn)動(dòng)跟蹤系統(tǒng)正在啟動(dòng)或從無(wú)效狀態(tài)恢復(fù),并且不應(yīng)使用姿態(tài)數(shù)據(jù)。 VALID:系統(tǒng)認(rèn)為返回的姿勢(shì)有效,應(yīng)該使用。 INVALID:系統(tǒng)遇到某種困難,因此姿態(tài)估計(jì)可能不正確。 UNKNOWN:系統(tǒng)處于未知狀態(tài)。
Lifecycle of pose status 姿勢(shì)狀態(tài)的生命周期 Figure 1: Tango Pose data lifecycle 圖1:探戈姿勢(shì)數(shù)據(jù)生命周期
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.
TANGO_POSE_INITIALIZING狀態(tài)代碼表示Tango框架正在初始化,并且姿勢(shì)數(shù)據(jù)尚不可用。如果您使用回調(diào),則在框架正在初始化時(shí),您將只收到一個(gè)狀態(tài)代碼設(shè)置為TANGO_POSE_INITIALIZING的姿勢(shì)更新。
After initialization finishes, poses are in the TANGO_POSE_VALID state. If youare using callbacks, you will receive updates as frequently as they areavailable.
初始化完成后,姿勢(shì)處于TANGO_POSE_VALID狀態(tài)。如果您正在使用回調(diào),您將收到更新的頻率,因?yàn)樗麄兛捎谩?/p>
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().
如果系統(tǒng)遇到困難并進(jìn)入TANGO_POSE_INVALID狀態(tài),則恢復(fù)取決于初始化期間的配置。如果config_enable_auto_recovery設(shè)置為True,系統(tǒng)將立即重置運(yùn)動(dòng)跟蹤系統(tǒng)并進(jìn)入TANGO_POSE_INITIALIZING狀態(tài)。如果config_enable_auto_recovery設(shè)置為False,則姿勢(shì)數(shù)據(jù)保持在TANGO_POSE_INVALID狀態(tài),并且在調(diào)用TangoService_resetMotionTracking()之前不會(huì)接收更新。
Using pose status 使用姿勢(shì)狀態(tài)
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. 您的應(yīng)用程序應(yīng)對(duì)姿勢(shì)數(shù)據(jù)中返回的狀態(tài)做出反應(yīng)。例如,等到您感興趣的姿勢(shì)數(shù)據(jù)在您的應(yīng)用程序中開(kāi)始交互之前變得有效。如果姿勢(shì)無(wú)效,請(qǐng)暫停交互,直到系統(tǒng)恢復(fù)。根據(jù)您的應(yīng)用程序,您在系統(tǒng)恢復(fù)后執(zhí)行的操作將有所不同。如果您僅使用運(yùn)動(dòng)跟蹤,則可以簡(jiǎn)單地恢復(fù)應(yīng)用程序。如果您使用區(qū)域?qū)W習(xí)或ADF,請(qǐng)指導(dǎo)您的用戶移動(dòng),直到設(shè)備可以本地化。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注