美文网首页
Google Tango Project-Java API Mo

Google Tango Project-Java API Mo

作者: 60916fc63567 | 来源:发表于2016-12-12 15:55 被阅读58次

    Java API Motion Tracking Tutorial

    java api 轨迹移动教程

    This page describes how the Java API handles motion tracking.

    这页描述了如何使用Java API处理轨迹移动

    Lifecycle 生命周期

    The normal motion tracking system lifecycle consists of three states: TangoPoseData.POSE_INITIALIZING, TangoPoseData.POSE_VALID, and TangoPoseData.POSE_INVALID. In the POSE_INITIALIZING state, the system is not yet ready and pose data is not available. In the POSE_VALID state, the system is functioning normally. In the POSE_INVALID state, the system believes its estimate was invalid and needs to be reinitialized. A fourth state, POSE_UNKNOWN, is used for all other cases.

    Should the pose data become POSE_INVALID, the motion tracking system can be reinitialized in two ways. If config_enable_auto_recovery was set to true, the system will immediately enter the POSE_INITIALIZING state. It will use the last valid pose as the starting point after recovery. If TangoConfig.KEY_BOOLEAN_AUTORECOVERY was set to false, the system will essentially pause and always return poses as POSE_INVALID until Tango.resetMotionTracking() is called. Unlike auto recovery, this will also reset the starting point after recovery back to the origin.

    The lifecycle state is recorded in the TangoPoseData object's statusCode.

    For more information, although the page is based around the C API, please see our Device Pose concepts page.

    正常的运动跟踪系统生命周期包括三个状态:TangoPoseData.POSE_INITIALIZING,TangoPoseData.POSE_VALID和TangoPoseData.POSE_INVALID。在POSE_INITIALIZING状态下,系统尚未准备就绪,姿势数据不可用。在POSE_VALID状态下,系统正常工作。在POSE_INVALID状态下,系统认为其估计值无效,需要重新初始化。第四个状态POSE_UNKNOWN用于所有其他情况。

    如果姿势数据变为POSE_INVALID,则运动跟踪系统可以以两种方式重新初始化。如果config_enable_auto_recovery设置为true,系统将立即进入POSE_INITIALIZING状态。它将使用最后有效的姿势作为恢复后的起点。如果TangoConfig.KEY_BOOLEAN_AUTORECOVERY设置为false,系统将基本上暂停,并始终将姿势作为POSE_INVALID返回,直到调用Tango.resetMotionTracking()。与自动恢复不同,这也将在恢复回原点后重置起点。

    生命周期状态记录在TangoPoseData对象的statusCode中。

    有关详细信息,尽管该页面基于C API,请参阅我们的设备构思概念页面。

    Configuration配置


    In order to use motion tracking, yourTangoConfigmust haveKEY_BOOLEAN_MOTIONTRACKINGset to true. If you are using the defaultTangoConfigas your starting point, it is already set to true.

    You also have the option to setKEY_BOOLEAN_AUTORECOVERY. In the defaultTangoConfig, this is set to true. See the Lifecycle section for the behavior of this parameter.

    为了使用运动跟踪,您的TangoConfig必须将KEY_BOOLEAN_MOTIONTRACKING设置为true。 如果您使用默认的TangoConfig作为起点,它已经设置为true。

    您还可以选择设置KEY_BOOLEAN_AUTORECOVERY。 在默认TangoConfig中,这被设置为true。 有关此参数的行为,请参阅“生命周期”部分。

    Getting pose data获取姿势数据


    There are two coordinate frame pair options for basic motion tracking: device with respect to start of service, and device with respect to the previous device pose. With start of service, the device's pose is relative to the position where the motion tracking system initialized. You can receive pose data in both the callback and polling forms. With previous device pose, the device's pose is relative to its last position. Pose data is only available as a callback.

    对于基本运动跟踪有两个坐标框架对选项:相对于服务开始的设备,以及相对于先前设备姿势的设备。 随着服务的开始,设备的姿势相对于运动跟踪系统初始化的位置。 您可以在回调和轮询表单中接收姿势数据。 使用先前的装置姿势,装置的姿势相对于其最后的位置。 姿势数据仅作为回调提供。

    Callback-based基于回调

    If you are using the callback-based approach, you must define the coordinate frame pairs you are interested in and construct your onPoseAvailable() callback.

    You also have to implement onXyzIjAvailable and onTangoEvent, because the Tango.OnTangoUpdateListener interface requires an implementation for all three of those methods.

    如果使用基于回调的方法,则必须定义感兴趣的坐标框架对,并构造onPoseAvailable()回调。

    你还必须实现onXyzIjAvailable和onTangoEvent,因为Tango.OnTangoUpdateListener接口需要一个实现所有这三种方法。

    Polling-based

    In the polling-based approach, you must first specify the coordinate frame pair you are interested in. For simple motion tracking, this will always beTangoPoseData.COORDINATE_FRAME_DEVICEwith respect toTangoPoseData.COORDINATE_FRAME_START_OF_SERVICE.

    在基于轮询的方法中,您必须首先指定您感兴趣的坐标框架对。对于简单的运动跟踪,相对于TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,这将总是TangoPoseData.COORDINATE_FRAME_DEVICE。

    Polling-based 基于轮询

    Then call `Tango.getPoseAtTime() as desired. In the example below, the timestamp is set to 0.0 to get the latest pose. If you specify a specific timestamp, the system will return an interpolated pose at that exact time. Timestamps are relative to the device boot.

    然后根据需要调用Tango.getPoseAtTime()。 在下面的示例中,时间戳记设置为0.0,以获取最新的姿势。 如果指定特定的时间戳,系统将在该精确时间返回内插姿态。 时间戳相对于设备引导。

    相关文章

      网友评论

          本文标题:Google Tango Project-Java API Mo

          本文链接:https://www.haomeiwen.com/subject/dtbmmttx.html