ikerhurtado.com
You're in
Iker Hurtado's pro blog
Developer | Entrepreneur | Investor
Software engineer (entrepreneur and investor at times). These days doing performant frontend and graphics on the web platform at Barcelona Supercomputing Center

Some notes on Leap Motion JavaScript Programming

6 Apr 2016   |   iker hurtado  
Share on Twitter Share on Google+ Share on Facebook
I've done a brief inquiry on Leap Motion product programming and I write down some findings here.

The main conclusion is that both the documentation and the product software (SDK, libs, tools) are good. It's easy to get started on any operating system.

The API is a high level one enabling us to get results soon with our application.

I extract some interesting info from the product documentation:

System Architecture

The Leap Motion software runs as a service (on Windows) or daemon (on Mac and Linux). The software connects to the Leap Motion Controller device over the USB bus. Leap-enabled applications access the Leap Motion service to receive motion tracking data. The Leap Motion SDK provides two varieties of API for getting the Leap Motion data: a native interface and a WebSocket interface. These APIs enable you to create Leap-enabled applications in several programming languages including JavaScript running in a browser environment.

WebSocket Interface

The Leap Motion service runs a WebSocket server on the localhost domain at port 6437. The WebSocket interface provides tracking data in the form of JSON messages. A JavaScript client library (leap.js) is available that consumes the JSON messages and presents the tracking data as regular JavaScript objects.

(...)

All the library, code, and header files required to develop Leap-enabled applications and plugins are included in the Leap Motion SDK, except the leap.js client JavaScript library. You can download the Leap Motion SDK from the Leap Motion Developer Portal. An SDK package is available for each supported operating system. The JavaScript client library is distributed separately and can be downloaded from the LeapJS GitHub repository.

Getting started

The steps I took (Ubuntu 14.04) to get this working:

1. Download the SDK : https://developer.leapmotion.com/v2

2. Install the package.

In the downloaded folder type:

sudo dpkg --install Leap-*-x64.deb 

All Leap Motion software is installed now; the control panel included. You can run it:

LeapControlPanel 

It's possible to check if the software (service or daemon) is working.

3. We can create a simple web page that uses the JavaScript library (leap.js) inserting the script:

http://js.leapmotion.com/leap-0.6.3.min.js

There is very good documentation explaining the JavaScript API:
Hello World — Leap Motion JavaScript SDK v2.3 documentation
Getting Started Javascript | Leap Motion Developers

POST A COMMENT: