计算与 TangoPoseData 的距离

Calculate distance from TangoPoseData

我的 Project Tango 设备记录了两次 Java TangoPoseData 观察。如何计算这两个观测值之间的距离(以米为单位)?

来自Coordinate Pair Frames Documentation

For all coordinate frame pairs, the unit of measurement is meters.

还有...

Project Tango uses a right-handed, local-level frame for the START_OF_SERVICE and AREA_DESCRIPTION coordinate frames. This convention sets the Z-axis aligned with gravity, with Z+ pointed upwards, and the X-Y plane is perpendicular to gravity that is locally level with the ground plane.

因此坐标可以与标准库一起使用,例如 JTS Topology Suite 用于使用 START_OF_SERVICE 和 AREA_DESCRIPTION 坐标系 的坐标。

public static Coordinate coordinate(TangoPoseData pose){

    return new Coordinate(pose.translation[TangoPoseData.INDEX_TRANSLATION_X],
                pose.translation[TangoPoseData.INDEX_TRANSLATION_Y],
                pose.translation[TangoPoseData.INDEX_TRANSLATION_Z]);
}

坐标提供 distance method:

double distanceInMeters = coordinate(pose1).distance(coordinate(pose2));