Frames of Reference参考框架

Frames of Reference参考框架

When describing the position and orientation of something (for example, your Tango device), it is important to indicate the frame of reference you are using to base your description on.当描述某些东西(例如Tango设备)的位置和方向,表明你正在使用的参考框架从而将你的描述标在上面是很重要的。

To help understand frames of reference, consider the following: Saying "Mary is standing three feet away" does not really tell you much. If you want to know Mary's position, you must also address the question "three feet from what?" If you say "Mary is standing three feet in front of the entrance to the Statue of Liberty," you can now establish Mary's position because you are using the Statue of Liberty as your frame of reference and you can measure the distance and directon of Mary relative to the Statue.

要帮助理解参考框架,考虑以下问题:这句话“玛丽站在三英尺远的地方”并没有告诉你太多信息。如果你想知道玛丽的位置,你还必须问下面的问题“离什么地方三英尺?”如果你说“玛丽站在自由女神像入口前三英尺的地方”,你现在能确立玛丽的位置,因为你正在使用自由女神像作为你的参考框架,然后你能测量出玛丽相对于雕像的距离和方向。

But Mary isn't simply a point with a position in 3D space—she also has an orientation, which is described in terms of some type of rotation relative to the frame of reference. In other words, Mary, like all 3D objects, faces a certain direction. A full description of Mary's position and orientation (we call this combination a pose) in 3D space would be something like this: "Mary is standing three feet in front of the entrance to the Statue of Liberty, and she is directly facing it." Now you have provided information about her orientation. If Mary turned to her right, you could say "She is now rotated 90 degrees away from the Statue." This would be another description of orientation.

但是玛丽不仅仅是三维空间位置中的一个点——她也有一个方向,用某种相对于参考帧的旋转类型的术语描述。用其他话说,玛丽,就像所有的3D物体一样,面向某个方向。一个关于玛丽的在三维空间中的位置和朝向(总称为位姿)的完整描述将会是像这样:“玛丽站在离自由女神雕像入口处前面三英尺的位置,她脸正朝向它”。现在你已经提供了关于她的朝向的足够的信息。如果玛丽向她的右方转,你会说“她现在离雕像旋转90度了”。这将是对于方向的另一种描述。

So how does all of this relate to a Tango device? In order to perform motion tracking, a device reports its pose (position and orientation) relative to its chosen frame of reference, which is fixed in 3D space. For example, the device might say "from the place that I first started motion tracking, I am now three feet forward and one foot up, and I have rotated 30 degrees to the right." By doing this, the device has told you its position using meaningful directions: three feet forward and one foot up from its original starting position. It has also told you about a change in its orientation: rotated 30 degrees to the right relative to its starting position.

所以这对于Tango设备来说是怎样的呢?为了实现运动追踪,设备将汇报它相对于选定的参考框架的位姿(位置和方向),参考框架是在三维空间中固定的。例如,设备可能说“从我开始运动追踪的地方来说,我现在向前三英尺向上一英尺,我向右旋转30度”。通过这样做,设备将告诉你它有意义方向的位置:向前三英尺,向上一英尺。它还告诉你它的方向的改变:相对于起始位置向右旋转30度。

To set things up for motion tracking, you must do the following:要设置运动追踪的事情,你必须做以下这些事情:

  1. Choose a base frame. This is the thing you will be measuring from. As mentioned above, it is fixed in 3D space, like the Statue of Liberty in our example above. Example: theCOORDINATE_FRAME_START_OF_SERVICE frame. 选择一个基础框架。这是你需要开始参考的东西。如上面提到的,它是固定在三维空间的,如上面提到的自由女神像。示例:COORDINATE_FRAME_START_OF_SERVICE服务的开始坐标框架。

  2. Choose a target frame. This is the thing you will be measuring to. For motion tracking this is usually COORDINATE_FRAME_DEVICE and represents your device's pose at any given instant as it moves through 3D space. The pose of the target frame changes as your device moves, and is measured against the base frame (which never changes), up to 100 times per second. This constant stream of measurements creates your motion track.选择一个目标框架。这是要测量到的对象。对于运动追踪来说这总是COORDINATE_FRAME_DEVICE设备坐标框架,并且代表你在穿越3D空间时你的设备的位姿。目标帧的位姿随着你的设备的移动而改变,并且相对于你的基础帧(它从不改变)而观测的,达到每秒100次。这种连续的观测流构造出了你的运动追踪。

The numerical measurements of the pose of the target frame relative to the base frame at any given instant answer the question: "What is the device's position and orientation relative to its base frame of reference?"这种相对于基础帧的目标帧位姿的数值观测回答了这样的一个问题:“相对于基础参考框架设备的位置和方向是多少?”。

In the next section, we discuss the use of start-of-service frame, area description frame, and device pose frame pairs for motion tracking. For certain applications, you may need to choose a frame pair that will enable you to make precise alignments of data sources from device components. We discuss these types of frame pairs later in this topic.在下一节,我们将讨论用于运动追踪的start-of-service(开始服务)框架、area description(区域描述)框架和device pose(设备姿态)框架的使用。对于某些应用来说,你可能需要选择一个能让你完成设备组件的数据源精确校正的帧对。我将在本话题的后面讨论这些类型的帧对。

To learn more about the coordinate systems used for frames of reference, see Coordinate System Conventions.要学习更多关于用于参考框架的坐标系统的知识,请看坐标系统协议

Coordinate frames for motion tracking运动追踪的坐标框架

The Tango APIs give you various frame pair options for motion tracking:Tango API给你运动追踪的多样的帧对选项:

Target Frame目标框架Base Frame基础框架
COORDINATE_FRAME_DEVICE坐标_框架_设备 COORDINATE_FRAME_START_OF_SERVICE坐标_帧_开始_服务
COORDINATE_FRAME_DEVICE坐标_框架_设备 COORDINATE_FRAME_AREA_DESCRIPTION坐标_帧_区域_描述
COORDINATE_FRAME_START_OF_SERVICE坐标_框架_开始_服务 COORDINATE_FRAME_AREA_DESCRIPTION坐标_帧_区域_描述

Let's consider a common use case:让我们考虑一个常用的案例:

Goal: Your app controls a camera in a fully virtual environment. You want the device to always calculate its pose relative to where it was when the Tango service started.

目标:你的应用控制一个在完全虚拟的环境中的摄像头。你想让设备经常计算它相对于Tango开始服务的当前位姿。

Solution: For the target frame, choose COORDINATE_FRAME_DEVICE. For the base frame, choose COORDINATE_FRAME_START_OF_SERVICE.

方案:对于目标帧,我们选择COORDINATE_FRAME_DEVICE设备坐标框架。对于基础帧,我们选择COORDINATE_FRAME_START_OF_SERVICE服务开始坐标框架。

Here is the frame pair used in our example project titled cpp_hello_motion_tracking_example:

这里是一个我们的样例项目cpp_hello_motion_tracking_example中的帧对:

 
 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::OnResume, connectOnPoseAvailable error.");
     std::exit(EXIT_SUCCESS);
   }

Let's look at the details of individual frame pairs. 让我们看一下单个帧对的细节。


Target Frame目标框架Base Frame基础框架
COORDINATE_FRAME_DEVICE坐标_框架_设备 COORDINATE_FRAME_START_OF_SERVICE坐标_框架_开始_服务

This frame pair provides the pose of the device relative to when the Tango service first initialized successfully. This mode accumulates the movement of the device over time since the service started. The service can also detect if there is a motion tracking failure. During this period, the system reports an invalid pose. If TangoService_resetMotionTracking() is called or auto-reset is enabled in the service configuration, the system attempts to re-initialize tracking. After successful re-initialization, it makes a best effort attempt to recover the last known good pose of the device relative to the start of service frame and pick up where it left off. For more information, see Lifecycle of pose status. This frame pair does not include drift correction or localization. If your application does not use drift correction or localization, you can lower processing requirements by disabling area learning mode and not loading an ADF.

该帧对提供了设备相对于Tango服务成功启动时的姿态。该模式积累了设备随时间的移动。该服务还可以检测是否这一次运动追踪失败了。在这一过程中,系统报告无效位姿。如果TangoService_resetMotionTracking()调用或者服务配置中开启了auto-reset,那么系统将会重初始化追踪。在成功重初始化之后,它将尽可能恢复最后已知的设备好的位姿,拾起丢失的位置。对于更多信息,查看位姿状态的生命周期。帧对不包含漂移修正或者定位。如果你的应用不使用漂移修正或者定位,你可以通过禁止区域学习和不加载ADF来降低处理需求。


Target Frame目标框架Base Frame基础框架
COORDINATE_FRAME_DEVICE坐标_框架_设备 COORDINATE_FRAME_AREA_DESCRIPTION坐标_框架_区域_描述

This frame pair provides the pose of the device, including corrections, relative to the loaded area description's origin. It requires that area learning mode is turned on or a previously created ADF is loaded. If you turn on learning mode without loading an ADF, the origin of the area description base frame is initially the same as start of service. If you load an ADF with or without learning mode, the origin of the area description base frame is the origin stored in the ADF, and you will receive data only after the device has localized. Depending on your configuration settings, this mode is not always available. For more information, see Using Learning Mode and loaded Area Description Files. If you need to use motion tracking before the COORDINATE_FRAME_DEVICE toCOORDINATE_FRAME_AREA_DESCRIPTION frame pair becomes valid, you can use theCOORDINATE_FRAME_START_OF_SERVICE base frame in the interim.

该框架对提供设备的位姿,并且包括校正,该校正是相对于加载区域描述的起点。它要求区域学习模式打开或者加载一个提前创建的ADF(Area Description File)。如果你开启学习模式但没有加载ADF,area description(区域描述)基础框架的原点是与start of service相同的。但如果你加载了一个ADF,无论带有或者不带有学习模式的,area description区域描述基础帧的原点就是存储在ADF中的原始点,你只有在设备进行定位之后接收数据。取决于你的配置设置信息,这个模式并不总是可用的。对于更多信息,请看使用学习模式以及加载区域描述文件。如果你需要在COORDINATE_FRAME_DEVICE到COORDINATE_FRAME_AREA_DESCRIPTION的框架对变得有效之前使用运动追踪,你可以与此同时使用COORDINATE_FRAME_START_OF_SERVICE基础帧。

Note: Drift corrections and localization events cause jumps in the pose. To avoid these jumps, use the COORDINATE_FRAME_START_OF_SERVICE base frame to drive the user-facing elements in your application and incorporate the ADF driven corrections using COORDINATE_FRAME_START_OF_SERVICE toCOORDINATE_FRAME_AREA_DESCRIPTION update callbacks.
注意:漂移校正和定位事件引起位姿跳变。为了避免这些跳变,使用COORDINATE_FRAME_START_OF_SERVICE基础帧来驱动你的应用中面向用户的要素,并且使用COORDINATE_FRAME_START_OF_SERVICE到COORDINATE_FRAME_AREA_DESCRIPTION的更新反馈来吸收ADF驱动的校正。

For pairs using the COORDINATE_FRAME_DEVICE target frame, updates are available at the pose estimation rate supported by the device.

对于使用COORDINATE_FRAME_DEVICE目标帧的帧对,更新是在以设备可支持的姿态估计频率下可用的。


Target Frame目标帧Base Frame基础帧
COORDINATE_FRAME_START_OF_SERVICE坐标_帧_开始_服务 COORDINATE_FRAME_AREA_DESCRIPTION坐标_帧_区域_描述

This frame pair provides updates only when a localization event or a drift correction occurs. This requires that area learning mode is turned on or a previously created ADF is loaded. If an ADF is loaded, the origin of the area description base frame is the origin stored in the ADF. This isolates the adjustments to the pose of the device from the incremental frame-to-frame motion, allowing you to decide when and how to incorporate the pose adjustments in your application to minimize disruption to the user experience.

该帧对只有在当一个定位事件或者一个漂移校正发生时提供更新。这需要区域学习模式开启,或者一个之前创建的ADF加载。如果ADF已加载,area description基础帧原点就是ADF中存储的原点。这将设备位姿从渐进的帧到帧的运动中孤立,允许你决定何时以及怎么吸收你的应用的位姿校正来最小化用户体验的破坏。

Coordinate frames for component alignment组件对齐的坐标框架

Target Frame目标框架Base Frame目标框架
COORDINATE_FRAME_DEVICE坐标_框架_设备 COORDINATE_FRAME_IMU坐标_框架_惯性
COORDINATE_FRAME_CAMERA_COLOR坐标_框架_相机_颜色 COORDINATE_FRAME_IMU坐标_框架_惯性
COORDINATE_FRAME_CAMERA_DEPTH坐标_框架_相机_深度 COORDINATE_FRAME_IMU坐标_框架_惯性
COORDINATE_FRAME_CAMERA_FISHEYE坐标_框架_相机_鱼眼 COORDINATE_FRAME_IMU坐标_框架_惯性

Some applications need to align multiple data sources, such as the data from the color and depth cameras. You can pair the COORDINATE_FRAME_IMU base frame with one of the component target frames for these scenarios:某些应用需要对齐多个数据源,例如颜色和深度摄像头中的数据。你可以将COORDINATE_FRAME_IMU基础框架跟组件目标框架中的一个组成框架对,在如下场景:

  1. You want to query the relative offsets of the individual components to the IMU frame of reference without knowing the layout of the specific device.你想要查询单个组件相对IMU参考框架的相对偏移,而不需要知道特定设备的布局。

  2. You want the virtual image from the rendering camera to align with the center of the display.你想要渲染相机的虚拟影像与显示中心对齐。

Combined with the motion tracking coordinate frames and timestamps on the data, these offsets give you a more complete understanding of the various sensor inputs in both space and time. This is necessary for aligning and compositing multiple data sources together.

跟数据里的运动追踪坐标框架和时间戳相结合,这些偏移给你一个对不同传感器输入数据在空间和时间上更完整的理解。这对于对齐和组合不同数据源的数据来说也是必要的。

Note: The relative offsets between two components are sometimes referred to as the extrinsic parameters.
注意:两个组件间的相对偏移有时候指的是外部参数

Since devices are designed to be mechanically rigid, these offsets are not expected to change and updates will not occur in the API. However, devices vary in how their components are spaced. Updating extrinsic parameters over time is not currently supported by the Tango APIs. These values are generated either from a one-time factory calibration or from the manufacturer's mechanical design files. Applications that require extremely tight requirements for the extrinsic parameters should consider implementing their own calibration procedure which can be performed by the end user.

由于设备被设计成机械上刚性的,这些偏移量不会改变,在API中也不会更新。但是,组件的位置放置不同那么设备是有不同的。随着时间更新外部参数目前在Tango API中是不支持的。这些数值要么是从一次工厂校正中获知的,要么是从人工设计文件中得知的。对外部参数有需要极度严格要求的应用应该考虑让用户使用他们自己的校正程序。

The COORDINATE_FRAME_IMU base frame provides a common reference point for all of the internal components in the device. The origin of this base frame does not necessarily correspond to any one particular component and may differ between devices. Like other Android sensors, the axis of the device coordinate frame is aligned with the natural (default) orientation of the device as defined by the manufacturer. The manufacturer-defined natural orientation of the device may not match the desired orientation of your app. For maximum future compatibility, do not assume a Tango-compliant device has a natural orientation that is either landscape or portrait. Instead, use the Android getRotation() method to determine screen rotation, and then use the Android remapCoordinateSystem() method to map sensor coordinates to screen coordinates. For more general information about sensors, see the Android documentation on the sensor coordinate system. For a more detailed discussion of issues surrounding device orientation, see this Android Developers Blog post.

COORDINATE_FRAME_IMU基础帧为设备中的内部组件提供了一个常用的参考点。该基础框架的原点并不需要符合任何一个特定的组件或者可能在不同设备之间存在不同。像其他的Android传感器一样,设备坐标轴的中心轴线与制造商定义的自然(默认)方向一致。制造商定义的设备自然方向可能与应用程序的期望方向不一致。为了达到未来的最大兼容性,不要假设Tango设备有风景或者肖像的自然方向。相反,使用Android的getRotation()方法确定屏幕旋转方向,然后使用Android的remapCoordinateSystem()方法来将传感器坐标映射到屏幕坐标。对于传感器的更多一般信息,看传感器坐标系统中的Android文档。对于围绕设备方向问题的更多详细讨论,请看Android开发者博客页

The component offsets are static and should only need to be queried once.

组件偏移量是静态的,应该只需要查询一次。

Note: The unit of measurement for coordinate frame pairs is meters.
原文地址:https://www.cnblogs.com/2008nmj/p/7190576.html