zoukankan      html  css  js  c++  java
  • What Are Tango Poses?Tango姿态是什么?

     What Are Tango Poses?什么是Tango姿态?

    As your device moves through 3D space, it calculates where it is (position) and how it's rotated (orientation) up to 100 times per second. A single instance of this combined calculation is called the device's pose. The pose is an essential concept when working with motion tracking, area learning, or depth perception.

    当你的设备通过3D空间时,它计算它在哪里(位置)以及它是如何旋转的(方向)。这达到每秒100次。一个单个的这种复合计算的实例称为设备的姿态。

    To calculate the poses, you must choose base and target frames of reference , which may use different coordinate systems. You can view a pose as the translation and rotation required to transform vertices from the target frame to the base frame.为了计算位姿,你必须选择基础和目标参考框架,这可能会使用不同的坐标系统。

    Here is a simplified version of a Tango pose struct in C:

    这里是一个C语言简洁版的Tango姿态结构体:

     
    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 of the frame pair, as you'll see below.一个真正的姿态结构体包含其他域名,比如时间戳以及框架对的复件,正如下面看到的。

    Note: The examples on this page use the C API, but function calls and data structures are similar for Java. In Unity, there are prefabs which handle a lot of these details for you.
    注意:本例的例子使用的是C API,但是函数调用和数据结构对Java来说是相似的。在Unity中,有预设件为你处理这些细节。

    Pose data姿态数据

    You can request pose data in two ways: 你可以以两种方式请求姿态数据:

    Request Method #1 请求方法 #1

    Poll for poses using TangoService_getPoseAtTime(). This returns the pose closest to a given timestamp from the base to the target frame. Here is the code for this function in the C API:使用TangoService_getPoseAtTime()方法请求姿态。它返回从基础框架到目标框架最靠近给定时间戳的姿态。

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

    The TangoCoordinateFramePair struct specifies the base frame and the target frame.TangoCoordinateFramePair结构体指定了基础框架和目标框架。

    Note: If you are making an augmented reality app, we recommend that you use TangoService_getPoseAtTime() or TangoSupport_getPoseAtTime() because, in addition to polling for poses, they allow you to align the pose timestamps with the video frames.
    注意:如果你是在制作增强现实应用,我们建议你使用TangoService_getPoseAtTime()或TangoSupport_getPoseAtTime(),因为除了可以获取位姿,它们还允许你将位姿的时间戳和视频帧对齐。

    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 pose variable name makes the name more descriptive:

    在该例子中,由于包含了基础和目标框架的名字,所以位姿变量名更具有描述性:

     
    TangoPoseData pose_start_service_T_device;

    Request Method #2 请求方法 #2

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

    如果位姿更新可用便接受它。为了这么做,添加onPoseAvailable()反馈到TangoService_connectOnPoseAvailable()中。该样例是来自我们的hello_motion_tracking样例项目中,可以在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:

    在两种情况下,你都接收一个TangoPoseData结构体:

     
    typedef struct TangoPoseData {
      int version;
      double timestamp;                // In seconds
      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 the TangoPoseStatusType enum, which provides information about the status of the pose estimation system. The available TangoPoseStatusType members are: TangoPoseData包括一个状态,是由TangoPoseStatusType枚举型贡献的,它提供了关于姿态估计系统的状态的信息。可用的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 from an invalid state, and the pose data should not be used.

    INITIALIZING:运动追踪系统要么是启动中,要么是从一个无效的状态中恢复,该姿态数据不可用。

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

    VALID:系统相信返回的姿态是合理的,可用的。

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

    INVALID:系统经历了某些困难,所以姿态预测值很可能是不对的。

    UNKNOWN: The system is in an unknown state.

    UNKOWN:系统是处于位姿未知状态。

    Lifecycle of pose status位姿状态的声明周期

                                                                        Figure 1: Tango Pose data lifecycle
                                                                        图1:Tango位姿数据生命周期

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

    TANGO_POSE_INITIALIZING状态码表示Tango框架正在初始化,而姿态数据还不可用。如果你正在使用反馈机制,你会在当框架初始化时只接收到一个带有一个TANGO_POSE_INITIALIZING的姿态更新。

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

    初始化结束后,姿态是TANGO_POSE_VALID状态。如果你使用反馈机制,你将在它们姿态可用时接收更新。

    If the system encounters difficulty and enters the TANGO_POSE_INVALID state, recovery depends on your configuration during initialization. If config_enable_auto_recovery is set to True, the system immediately resets the motion tracking system and enters the TANGO_POSE_INITIALIZING state. Ifconfig_enable_auto_recovery is set to False, pose data remains in the TANGO_POSE_INVALID state and no updates are received until you call TangoService_resetMotionTracking().

    如果系统遇到困难遇到TANGO_POSE_INVALID状态,恢复依赖于你在初始化时的配置信息。如果config_enable_auto_recovery设置为真,系统将会迅速重置运动追踪系统,进入TANGO_POSE_INITIALIZING状态。如果config_enable_auto_recovery设为否,姿态数据保持在TANGO_POSE_INVALID状态,不接收更新直到你调用TangoService_resetMotionTracking()函数。

    Using pose status 使用位姿状态

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

    你的应用应该对位姿数据中返回的状态做出反应。举例来说,在开始你的应用交互之前等待直到你感兴趣的姿态数据变得有效为止。如果姿态无效了,中止交互直到你的系统恢复之后。取决于你的应用,系统恢复之后你做什么是不同的。如果你只是在使用运动追踪,那么你只是简单继续你的应用。如果你在使用区域学习或者ADF文件,那么引导你的用户四处转转直到你的设备能够定位。

  • 相关阅读:
    cat more less 命令
    nano 命令 linux
    关于socket的知识总结
    linux进程的挂起和恢复
    find & grep 命令 in linux(转)
    ssh 免密登录
    ssh远程服务器
    c# 可以设置透明度的 Panel 组件
    Qt编写地图综合应用14-离线地图下载
    Qt编写地图综合应用13-获取边界点
  • 原文地址:https://www.cnblogs.com/2008nmj/p/7190064.html
Copyright © 2011-2022 走看看