2014年9月24日 星期三

Leap Motion + Android

Introduction


Thanks for the hints of using node.js server as proxy. I have come up to a smooth acceptable solution to make LeapMotion work on Android (indirectly).

Pre-requisites


  - A PC or a Mac with npm as the "PROXY"
  - npm install binaryjs
  - npm install sleep
  - An Android device with Wi-fi capability ("DEVICE")
  - Leap Motion device ("LEAP MOTION") connected to the "PROXY"
  - Wi-fi LAN connection between the "DEVICE" and "PROXY"

The basic idea of this solution is to use the PROXY to make the impossible (Android+LeapMotion) to become possible. The PROXY will read the data from LEAP MOTION using the Javascript SDK and stream (ya, it's streaming rather than posting) the data to node.js instance running on it.

The DEVICE will connect to the PROXY and stream (ya, it's again streaming rather than polling) the hand position data and present it as a red circle on screen.

Step-by-step guide


1. Download the PROXY project here

2. Extract the project

3. Run in on your instance of node.js server on your PC or Mac (e.g. `node index.js`)

4. Mark down the IP of the PROXY

5. Open your browser (Chrome and Safari are proven working) and browse `http://localhost:5000` to verify it is running

6. Download the Android project for your DEVICE here

7. Import the project in ADT

8. Open strings.xml to modify the IP address to the IP address of PROXY

9. Run the project on YOUR DEVICE

10. Move your hand above the LEAP MOTION and see the red circle moving according to your hand's direction

Enjoy!

沒有留言:

張貼留言