• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TangoXyzIjData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.atap.tangoservice.TangoXyzIjData的典型用法代码示例。如果您正苦于以下问题:Java TangoXyzIjData类的具体用法?Java TangoXyzIjData怎么用?Java TangoXyzIjData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TangoXyzIjData类属于com.google.atap.tangoservice包,在下文中一共展示了TangoXyzIjData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updateXyzIjData

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的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();
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:26,代码来源:PointCloudManager.java


示例2: setTangoListeners

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
/**
 * Set up the callback listeners for the Tango service, then begin using the Motion
 * Tracking API. This is called in response to the user clicking the 'Start' Button.
 */
private void setTangoListeners() {
    // Lock configuration and connect to Tango.
    // Select coordinate frame pair.
    final ArrayList<TangoCoordinateFramePair> framePairs =
            new ArrayList<TangoCoordinateFramePair>();
    framePairs.add(new TangoCoordinateFramePair(
            TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
            TangoPoseData.COORDINATE_FRAME_DEVICE));

    // Listen for new Tango data
    mTango.connectListener(framePairs, new OnTangoUpdateListener() {
        @Override
        public void onPoseAvailable(final TangoPoseData pose) {
            // We are not using TangoPoseData for this application.
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
            // We are not using onXyzIjAvailable for this app.
        }

        @Override
        public void onPointCloudAvailable(final TangoPointCloudData pointCloudData) {
            logPointCloud(pointCloudData);
        }

        @Override
        public void onTangoEvent(final TangoEvent event) {
            // Ignoring TangoEvents.
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // We are not using onFrameAvailable for this application.
        }
    });
}
 
开发者ID:max2dn,项目名称:TangoTest,代码行数:42,代码来源:HelloDepthPerceptionActivity.java


示例3: setTangoListeners

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
/**
 * Set up the callback listeners for the Tango service, then begin using the Motion
 * Tracking API. This is called in response to the user clicking the 'Start' Button.
 */
private void setTangoListeners() {
    // Lock configuration and connect to Tango
    // Select coordinate frame pair
    final ArrayList<TangoCoordinateFramePair> framePairs =
            new ArrayList<TangoCoordinateFramePair>();
    framePairs.add(new TangoCoordinateFramePair(
            TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
            TangoPoseData.COORDINATE_FRAME_DEVICE));

    // Listen for new Tango data
    mTango.connectListener(framePairs, new OnTangoUpdateListener() {
        @Override
        public void onPoseAvailable(final TangoPoseData pose) {
            logPose(pose);
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
            // We are not using onXyzIjAvailable for this app.
        }

        @Override
        public void onPointCloudAvailable(TangoPointCloudData pointCloud) {
            // We are not using onPointCloudAvailable for this app.
        }

        @Override
        public void onTangoEvent(final TangoEvent event) {
            // Ignoring TangoEvents.
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // We are not using onFrameAvailable for this application.
        }
    });
}
 
开发者ID:max2dn,项目名称:TangoTest,代码行数:42,代码来源:HelloMotionTrackingActivity.java


示例4: setTangoListeners

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
/**
 * Set up the callback listeners for the Tango service, then begin using the Motion
 * Tracking API. This is called in response to the user clicking the 'Start' Button.
 */
private void setTangoListeners() {
    // Lock configuration and connect to Tango
    // Select coordinate frame pair
    final ArrayList<TangoCoordinateFramePair> framePairs =
            new ArrayList<TangoCoordinateFramePair>();
    framePairs.add(new TangoCoordinateFramePair(
            TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
            TangoPoseData.COORDINATE_FRAME_DEVICE));

    // Listen for new Tango data
    mTango.connectListener(framePairs, new Tango.OnTangoUpdateListener() {
        @Override
        public void onPoseAvailable(final TangoPoseData pose) {
            logPose(pose);
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
            // We are not using onXyzIjAvailable for this app.
        }

        @Override
        public void onPointCloudAvailable(TangoPointCloudData pointCloud) {
            // We are not using onPointCloudAvailable for this app.
        }

        @Override
        public void onTangoEvent(final TangoEvent event) {
            // Ignoring TangoEvents.
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // We are not using onFrameAvailable for this application.
        }
    });
}
 
开发者ID:xiuxiu,项目名称:parrot_with_tango,代码行数:42,代码来源:DeviceListActivity.java


示例5: startCameraPreview

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
private void startCameraPreview() {
    // Connect to color camera
	tangoCameraPreview.connectToTangoCamera(mTango,
			TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
	// Use default configuration for Tango Service.
	TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT);
	mTango.connect(config);
	
	// No need to add any coordinate frame pairs since we are not using 
	// pose data. So just initialize.
	ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
	mTango.connectListener(framePairs, new OnTangoUpdateListener() {
		@Override
		public void onPoseAvailable(TangoPoseData pose) {
			// We are not using OnPoseAvailable for this app
		}

		@Override
		public void onFrameAvailable(int cameraId) {
		    
		    // Check if the frame available is for the camera we want and
		    // update its frame on the camera preview.
			if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
				tangoCameraPreview.onFrameAvailable();
			}
		}

		@Override
		public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
			// We are not using OnPoseAvailable for this app
		}

		@Override
		public void onTangoEvent(TangoEvent event) {
			// We are not using OnPoseAvailable for this app
		}
	});
}
 
开发者ID:erlandsona,项目名称:Bat-Vision,代码行数:39,代码来源:MainActivity.java


示例6: startCameraPreview

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
private void startCameraPreview() {
    // Connect to color camera
	tangoCameraPreview.connectToTangoCamera(mTango,
			TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
	// Use default configuration for Tango Service.
	TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT);
	mTango.connect(config);
	mIsConnected = true;
	
	// No need to add any coordinate frame pairs since we are not using 
	// pose data. So just initialize.
	ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
	mTango.connectListener(framePairs, new OnTangoUpdateListener() {
		@Override
		public void onPoseAvailable(TangoPoseData pose) {
			// We are not using OnPoseAvailable for this app
		}

		@Override
		public void onFrameAvailable(int cameraId) {
		    
		    // Check if the frame available is for the camera we want and
		    // update its frame on the camera preview.
			if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
				tangoCameraPreview.onFrameAvailable();
			}
		}

		@Override
		public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
			// We are not using OnPoseAvailable for this app
		}

		@Override
		public void onTangoEvent(TangoEvent event) {
			// We are not using OnPoseAvailable for this app
		}
	});
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:40,代码来源:MainActivity.java


示例7: connectTango

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
/**
 * Configure the Tango service and connect it to callbacks.
 */
private void connectTango() {
    // Use default configuration for Tango Service, plus low latency
    // IMU integration and area learning.
    TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT);
    // NOTE: Low latency integration is necessary to achieve a precise alignment of virtual
    // objects with the RBG image and produce a good AR effect.
    config.putBoolean(TangoConfig.KEY_BOOLEAN_LOWLATENCYIMUINTEGRATION, true);
    config.putBoolean(TangoConfig.KEY_BOOLEAN_DEPTH, true);
    // NOTE: Area learning is necessary to achieve better precision is pose estimation
    config.putBoolean(TangoConfig.KEY_BOOLEAN_LEARNINGMODE, true);
    config.putBoolean(TangoConfig.KEY_BOOLEAN_COLORCAMERA, true);
    mTango.connect(config);

    // No need to add any coordinate frame pairs since we are not
    // using pose data. So just initialize.
    ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
    mTango.connectListener(framePairs, new OnTangoUpdateListener() {
        @Override
        public void onPoseAvailable(TangoPoseData pose) {
            // We are not using OnPoseAvailable for this app.
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // Check if the frame available is for the camera we want and update its frame
            // on the view.
            if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
                // Mark a camera frame is available for rendering in the OpenGL thread
                mIsFrameAvailableTangoThread.set(true);
                mSurfaceView.requestRender();
            }
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
            // Save the cloud and point data for later use.
            mPointCloudManager.updateXyzIj(xyzIj);
        }

        @Override
        public void onTangoEvent(TangoEvent event) {
            // We are not using OnTangoEvent for this app.
        }
    });

    mIntrinsics = mTango.getCameraIntrinsics(TangoCameraIntrinsics.TANGO_CAMERA_COLOR);
}
 
开发者ID:tdb-alcorn,项目名称:defect-party,代码行数:51,代码来源:FloorplanActivity.java


示例8: doWallMeasurement

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
/**
 * Use the TangoSupport library and point cloud data to calculate the plane at the specified
 * location in the color camera frame.
 * It returns the pose of the fitted plane in a TangoPoseData structure.
 */
private WallMeasurement doWallMeasurement(float u, float v, double rgbTimestamp) {
    TangoXyzIjData xyzIj = mPointCloudManager.getLatestXyzIj();

    if (xyzIj == null) {
        return null;
    }

    // We need to calculate the transform between the color camera at the
    // time the user clicked and the depth camera at the time the depth
    // cloud was acquired.
    TangoPoseData colorTdepthPose = TangoSupport.calculateRelativePose(
            rgbTimestamp, TangoPoseData.COORDINATE_FRAME_CAMERA_COLOR,
            xyzIj.timestamp, TangoPoseData.COORDINATE_FRAME_CAMERA_DEPTH);

    // Perform plane fitting with the latest available point cloud data.
    try {
        IntersectionPointPlaneModelPair intersectionPointPlaneModelPair =
                TangoSupport.fitPlaneModelNearClick(xyzIj, mIntrinsics,
                        colorTdepthPose, u, v);

        // Get the depth camera transform at the time the plane data was acquired.
        TangoSupport.TangoMatrixTransformData transform =
                TangoSupport.getMatrixTransformAtTime(xyzIj.timestamp,
                        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) {
            // Update the AR object location.
            float[] planeFitTransform = calculatePlaneTransform(
                    intersectionPointPlaneModelPair.intersectionPoint,
                    intersectionPointPlaneModelPair.planeModel, transform.matrix);

            return new WallMeasurement(planeFitTransform, transform.matrix, xyzIj.timestamp);
        } else {
            Log.d(TAG, "Could not get a valid transform from depth to area description at time "
                    + xyzIj.timestamp);
        }
    } catch (TangoException e) {
        Log.d(TAG, "Failed to fit plane");
    }
    return null;
}
 
开发者ID:tdb-alcorn,项目名称:defect-party,代码行数:49,代码来源:FloorplanActivity.java


示例9: setTangoListeners

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
/**
 * Set up the callback listeners for the Tango service, then begin using the Motion
 * Tracking API. This is called in response to the user clicking the 'Start' Button.
 */
private void setTangoListeners() {
    // Lock configuration and connect to Tango
    // Select coordinate frame pair
    ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();

    // Listen for new Tango data
    mTango.connectListener(framePairs, new OnTangoUpdateListener() {
        @Override
        public void onPoseAvailable(final TangoPoseData pose) {
            // We are not using TangoPoseData for this application.
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
            // We are not using onXyzIjAvailable for this app.
        }

        @Override
        public void onPointCloudAvailable(final TangoPointCloudData pointCloudData) {
            logPointCloud(pointCloudData);
        }

        @Override
        public void onTangoEvent(final TangoEvent event) {
            // Ignoring TangoEvents.
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // This will get called every time a new RGB camera frame is available to be
            // rendered.
            Log.d(TAG, "onFrameAvailable");

            if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
                // Now that we are receiving onFrameAvailable callbacks, we can switch
                // to RENDERMODE_WHEN_DIRTY to drive the render loop from this callback.
                // This will result on a frame rate of  approximately 30FPS, in synchrony with
                // the RGB camera driver.
                // If you need to render at a higher rate (i.e.: if you want to render complex
                // animations smoothly) you  can use RENDERMODE_CONTINUOUSLY throughout the
                // application lifecycle.
                if (mSurfaceView.getRenderMode() != GLSurfaceView.RENDERMODE_WHEN_DIRTY) {
                    mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
                }

                // Note that the RGB data is not passed as a parameter here.
                // Instead, this callback indicates that you can call
                // the {@code updateTexture()} method to have the
                // RGB data copied directly to the OpenGL texture at the native layer.
                // Since that call needs to be done from the OpenGL thread, what we do here is
                // set-up a flag to tell the OpenGL thread to do that in the next run.
                // NOTE: Even if we are using a render by request method, this flag is still
                // necessary since the OpenGL thread run requested below is not guaranteed
                // to run in synchrony with this requesting call.
                mIsFrameAvailableTangoThread.set(true);
                // Trigger an OpenGL render to update the OpenGL scene with the new RGB data.
                mSurfaceView.requestRender();
            }
        }
    });
}
 
开发者ID:max2dn,项目名称:TangoTest,代码行数:66,代码来源:HelloVideoActivity.java


示例10: onXyzIjAvailable

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
@Override
public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
    if (tangoUx != null) {
        tangoUx.updateXyzCount(xyzIj.xyzCount);
    }
}
 
开发者ID:inovex,项目名称:tango-ar-navigation-example,代码行数:7,代码来源:MainActivity.java


示例11: setTangoListeners

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
/**
 * Set up the TangoConfig and the listeners for the Tango service, then begin using the Motion
 * Tracking API. This is called in response to the user clicking the 'Start' Button.
 */
private void setTangoListeners() {
    // Lock configuration and connect to Tango
    // Select coordinate frame pair
    final ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
    framePairs.add(new TangoCoordinateFramePair(
            TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
            TangoPoseData.COORDINATE_FRAME_DEVICE));
    // Listen for new Tango data
    mTango.connectListener(framePairs, new OnTangoUpdateListener() {

        @Override
        public void onPoseAvailable(final TangoPoseData pose) {
            //Make sure to have atomic access to Tango Pose Data so that
            //render loop doesn't interfere while Pose call back is updating
            // the data.
            synchronized (sharedLock) {
                mPose = pose;
                mDeltaTime = (float) (pose.timestamp - mPreviousTimeStamp) * SECS_TO_MILLISECS;
                mPreviousTimeStamp = (float) pose.timestamp;
                // Log whenever Motion Tracking enters an invalid state
                if (!mIsAutoRecovery && (pose.statusCode == TangoPoseData.POSE_INVALID)) {
                    Log.w(TAG, "Invalid State");
                }
                if (mPreviousPoseStatus != pose.statusCode) {
                    count = 0;
                }
                count++;
                mPreviousPoseStatus = pose.statusCode;
                // Update the OpenGL renderable objects with the new Tango Pose
                // data
                float[] translation = pose.getTranslationAsFloats();
                if(!mRenderer.isValid()){
                    return;
                }
                mRenderer.getTrajectory().updateTrajectory(translation);
                mRenderer.getModelMatCalculator().updateModelMatrix(translation,
                        pose.getRotationAsFloats());
            }
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData arg0) {
            // We are not using TangoXyzIjData for this application
        }

        @Override
        public void onTangoEvent(final TangoEvent event) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    mTangoEventTextView.setText(event.eventKey + ": " + event.eventValue);
                }
            });
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // We are not using onFrameAvailable for this application
        }
    });
}
 
开发者ID:erlandsona,项目名称:Bat-Vision,代码行数:66,代码来源:MotionTrackingActivity.java


示例12: setTangoListeners

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
/**
 * Set up the callback listeners for the Tango service, then begin using the Motion
 * Tracking API. This is called in response to the user clicking the 'Start' Button.
 */
private void setTangoListeners() {
    // Lock configuration and connect to Tango
    // Select coordinate frame pair
    final ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
    framePairs.add(new TangoCoordinateFramePair(
            TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
            TangoPoseData.COORDINATE_FRAME_DEVICE));

    // Listen for new Tango data
    mTango.connectListener(framePairs, new OnTangoUpdateListener() {

        @Override
        public void onPoseAvailable(final TangoPoseData pose) {
            // Update the OpenGL renderable objects with the new Tango Pose data.
            // Note that locking for thread safe access with the OpenGL loop is done entirely
            // in the renderer.
            mRenderer.updateDevicePose(pose);
            
            // Make sure to have atomic access to Tango Pose Data so that the UI
            // the UI loop doesn't interfere while Pose call back is updating the data
            synchronized (mUiThreadLock) {
                mPose = pose;

                //Now lets log some interesting statistics of Motion Tracking like
                // Delta Time between two Poses, number of poses since the initialization state.
                mDeltaTime = (float) (pose.timestamp - mPreviousTimeStamp) * SECS_TO_MILLISECS;
                mPreviousTimeStamp = (float) pose.timestamp;
                // Log whenever Motion Tracking enters an invalid state
                if (!mIsAutoRecovery && (pose.statusCode == TangoPoseData.POSE_INVALID)) {
                    Log.w(TAG, "Invalid State");
                }
                if (mPreviousPoseStatus != pose.statusCode) {
                    mCount = 0;
                }
                mCount++;
                mPreviousPoseStatus = pose.statusCode;
            }
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData arg0) {
            // We are not using TangoXyzIjData for this application
        }

        @Override
        public void onTangoEvent(final TangoEvent event) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    mTangoEventTextView.setText(event.eventKey + ": " + event.eventValue);
                }
            });
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // We are not using onFrameAvailable for this application
        }
    });
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:65,代码来源:MotionTrackingActivity.java


示例13: PointCloudManager

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
public PointCloudManager(TangoCameraIntrinsics intrinsics) {
    mXyzIjData = new TangoXyzIjData();
    mTangoCameraIntrinsics = intrinsics;
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:5,代码来源:PointCloudManager.java


示例14: startAugmentedreality

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
private void startAugmentedreality() {
    if (!mIsConnected) {
        mIsConnected = true;
        // Connect to color camera
        mGLView.connectToTangoCamera(mTango, TangoCameraIntrinsics.TANGO_CAMERA_COLOR);

        // Use default configuration for Tango Service, plus low latency IMU integration.
        TangoConfig config = mTango.getConfig(TangoConfig.CONFIG_TYPE_DEFAULT);
        // NOTE: low latency integration is necessary to achieve a precise alignment of
        // virtual objects with the RBG image and produce a good AR effect.
        config.putBoolean(TangoConfig.KEY_BOOLEAN_LOWLATENCYIMUINTEGRATION, true);
        config.putBoolean(TangoConfig.KEY_BOOLEAN_DEPTH, true);
        mTango.connect(config);

        // No need to add any coordinate frame pairs since we are not using
        // pose data. So just initialize.
        ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
        mTango.connectListener(framePairs, new OnTangoUpdateListener() {
            @Override
            public void onPoseAvailable(TangoPoseData pose) {
                // We are not using OnPoseAvailable for this app
            }

            @Override
            public void onFrameAvailable(int cameraId) {
                // Check if the frame available is for the camera we want and
                // update its frame on the view.
                if (cameraId == TangoCameraIntrinsics.TANGO_CAMERA_COLOR) {
                    mGLView.onFrameAvailable();
                }
            }

            @Override
            public void onXyzIjAvailable(TangoXyzIjData xyzIj) {
                // Get the device pose at the time the point cloud was acquired
                TangoCoordinateFramePair framePair = new TangoCoordinateFramePair(
                        TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
                        TangoPoseData.COORDINATE_FRAME_DEVICE);
                TangoPoseData cloudPose = mTango.getPoseAtTime(xyzIj.timestamp, framePair);

                // Save the cloud and point data for later use
                mPointCloudManager.updateXyzIjData(xyzIj, cloudPose);
            }

            @Override
            public void onTangoEvent(TangoEvent event) {
                // We are not using OnPoseAvailable for this app
            }
        });

        // Get extrinsics from device for use in transforms
        // This needs to be done after connecting Tango and listeners
        setupExtrinsics();

        // Set-up point cloud plane fitting library helper class
        mPointCloudManager = new PointCloudManager(mTango.getCameraIntrinsics(
                TangoCameraIntrinsics.TANGO_CAMERA_COLOR));

    }
}
 
开发者ID:kupoko,项目名称:Tiresias,代码行数:61,代码来源:AugmentedRealityActivity.java


示例15: setTangoListeners

import com.google.atap.tangoservice.TangoXyzIjData; //导入依赖的package包/类
/**
 * Set up the TangoConfig and the listeners for the Tango service, then begin using the Motion
 * Tracking API. This is called in response to the user clicking the 'Start' Button.
 */
private void setTangoListeners() {
    // Lock configuration and connect to Tango
    // Select coordinate frame pair
    final ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>();
    framePairs.add(new TangoCoordinateFramePair(
            TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE,
            TangoPoseData.COORDINATE_FRAME_DEVICE));
    // Listen for new Tango data
    mTango.connectListener(framePairs, new OnTangoUpdateListener() {

        @Override
        public void onPoseAvailable(final TangoPoseData pose) {
            //Make sure to have atomic access to Tango Pose Data so that
            //render loop doesn't interfere while Pose call back is updating
            // the data.
            synchronized (sharedLock) {
                mPose = pose;
                mDeltaTime = (float) (pose.timestamp - mPreviousTimeStamp) * SECS_TO_MILLISECS;
                mPreviousTimeStamp = (float) pose.timestamp;
                // Log whenever Motion Tracking enters an invalid state
                if (!mIsAutoRecovery && (pose.statusCode == TangoPoseData.POSE_INVALID)) {
                    Log.w(TAG, "Invalid State");
                }
                if (mPreviousPoseStatus != pose.statusCode) {
                    count = 0;
                }
                count++;
                mPreviousPoseStatus = pose.statusCode;
                // Update the OpenGL renderable objects with the new Tango Pose
                // data
                float[] translation = pose.getTranslationAsFloats();
                if(!mRenderer.isValid()){
                    return;
                }
                mRenderer.getTrajectory().updateTrajectory(translation);
                mRenderer.getModelMatCalculator().updateModelMatrix(translation,
                        pose.getRotationAsFloats());
                mRenderer.updateViewMatrix();
            }
        }

        @Override
        public void onXyzIjAvailable(TangoXyzIjData arg0) {
            // We are not using TangoXyzIjData for this application
        }

        @Override
        public void onTangoEvent(final TangoEvent event) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    mTangoEventTextView.setText(event.eventKey + ": " + event.eventValue);
                }
            });
        }

        @Override
        public void onFrameAvailable(int cameraId) {
            // We are not using onFrameAvailable for this application
        }
    });
}
 
开发者ID:aroller,项目名称:tango-caminada,代码行数:67,代码来源:MotionTrackingActivity.java



注:本文中的com.google.atap.tangoservice.TangoXyzIjData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Type类代码示例发布时间:2022-05-22
下一篇:
Java Values类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap