1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-24 13:48:49 +08:00
Thomas Kohler 0d0a508c60
core(build): CLI removed (#946)
* core(build): CLI removed
* adjust install instructions in doc and README
* fix master_test and remove useless/duplicated tests examples_test.go
2023-06-04 18:36:55 +02:00

68 lines
1.6 KiB
Markdown

# 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](https://www.leapmotion.com/)
## How to Install
Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md)
First install the [Leap Motion Software](https://www.leapmotion.com/setup)
## How to Use
```go
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,
)
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](https://www.leapmotion.com/setup).
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](https://developer.leapmotion.com/downloads)
(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