Tango 开发指南 — 运动追踪原理

来源:互联网 发布:网络管理系统 编辑:程序博客网 时间:2024/06/05 06:28

  • 工作原理
    • 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 平面上的运动轨迹,其中图中棱锥代表设备。

虚拟相机:当你综合使用位置和方向数据时,你可以把设备当成一个处于 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.

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.
0 0