Leapmotion


Repository| Issues

The Leap Motion is a user-interface device that tracks the user's hand motions, and translates them into events that can control robots and physical computing hardware.

For more info about the Leap Motion platform click here.

How to Install

Install the module via NPM:

npm install cylon cylon-leapmotion

In order to use this module, you need to install the Leap Motion driver/SDK from the Leap Motion site.

Inside Leap Motion's setup, ensure "Allow Web Apps" and "Allow Background Apps" are both checked.

How to Use

This basic program uses a Leap Motion to detect the user's hand position:

var Cylon = require('cylon');

Cylon.robot({
  connections: {
    leapmotion: { adaptor: 'leapmotion' }
  },

  devices: {
    leapmotion: { driver: 'leapmotion' }
  },

  work: function(my) {
    my.leapmotion.on('hand', function(payload) {
      Logger.info(payload.toString());
    });
  }
}).start();

How to Connect

OS X

Our driver works out-of-the-box with the vanilla installation of the Leap Motion software.

Ubuntu

The Linux download of the Leap Motion software can be obtained from the Leap Motion Dev Center.

To make sure everything's working:

  • Run the leapd daemon to open a websocket connection in port 6437.
  • Connect your computer and the Leap Motion controller
  • Connect to the device via Cylon.js

Connecting To Another Machine

By default, cylon-leapmotion attempts to connect to the LeapMotion websocket server running on localhost. You can, however, provide it with another IP in the connection object and it'll attempt to connect to that instead:

connections: {
  leapmotion: { adaptor: 'leapmotion', host: '192.168.1.64' }
}

Drivers

There is only one driver for the Leap Motion platform as listed below.