Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Primi passi con Project Tango

54 views

Published on

Talk su Project Tango di Google tenuto durante la GDG DevFest Bari 2016

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Primi passi con Project Tango

  1. 1. Primi passi con Tango Mike Trizio @mik3lantoniO
  2. 2. Phab 2
  3. 3. SDK available for
  4. 4. onCreate() ... // Create a new Tango Configuration and enable the MotionTracking API mConfig = new TangoConfig(); mConfig = mTango.getConfig(TangoConfig.CONFIG_TYPE_CURRENT); ...
  5. 5. onResume() ... try { mTango.connect(mConfig); } catch (TangoOutOfDateException e) { // handle the error } ...
  6. 6. onPause() ... try { mTango.disconnect(); } catch (TangoErrorException e) { // handle the error } ...
  7. 7. mTango.connectListener(framePairs, new OnTangoUpdateListener() { @Override public void onTangoEvent(final TangoEvent event) { if (event.eventKey.equals(TangoEvent.DESCRIPTION_FISHEYE_OVER_EXPOSED) { // handle the Fisheye camera issue } if (event.eventKey.equals(TangoEvent.DESCRIPTION_TOO_FEW_FEATURES_TRACKED) // handle having too few features } // ... } }
  8. 8. 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) { // Process pose data from device with respect to start of service } // TODO: Define other overrides });
  9. 9. // Define what motion is requested. TangoCoordinateFramePair frames_of_reference; frames_of_reference.baseFrame = TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE; frames_of_reference.targetFrame = TangoPoseData.COORDINATE_FRAME_DEVICE;
  10. 10. new Thread(new Runnable() { final int pollingUpdatePeriodMilliseconds = 66; @Override public void run() { while (true) { try { Thread.sleep(pollingUpdatePeriodMilliseconds); final TangoPoseData queryPoseStartDevice = mTango.getPoseAtTime(0.0, frames_of_reference); } catch (TangoErrorException e) { e.printStackTrace(); } } } }).start();
  11. 11. onCreate() ... // Create a new Tango Configuration with Depth Perception API enabled mConfig = new TangoConfig(); mConfig = mTango.getConfig(TangoConfig.CONFIG_TYPE_CURRENT); mConfig.putBoolean(TangoConfig.KEY_BOOLEAN_DEPTH, true); ...
  12. 12. mTango.connectListener(framePairs, new OnTangoUpdateListener() { .... @Override public void onPointCloudAvailable(final TangoPointCloudData pointCloudData) { logPointCloud(pointCloudData); } ... });
  13. 13. private void logPointCloud(TangoPointCloudData pointCloudData) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("Point count: " + pointCloudData.numPoints); stringBuilder.append(". Average depth (m): " + calculateAveragedDepth(pointCloudData.points, pointCloudData.numPoints)); Log.i(TAG, stringBuilder.toString()); } private float calculateAveragedDepth(FloatBuffer pointCloudBuffer, int numPoints) { float totalZ = 0; float averageZ = 0; if (numPoints != 0) { int numFloats = 4 * numPoints; for (int i = 2; i < numFloats; i = i + 4) { totalZ = totalZ + pointCloudBuffer.get(i); } averageZ = totalZ / numPoints; } return averageZ; }
  14. 14. onCreate() ... // Create a new Tango Configuration with Depth Perception API enabled mConfig = new TangoConfig(); mConfig = mTango.getConfig(TangoConfig.CONFIG_TYPE_CURRENT); mConfig.putBoolean(TangoConfig.KEY_BOOLEAN_LEARNINGMODE, true); ...
  15. 15. try { mConfig.putString(TangoConfig.KEY_STRING_AREADESCRIPTION, area_filename); } catch (TangoErrorException e) { // handle exception }
  16. 16. ArrayList<String> fullUUIDList = new ArrayList<String>(); // Returns a list of ADFs with their UUIDs fullUUIDList = mTango.listAreaDescriptions(); // Load the latest ADF if ADFs are found. if (fullUUIDList.size() > 0) { mConfig.putString(TangoConfig.KEY_STRING_AREADESCRIPTION, fullUUIDList.get(fullUUIDList.size() - 1)); }
  17. 17. final ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>(); framePairs.add(new TangoCoordinateFramePair( TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION, TangoPoseData.COORDINATE_FRAME_DEVICE)); // Listen for new Tango data mTango.connectListener(framePairs, new OnTangoUpdateListener() { @Override public void onPoseAvailable(final TangoPoseData pose) { // Process pose data from device with respect to start of service } // TODO: Define other overrides });
  18. 18. final ArrayList<TangoCoordinateFramePair> framePairs = new ArrayList<TangoCoordinateFramePair>(); framePairs.add(new TangoCoordinateFramePair( TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION, TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE)); // Listen for new Tango data mTango.connectListener(framePairs, new OnTangoUpdateListener() { @Override public void onPoseAvailable(final TangoPoseData pose) { // Process pose data from device with respect to start of service } // TODO: Define other overrides });
  19. 19. @Override public void onPoseAvailable(TangoPoseData pose) { if (pose.baseFrame == TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION && pose.targetFrame == TangoPoseData.COORDINATE_FRAME_DEVICE) { // Process new ADF to device pose data. } else if (pose.baseFrame == TangoPoseData.COORDINATE_FRAME_AREA_DESCRIPTION && pose.targetFrame == TangoPoseData.COORDINATE_FRAME_START_OF_SERVICE) { // Process new localization. }
  20. 20. String newAdfUUID = mTango.saveAreaDescription()
  21. 21. Tango UX Framework Java Support Library Additional goodies
  22. 22. Confidential and proprietary New scenarios
  23. 23. Indoor Wayfinding
  24. 24. Augmented reality
  25. 25. Measurement
  26. 26. get.google.com/tango/developers/ What’s next? Playlist: https://goo.gl/mmC3JA github.com/googlesamples/tango-examples-java plus.google.com/communities/114537896428695886568
  27. 27. Twitter: @mik3lantoniO Facebook: mikelantonio Mail: mikelantonio.trizio@gmail.com Google+: +MichelantonioTrizio Github: mikelantonio Contatti
  28. 28. Thank you :) and now Feedback Form!!! https://goo.gl/txE734 Mike Trizio @mik3lantoniO

×