package
1.13.0
Repository: https://github.com/danielfallon/gobot.git
Documentation: pkg.go.dev

# README

Leap

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 Leap Motion

How to Install

First install the Leap Motion Software

Now you can install the package with:

go get -d -u gobot.io/x/gobot/...

How to Use

package main

import (
	"fmt"

	"gobot.io/x/gobot"
	"gobot.io/x/gobot/platforms/leap"
)

func main() {
	leapMotionAdaptor := leap.NewAdaptor("127.0.0.1:6437")
	l := leap.NewDriver(leapMotionAdaptor)

	work := func() {
		l.On(l.Event("message"), func(data interface{}) {
			fmt.Println(data.(leap.Frame))
		})
	}

	robot := gobot.NewRobot("leapBot",
		[]gobot.Connection{leapMotionAdaptor},
		[]gobot.Device{l},
		work,
	)

	robot.Start()
}

How To Connect

OSX

This driver works out of the box with the vanilla installation of the Leap Motion Software that you get in their Setup Guide.

The main steps are:

  • Run Leap Motion.app to open a websocket connection in port 6437.
  • Connect your Computer and Leap Motion Controller.
  • Connect to the device via Gobot.

Ubuntu

The Linux download of the Leap Motion software can be obtained from Leap Motion Dev Center (requires free signup)

The main steps are:

  • 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 Gobot

# Functions

NewAdaptor creates a new leap motion adaptor using specified port, which is this case is the host IP or name of the Leap Motion daemon.
NewDriver creates a new leap motion driver Adds the following events: "message" - Gets triggered when receiving a message from leap motion "hand" - Gets triggered per-message when leap motion detects a hand "gesture" - Gets triggered per-message when leap motion detects a gesture.

# Constants

GestureEvent event.
HandEvent event.
MessageEvent event.

# Structs

Adaptor is the Gobot Adaptor connection to the Leap Motion.
Driver the Gobot software device to the Leap Motion.
Frame is the base representation returned that holds every other objects.
Gesture is a Leap Motion gesture that has been detected.
Hand is a Leap Motion hand that has been detected.
InteractionBox is the area within which the gestural interaction has been detected.
Pointable is a Leap Motion pointing motion that has been detected.