Developing for Leap Motion
Upcoming SlideShare
Loading in...5
×
 

Developing for Leap Motion

on

  • 20,515 views

Developing for Leap Motion ...

Developing for Leap Motion

DotnetConf session here: http://www.youtube.com/watch?v=YixzSUxyGKU ( 1 hour)

Video tutorial can be found here:

Developing for Leap Motion in C# Part 1: http://www.youtube.com/watch?v=1Rn3q75mdns
Developing for Leap Motion in C# Part 2: http://www.youtube.com/watch?v=-r_cAtHQzy8

GitHub repository for the Leap Motion demo app: https://github.com/IrisClasson/Leap-Motion/

Slides: http://www.slideshare.net/irisdanielaclasson/developing-for-leap-motion/

Statistics

Views

Total Views
20,515
Views on SlideShare
5,510
Embed Views
15,005

Actions

Likes
4
Downloads
260
Comments
0

22 Embeds 15,005

http://irisclasson.com 11061
http://www.irisclasson.com 3828
http://www.linkedin.com 28
http://www.newsblur.com 23
https://www.linkedin.com 16
http://translate.googleusercontent.com 15
http://webcache.googleusercontent.com 8
https://twitter.com 7
http://tubemote.com 3
http://hannuri.tistory.com 2
http://www.google.co.il 2
http://dev.newsblur.com 2
http://131.253.14.125 1
http://www.google.de 1
http://131.253.14.98 1
http://131.253.14.66 1
https://www.google.fr 1
http://www.gmodules.com 1
http://us-mg6.mail.yahoo.com 1
https://www.google.com 1
http://www.goread.io 1
https://www.google.co.uk 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Developing for Leap Motion Developing for Leap Motion Presentation Transcript

  • Taking the Leap withLeap MotionIris Classon
  • About me• Technical Evangelist at Telerik (WinRT)• Software Developer at Dotnet Mentor• Microsoft MVP C# and member of MEET• MCSD, MCPD, MCTS• Organizer Sweden Pluralsight Study Group (Gothenburg)• Started learning programming from 0 summer 2011• Licensed clinical Dietitian and Int.Lic. Personal Trainer
  • Contact details• www.irisclasson.com• Twitter• @IrisClasson• Email• Telerik – iris.classon@telerik.com• Dotnet Mentor – iris.classon@dotnetmentor.se View slide
  • What is the Leap Motion? View slide
  • To get started• Mac, Windows, Linux (latest OS – more or less)• Developer Unit of Leap Motion• Preorder or apply to get one• Purchase: release projected for 22nd of July• https://www.leapmotion.com/• SDK• Can’t be shared• Forum, samples and documentation available• Projects on GitHub• Breaking changes introduced between SDK versions- might need to update the code
  • Good to know• Still in Beta• Developer units vs. consumer units:• The size and weight• Final hardware components & casing• Field of view approx 20% wider in consume version
  • Do not forget• Dispose Frame object when done with it• RemoveListener from Controller when app closes• Dispose Controller afterwards• Add Leap.DLL, LeapCSHarp.DLL &LeapCSHarp.NET4.0.DLL• Set copy output to Copy Always• Reference the LeapCSHarp.NET4.0.DLL
  • When in trouble w. the device• USB-cable has been known to cause trouble• Change USB port and/or cable• Connect the Leap before running the executable• Make sure there is light and the device is clean• Calibrate screen• Use the Leap Vizualiser to check if it works
  • The Leap story• Small startup based in San Fransisco• Venture capital• Has grown from just a few people to 80 employees and still hiring• Asus and HP on board• 40 000 Devs signed up• 12 000 dev units shipped so far• Still shipping
  • Demo
  • The Airspace Store• Storefront to gather all the apps• Dev decides on pricing, distribution & platform supported• Non-exclusive distribution• Min price starts at jus below 1 USD• Industry standard at 70% to the developer• Apps manually tested before publishing
  • Available languages• C++• C#• Objective C• Java• Python• JavaScript• (Ruby => hack)
  • How the API works• Leap motion detects fingers/tools• Data captured as frames continously• Listener class handles events from the Frame class• Controller is the connection between device and app• To listen for the updates on the Frame data:controller.AddListener(listener)• Gestures must be enabled through the controllercontroller.EnableGesture(Gesture.GestureType.TYPESWIPE)
  • ID,Timestamp,Hands,Fingers,Tools,GesturesFrameTranslation,RotationAxis,RotationAngle,ScalefactorMotion factors
  • Code – C#class SampleListener : Listenerpublic override void OnFrame(Controller controller){// Get the most recent frame and report some basic informationFrame frame = controller.Frame();SafeWriteLine("Frame id: " + frame.Id+ ", timestamp: " + frame.Timestamp+ ", hands: " + frame.Hands.Count+ ", fingers: " + frame.Fingers.Count+ ", tools: " + frame.Tools.Count+ ", gestures: " + frame.Gestures().Count);if (!frame.Hands.Empty){// Get the first handHand hand = frame.Hands[0];// Check if the hand has any fingersFingerList fingers = hand.Fingers;if (!fingers.Empty){// Calculate the hands average finger tip positionVector avgPos = fingers.Aggregate(Vector.Zero, (current, finger) => current + finger.TipPosition);avgPos /= fingers.Count;SafeWriteLine("Hand has " + fingers.Count + " fingers, average finger tip position: " + avgPos);} ………private static void Main(string[] args){var listener = new SampleListener();var controller = new Controller();controller.AddListener(listener);// Remove the sample listener when donecontroller.RemoveListener(listener);controller.Dispose();}
  • Code – JavaScript// Display Frame object datavar frameOutput = document.getElementById("frameData");var frameString = "Frame ID: " + frame.id + "<br />"+ "Timestamp: " + frame.timestamp + " &micro;s<br />"+ "Hands: " + frame.hands.length + "<br />"+ "Fingers: " + frame.fingers.length + "<br />"+ "Tools: " + frame.tools.length + "<br />"+ "Gestures: " + frame.gestures.length + "<br />";// Frame motion factorsif (previousFrame) {var translation = frame.translation(previousFrame);frameString += "Translation: " + vectorToString(translation) + " mm <br />";var rotationAxis = frame.rotationAxis(previousFrame);var rotationAngle = frame.rotationAngle(previousFrame);frameString += "Rotation axis: " + vectorToString(rotationAxis, 2) + "<br />";frameString += "Rotation angle: " + rotationAngle.toFixed(2) + " radians<br />";……// Setup Leap loop with frame callback functionvar controllerOptions = {enableGestures: true};Leap.loop(controllerOptions, function(frame) {// Body of callback function})
  • Making sense of movement
  • The screenScreen class- contains computer screeninformation- Position, orientation & vectorLeap/PC- Information from OSCan be invalidDevice should to be calibratedwith the screen
  • The tool• Based on:• Length• Shape• Width
  • The gestures• Predifined gestures:• Circle• Swipe• Key Tap (downward movement)• Screen Tap (forward movement)Turn, twist and tilt – and fist• Use Motion factors from frame class• Translation,• RotationAxis,• RotationAngle,• Scalefactor
  • UX guidelines• Avoid complexity• Use what is considered natural• Think outside the box• Positive experience for the user• Feedback• No clutter• Desctructive action• Navigation and interaction – keep them apart
  • Q and AInfra red light safety concerns• IR occours naturally in the physical world• Widely used in a variety of devices• No health risk found with general exposure of IRUsing Leap as a mouse out of the box• Developer unit no, consumer unit yes• CPU usage• Will be lower when released• New updates ’inactivates’ the device when not used, activated when it registersmotion
  • Thank youIris Classon