本文整理汇总了Java中com.google.atap.tangoservice.TangoEvent类的典型用法代码示例。如果您正苦于以下问题:Java TangoEvent类的具体用法?Java TangoEvent怎么用?Java TangoEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TangoEvent类属于com.google.atap.tangoservice包,在下文中一共展示了TangoEvent类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTangoListeners
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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.
}
});
}
示例2: setTangoListeners
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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.
}
});
}
示例3: setTangoListeners
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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.
}
});
}
示例4: startCameraPreview
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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
}
});
}
示例5: startCameraPreview
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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
}
});
}
示例6: connectTango
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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);
}
示例7: setTangoListeners
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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();
}
}
});
}
示例8: onTangoEvent
import com.google.atap.tangoservice.TangoEvent; //导入依赖的package包/类
@Override
public void onTangoEvent(TangoEvent event) {
if (tangoUx != null) {
tangoUx.updateTangoEvent(event);
}
}
示例9: setTangoListeners
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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
}
});
}
示例10: setTangoListeners
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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
}
});
}
示例11: startAugmentedreality
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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));
}
}
示例12: setTangoListeners
import com.google.atap.tangoservice.TangoEvent; //导入依赖的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
}
});
}