天天看點

Tango 開發指南 — 運動追蹤原理工作原理使用建議常見案例局限以下是原文How it worksUsability tipsCommon use casesLimitationsMore about tracking rotation and accelerationNotes

  • 工作原理
    • Pose
  • 使用建議
  • 常見案例
  • 局限
  • 以下是原文
  • How it works
    • Pose
  • Usability tips
  • Common use cases
  • Limitations
  • More about tracking rotation and acceleration
  • Notes

原文連結:https://developers.google.com/tango/overview/motion-tracking

工作原理

在 Tango 原理篇我們講過,運動追蹤技術能讓裝置了解自身在空間中的運動。本文講解運動追蹤技術的實作,以及在應用中使用該技術的若幹建議。

Pose

Tango 使用六個自由度來表示裝置的位置和方向;位置和方向的集合稱之為 pose。Tango 提供了兩種擷取 pose 資料的方法:回調和傳回給定時間戳對應的 pose 的方法。pose 資料主要包含兩個部分:一個機關為米用于轉換的向量,一個用于旋轉的四元組。pose 資料在指定幀對的前提下才有意義。

使用建議

如果你的應用要将使用者在現實空間的運動轉化到虛拟空間,那麼你應當考慮現實空間需滿足的條件。比如你的應用中有一個長一百米的虛拟城堡,那麼使用者需要再現實空間中走一百米才能從虛拟城堡的一頭走到另外一頭。

還有一個重要的地方是,要讓使用者知道如何在虛拟的 3D 世界中轉向,以免使用者在牆壁、門口或家具附近轉悠時被堵住而無法前進。在應用中有必要給使用者一張地圖來讓其知道哪些區域可以玩,或者提供縮放虛拟空間的功能。

常見案例

更強傳感器:之前使用 Game Rotation Vector 的安卓應用,在使用 Tango 技術後,将獲得更強大的感覺能力。除了陀螺儀和加速感覺儀,Tango 還使用了廣角運動追蹤相機(有時也被稱為魚眼相機)來提供更多的視覺資訊,使得擷取的旋轉和線性加速度資料更加精确。

運動追蹤:Tango 能追蹤裝置在在現實空間中的運動。下面的 demo 應用展示了裝置在 2D 平面上的運動軌迹,其中圖中棱錐代表裝置。

Tango 開發指南 — 運動追蹤原理工作原理使用建議常見案例局限以下是原文How it worksUsability tipsCommon use casesLimitationsMore about tracking rotation and accelerationNotes

虛拟相機:當你綜合使用位置和方向資料時,你可以把裝置當成一個處于 3D 渲染環境(比如遊戲)中的虛拟相機。Tango 為 Unity 3D 遊戲引擎提供了專門的 SDK,也為 OpenGL 和其他 3D 引擎提供了 C/Java SDK。

更多使用 Tango 技術的 AR 應用實踐,請檢視我們的 demo 頁面。

局限

但從擷取裝置位置和方向這一功能上說,運動追蹤技術已經很牛逼了。但是該技術還是有如下局限的:

  • 單靠運動追蹤技術,裝置無法了解周圍的現實環境;
  • 運動追蹤技術沒有“記憶”功能,每次你啟動一次運動追蹤會話,運動追蹤技術就報告目前相對于這次會話的基礎幀的 pose;
  • 長時間和長距離的運動追蹤會産生細小誤差的積累,出現測量值的“漂移”,進而造成巨大的定位誤差。對于某些類型的應用,開發者需要将區域描述“存檔”以備後用——比如,雜貨店應用儲存某個貨架場景以備消費者日後選後物品。“存檔”也需要開發者解決“漂移”問題。所有這些問題,都可以使用下一個核心技術解決——區域學習。

以下是原文

How it works

As described on the Tango Concepts page, Motion Tracking allows a device to understand its motion as it moves through an area. This page describes Tango’s implementation of Motion Tracking and suggests several ways to utilize it in your applications.

Pose

The Tango APIs provide the position and orientation of the user’s device in full six degrees of freedom; this combination of position and orientation is referred to as the device’s pose. The APIs support two ways to get pose data: callbacks to get the most recent pose updates, and functions to get a pose estimate at a specific time. The data is returned with two main parts: a vector in meters for translation and a quaternion for rotation. Poses are specified within specific reference frame pairs, and you must specify a target frame with respect to a base frame of reference when asking for a pose.

Usability tips

For applications that translate a user’s movement in the real world to a virtual one, you will need to be aware of physical space requirements. If your virtual castle is 100 meters long, the user will have to move the same distance in the real world to get from one end of the castle to the other.

Also, it is important that the user understands how the virtual 3D world will be oriented when they start your application so they aren’t blocked from moving around by walls, doors, or furniture. You may want to offer options for visualizing the expected area needed to play or allow users to rescale the virtual space.

Common use cases

Improved rotation sensing: Any application using the Android Game Rotation Vector APIs gains enhanced precision by switching to the Tango API. In addition to the gyroscope and accelerometers, Tango uses the wide-angle motion tracking camera (sometimes referred to as the “fisheye” lens) to add visual information, which helps to estimate rotation and linear acceleration more accurately.

Tracking movement: Tango allows you to track a device’s movement in the real world. The sample app below was created to show a 2D top-down view of the position of the device and its movement on a 2D grid with the motion tracking camera view shown as a viewing frustum.

Tango 開發指南 — 運動追蹤原理工作原理使用建議常見案例局限以下是原文How it worksUsability tipsCommon use casesLimitationsMore about tracking rotation and accelerationNotes

Virtual camera: When you combine rotation and position tracking, you can use the device as a virtual camera in a 3D rendered environment such as a game. Tango provides an SDK for the Unity 3D game engine and supports OpenGL and other 3D engines through C or Java.

To see some examples of virtual reality in action using Tango, see our demos page.

Limitations

Motion Tracking is great by itself if you need to know a device’s orientation and relative position, but it does have limitations:

  • It does not give the device the ability to understand the actual area around it.
  • It does not “remember” previous sessions. Every time you start a new Motion Tracking session, the tracking starts over and reports its position relative to its most recent starting position.
  • Over long distances and periods of time the accumulation of small errors can cause measurements to “drift,” leading to larger errors in absolute position.

    For certain types of apps, you will need the ability to save descriptions of a space to reference later—for example, a retail store app where customers can call up a saved area and then shop for products within it. You will also need to correct the “drift” problem. Both of these issues are addressed by the next core technology, Area Learning.

More about tracking rotation and acceleration

Tango implements Motion Tracking using visual-inertial odometry, or VIO, to estimate where a device is relative to where it started.

Standard visual odometry uses camera images to determine a change in position by looking at the relative position of different features in those images. For example, if you took a photo of a building from far away and then took another photo from closer up, it would be possible to calculate the distance the camera moved based on the change in size and position of the building in the photos.

Visual-inertial odometry supplements visual odometry with inertial motion sensors capable of tracking a device’s rotation and acceleration. This allows a Tango device to estimate both its orientation and movement within a 3D space with even greater accuracy. Unlike GPS, Motion Tracking using VIO works indoors.

Notes

To learn about making 3D representations of the actual geometry surrounding the user, go to the Depth Perception page.

  • Tango does not provide a global position or use GPS to find its location. It tracks its relative position within an area using its built-in sensors. If you want to estimate the geographic location of the user, use the Android Location API.
  • Tango and Android are not hard real-time systems. This is largely because the Android Linux Kernel cannot provide strong guarantees on the execution time of the software running on the device. As a result, Project Tango is considered a soft real-time system. All data from Tango includes timestamps from a single clock with single-microsecond accuracy, relative to when the device booted, to allow you to reconcile readings from multiple sensors or data types.
  • The process of learning an area while keeping track of a user’s current position within it is known as Simultaneous Localization and Mapping, or SLAM.