hybridgroup.gobot/platforms/leap
Thomas Kohler d2b01b99e0
examples: fix missing checks of return values (#1060)
2024-02-11 15:34:50 +01:00
..
test/support Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
LICENSE Build(v2): revert move to v2 subfolder (#932) 2023-05-29 19:23:28 +02:00
README.md examples: fix missing checks of return values (#1060) 2024-02-11 15:34:50 +01:00
doc.go examples: fix missing checks of return values (#1060) 2024-02-11 15:34:50 +01:00
leap_motion_adaptor.go lint(all): fix issues of errorlint etc (#1037) 2023-11-15 20:51:52 +01:00
leap_motion_adaptor_test.go lint(all): fix issues of errorlint etc (#1037) 2023-11-15 20:51:52 +01:00
leap_motion_driver.go lint(all): fix issues of errorlint etc (#1037) 2023-11-15 20:51:52 +01:00
leap_motion_driver_test.go lint(all): fix issues of errorlint etc (#1037) 2023-11-15 20:51:52 +01:00
parser.go all(style) : fix linter issues for errcheck, ineffassign, unused and fix errors (#950) 2023-06-12 19:51:25 +02:00

README.md

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

Please refer to the main README.md

First install the Leap Motion Software

How to Use

package main

import (
  "fmt"

  "gobot.io/x/gobot/v2"
  "gobot.io/x/gobot/v2/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,
  )

  if err := robot.Start(); err != nil {
		panic(err)
	}
}

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