本文整理汇总了Java中com.google.atap.tangoservice.TangoPoseData类的典型用法代码示例。如果您正苦于以下问题:Java TangoPoseData类的具体用法?Java TangoPoseData怎么用?Java TangoPoseData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TangoPoseData类属于com.google.atap.tangoservice包,在下文中一共展示了TangoPoseData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateMeasurements
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Updates every saved measurement. It re-queries the device pose at the time the measurement
* was taken.
*/
public void updateMeasurements() {
for (WallMeasurement wallMeasurement : mWallMeasurementList) {
// We need to re query the depth transform when the measurements were taken.
TangoSupport.TangoMatrixTransformData transform =
TangoSupport.getMatrixTransformAtTime(wallMeasurement
.getDepthTransformTimeStamp(),
TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION,
TangoPoseData.COORDINATE_FRAME_CAMERA_DEPTH,
TangoSupport.TANGO_SUPPORT_ENGINE_OPENGL,
TangoSupport.TANGO_SUPPORT_ENGINE_TANGO);
if (transform.statusCode == TangoPoseData.POSE_VALID) {
wallMeasurement.update(transform.matrix);
mRenderer.addWallMeasurement(wallMeasurement);
} else {
Log.d(TAG, "Could not get a valid transform from depth to area description at time "
+ wallMeasurement
.getDepthTransformTimeStamp());
}
}
}
示例2: matrixToTangoPose
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Converts a transform in Matrix4 format to TangoPoseData.
*/
public static TangoPoseData matrixToTangoPose(Matrix4 transform) {
// Get translation and rotation components from the transformation matrix.
Vector3 p = transform.getTranslation();
Quaternion q = new Quaternion();
q.fromMatrix(transform);
TangoPoseData tangoPose = new TangoPoseData();
double[] t = tangoPose.translation = new double[3];
t[0] = p.x;
t[1] = p.y;
t[2] = p.z;
double[] r = tangoPose.rotation = new double[4];
r[0] = q.x;
r[1] = q.y;
r[2] = q.z;
r[3] = q.w;
return tangoPose;
}
示例3: planeFitToTangoWorldPose
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Given a point and a normal in depth camera frame and the device pose in start of service
* frame at the time the point and normal were acquired, calculate a Pose object which
* represents the position and orientation of the fitted plane with its Y vector pointing
* up in the gravity vector, represented in the Tango start of service frame.
*
* @param point Point in depth frame where the plane has been detected.
* @param normal Normal of the detected plane.
* @param tangoPose Device pose with respect to start of service at the time the plane was
* fitted.
*/
public static TangoPoseData planeFitToTangoWorldPose(
double[] point, double[] normal, TangoPoseData tangoPose, DeviceExtrinsics extrinsics) {
Matrix4 startServiceTdevice = tangoPoseToMatrix(tangoPose);
// Calculate the UP vector in the depth frame at the provided measurement pose.
Vector3 depthUp = TANGO_WORLD_UP.clone();
startServiceTdevice.clone().multiply(extrinsics.getDeviceTDepthCamera())
.inverse().rotateVector(depthUp);
// Calculate the transform in depth frame corresponding to the plane fitting information.
Matrix4 depthTplane = matrixFromPointNormalUp(point, normal, depthUp);
// Convert to OpenGL frame.
Matrix4 tangoWorldTplane = startServiceTdevice.multiply(extrinsics.getDeviceTDepthCamera()).
multiply(depthTplane);
return matrixToTangoPose(tangoWorldTplane);
}
示例4: getPointInEngineFrame
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Converts a point, represented as a Vector3 from it's initial refrence frame to
* the OpenGl world refrence frame. This allows various points to be depicted in
* the OpenGl rendering.
*/
public static Vector3 getPointInEngineFrame(
Vector3 inPoint,
TangoPoseData deviceTPointFramePose,
TangoPoseData startServiceTDevicePose) {
Matrix4 startServiceTDeviceMatrix = tangoPoseToMatrix(startServiceTDevicePose);
Matrix4 deviceTPointFrameMatrix = tangoPoseToMatrix(deviceTPointFramePose);
Matrix4 startServiceTDepthMatrix
= startServiceTDeviceMatrix.multiply(deviceTPointFrameMatrix);
// Convert the depth point to a Matrix.
Matrix4 inPointMatrix = new Matrix4();
inPointMatrix.setToTranslation(inPoint);
// Transform Point from depth frame to start of service frame to OpenGl world frame.
Matrix4 startServicePointMatrix = startServiceTDepthMatrix.multiply(inPointMatrix);
Matrix4 openGlWorldPointMatrix
= OPENGL_T_TANGO_WORLD.clone().multiply(startServicePointMatrix);
return matrixToPose(openGlWorldPointMatrix).getPosition();
}
示例5: getStatusString
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Get the status of the Pose as a string.
*
* @param pose Pose from which status string is constructed.
* @return
*/
public static String getStatusString(TangoPoseData pose) {
String poseStatus;
switch (pose.statusCode) {
case TangoPoseData.POSE_UNKNOWN:
poseStatus = "unknown";
break;
case TangoPoseData.POSE_INVALID:
poseStatus = "invalid";
break;
case TangoPoseData.POSE_INITIALIZING:
poseStatus = "initializing";
break;
case TangoPoseData.POSE_VALID:
poseStatus = "valid";
break;
default:
poseStatus = "unknown";
}
return poseStatus;
}
示例6: setupExtrinsics
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
private static DeviceExtrinsics setupExtrinsics(Tango tango) {
// Create camera to IMU transform.
TangoCoordinateFramePair framePair = new TangoCoordinateFramePair();
framePair.baseFrame = TangoPoseData.COORDINATE_FRAME_IMU;
framePair.targetFrame = TangoPoseData.COORDINATE_FRAME_CAMERA_COLOR;
TangoPoseData imuToRgbPose = tango.getPoseAtTime(0.0, framePair);
// Create device to IMU transform.
framePair.targetFrame = TangoPoseData.COORDINATE_FRAME_DEVICE;
TangoPoseData imuToDevicePose = tango.getPoseAtTime(0.0, framePair);
// Create depth camera to IMU transform.
framePair.targetFrame = TangoPoseData.COORDINATE_FRAME_CAMERA_DEPTH;
TangoPoseData imuToDepthPose = tango.getPoseAtTime(0.0, framePair);
return new DeviceExtrinsics(imuToDevicePose, imuToRgbPose, imuToDepthPose);
}
示例7: setUpExtrinsics
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Setup the extrinsics of the device.
*/
private void setUpExtrinsics() {
// Get device to imu matrix.
TangoPoseData device2IMUPose = new TangoPoseData();
TangoCoordinateFramePair framePair = new TangoCoordinateFramePair();
framePair.baseFrame = TangoPoseData.COORDINATE_FRAME_IMU;
framePair.targetFrame = TangoPoseData.COORDINATE_FRAME_DEVICE;
device2IMUPose = mTango.getPoseAtTime(0.0, framePair);
mRenderer.getModelMatCalculator().SetDevice2IMUMatrix(
device2IMUPose.getTranslationAsFloats(), device2IMUPose.getRotationAsFloats());
// Get color camera to imu matrix.
TangoPoseData color2IMUPose = new TangoPoseData();
framePair.baseFrame = TangoPoseData.COORDINATE_FRAME_IMU;
framePair.targetFrame = TangoPoseData.COORDINATE_FRAME_CAMERA_COLOR;
color2IMUPose = mTango.getPoseAtTime(0.0, framePair);
mRenderer.getModelMatCalculator().SetColorCamera2IMUMatrix(
color2IMUPose.getTranslationAsFloats(), color2IMUPose.getRotationAsFloats());
}
示例8: matrixToTangoPose
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Converts a transform in Matrix4 format to TangoPoseData.
*/
public static TangoPoseData matrixToTangoPose(Matrix4 transform) {
// Get translation and rotation components from the transformation matrix
Vector3 p = transform.getTranslation();
Quaternion q = new Quaternion();
q.fromMatrix(transform);
// NOTE: Rajawali Quaternions use a left-hand rotation around the axis convention
q.conjugate();
TangoPoseData tangoPose = new TangoPoseData();
double[] t = tangoPose.translation = new double[3];
t[0] = p.x;
t[1] = p.y;
t[2] = p.z;
double[] r = tangoPose.rotation = new double[4];
r[0] = q.x;
r[1] = q.y;
r[2] = q.z;
r[3] = q.w;
return tangoPose;
}
示例9: toOpenGLCameraPose
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Given a pose in start of service or area description frame, calculate the corresponding
* position and orientation for a OpenGL Scene Camera in the Rajawali world.
*/
public Pose toOpenGLCameraPose(TangoPoseData tangoPose) {
// We can't do this calculation until Extrinsics are set-up
if (mDeviceTColorCamera == null) {
throw new RuntimeException("You must call setupExtrinsics first.");
}
Matrix4 startServiceTdevice = tangoPoseToMatrix(tangoPose);
// Get device pose in OpenGL world frame
Matrix4 openglTDevice = OPENGL_T_TANGO_WORLD.clone().multiply(startServiceTdevice);
// Get OpenGL camera pose in OpenGL world frame
Matrix4 openglWorldTOpenglCamera = openglTDevice.multiply(mDeviceTColorCamera).
multiply(COLOR_CAMERA_T_OPENGL_CAMERA);
return matrixToPose(openglWorldTOpenglCamera);
}
示例10: toOpenGLPointCloudPose
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Given a TangoPoseData object, calculate the corresponding position and orientation for a
* PointCloud in Depth camera coordinate system to the Rajawali world.
*/
public Pose toOpenGLPointCloudPose(TangoPoseData tangoPose) {
// We can't do this calculation until Extrinsics are set-up
if (mDeviceTDepthCamera == null) {
throw new RuntimeException("You must call setupExtrinsics first.");
}
//conversion matrix to put point cloud data in Rajwali/Opengl Coordinate system.
Matrix4 invertYandZMatrix = new Matrix4(new double[]{1.0f, 0.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f, 0.0f,
0.0f, 0.0f, -1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f });
Matrix4 startServiceTdevice = tangoPoseToMatrix(tangoPose);
// Get device pose in OpenGL world frame
Matrix4 openglTDevice = OPENGL_T_TANGO_WORLD.clone().multiply(startServiceTdevice);
// Get OpenGL camera pose in OpenGL world frame
Matrix4 openglWorldTOpenglCamera = openglTDevice.multiply(mDeviceTDepthCamera).
multiply(DEPTH_CAMERA_T_OPENGL_CAMERA).multiply(invertYandZMatrix);
return matrixToPose(openglWorldTOpenglCamera);
}
示例11: planeFitToOpenGLPose
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Given a point and a normal in depth camera frame and the device pose in start of service
* frame at the time the point and normal were measured, calculate a TangoPoseData object in
* Tango start of service frame.
*
* @param point Point in depth frame where the plane has been detected.
* @param normal Normal of the detected plane
* @param tangoPose Device pose with respect to start of service at the time the plane was
* fitted
*/
public Pose planeFitToOpenGLPose(double[] point, double[] normal, TangoPoseData tangoPose) {
if (mDeviceTDepthCamera == null) {
throw new RuntimeException("You must call setupExtrinsics first");
}
Matrix4 startServiceTdevice = tangoPoseToMatrix(tangoPose);
// Calculate the UP vector in the Depth frame at the provided measurement pose
Vector3 depthUp = TANGO_WORLD_UP.clone();
startServiceTdevice.clone().multiply(mDeviceTDepthCamera).inverse().rotateVector(depthUp);
// Calculate the transform in depth frame corresponding to the plane fitting information
Matrix4 depthTplane = matrixFromPointNormalUp(point, normal, depthUp);
// Convert to OpenGL frame
Matrix4 openglWorldTplane = OPENGL_T_TANGO_WORLD.clone().multiply(startServiceTdevice)
.multiply(mDeviceTDepthCamera).multiply(depthTplane);
return matrixToPose(openglWorldTplane);
}
示例12: calculateColorCameraTDepthWithTime
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Calculates the transform between the color camera at a time t0 and the depth camera at a
* time t1, given the device poses at t0 and t1.
*/
public TangoPoseData calculateColorCameraTDepthWithTime(TangoPoseData ssTdeviceT0pose,
TangoPoseData ssTdeviceT1pose) {
if (mDeviceTDepthCamera == null) {
throw new RuntimeException("You must call setupExtrinsics first");
}
// Operation at hand:
// rgb_t0_T_depth_t1 = rgb_T_dev * dev_t0_T_ss * ss_T_dev_t1 * dev_T_depth
Matrix4 ssTdeviceT0 = tangoPoseToMatrix(ssTdeviceT0pose);
Matrix4 ssTdeviceT1 = tangoPoseToMatrix(ssTdeviceT1pose);
Matrix4 rgbt0Tdeptht1 = mDeviceTColorCamera.clone().inverse().
multiply(ssTdeviceT0.inverse()).multiply(ssTdeviceT1).multiply(mDeviceTDepthCamera);
return matrixToTangoPose(rgbt0Tdeptht1);
}
示例13: getStatusString
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Get the status of the Pose as a string.
* @param pose: Pose from which status string is constructed.
* @return
*/
public static String getStatusString(TangoPoseData pose){
String poseStatus = "unknown";
switch (pose.statusCode){
case TangoPoseData.POSE_UNKNOWN:
poseStatus = "unknown";
break;
case TangoPoseData.POSE_INVALID:
poseStatus = "invalid";
break;
case TangoPoseData.POSE_INITIALIZING:
poseStatus = "initializing";
break;
case TangoPoseData.POSE_VALID:
poseStatus = "valid";
break;
default:
poseStatus = "unknown";
}
return poseStatus;
}
示例14: updateXyzIjData
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Update the current cloud data with the provided xyzIjData from a Tango callback.
*
* @param from The point cloud data
* @param xyzIjPose The device pose with respect to start of service at the time
* the point cloud was acquired
*/
public synchronized void updateXyzIjData(TangoXyzIjData from, TangoPoseData xyzIjPose) {
mDevicePoseAtCloudTime = xyzIjPose;
if (mXyzIjData.xyz == null || mXyzIjData.xyz.capacity() < from.xyzCount * 3) {
mXyzIjData.xyz = ByteBuffer.allocateDirect(from.xyzCount * 3 * 4)
.order(ByteOrder.nativeOrder()).asFloatBuffer();
} else {
mXyzIjData.xyz.rewind();
}
mXyzIjData.xyzCount = from.xyzCount;
mXyzIjData.timestamp = from.timestamp;
from.xyz.rewind();
mXyzIjData.xyz.put(from.xyz);
mXyzIjData.xyz.rewind();
from.xyz.rewind();
}
示例15: setupExtrinsics
import com.google.atap.tangoservice.TangoPoseData; //导入依赖的package包/类
/**
* Calculates and stores the fixed transformations between the device and the various sensors
* to be used later for transformations between frames.
*/
private void setupExtrinsics() {
// Create Camera to IMU Transform
TangoCoordinateFramePair framePair = new TangoCoordinateFramePair();
framePair.baseFrame = TangoPoseData.COORDINATE_FRAME_IMU;
framePair.targetFrame = TangoPoseData.COORDINATE_FRAME_CAMERA_COLOR;
TangoPoseData imuTrgbPose = mTango.getPoseAtTime(0.0, framePair);
// Create Device to IMU Transform
framePair.targetFrame = TangoPoseData.COORDINATE_FRAME_DEVICE;
TangoPoseData imuTdevicePose = mTango.getPoseAtTime(0.0, framePair);
// Create Depth camera to IMU Transform
framePair.targetFrame = TangoPoseData.COORDINATE_FRAME_CAMERA_DEPTH;
TangoPoseData imuTdepthPose = mTango.getPoseAtTime(0.0, framePair);
mRenderer.setupExtrinsics(imuTdevicePose, imuTrgbPose, imuTdepthPose);
}