hybridgroup.gobot/platforms/ardrone
Adrian Zankich 9a0f3b46f7 Refactor ardrone to use new driver and adaptor interfaces 2014-11-22 18:56:23 -08:00
..
LICENSE WIP project restructure 2014-04-29 13:20:32 -07:00
README.md Update READMEs 2014-07-10 17:02:00 -07:00
ardrone_adaptor.go Refactor ardrone to use new driver and adaptor interfaces 2014-11-22 18:56:23 -08:00
ardrone_adaptor_test.go Refactor ardrone to use new driver and adaptor interfaces 2014-11-22 18:56:23 -08:00
ardrone_driver.go Refactor ardrone to use new driver and adaptor interfaces 2014-11-22 18:56:23 -08:00
ardrone_driver_test.go Refactor ardrone to use new driver and adaptor interfaces 2014-11-22 18:56:23 -08:00
doc.go Update docs 2014-10-28 14:52:59 -07:00
test_helper.go Make golint happy 2014-06-10 15:16:11 -07:00

README.md

Ardrone

This package provides the Gobot adaptor and driver for the Parrot Ardrone.

For more information about Gobot, check out the github repo at https://github.com/hybridgroup/gobot

Getting Started

Installing

go get github.com/hybridgroup/gobot && go install github.com/hybridgroup/gobot/platforms/ardrone

Using

package main

import (
	"time"

	"github.com/hybridgroup/gobot"
	"github.com/hybridgroup/gobot/platforms/ardrone"
)

func main() {
	gbot := gobot.NewGobot()

	ardroneAdaptor := ardrone.NewArdroneAdaptor("Drone")
	drone := ardrone.NewArdroneDriver(ardroneAdaptor, "Drone")

	work := func() {
		drone.TakeOff()
		gobot.On(drone.Event("flying"), func(data interface{}) {
			gobot.After(3*time.Second, func() {
				drone.Land()
			})
		})
	}

	robot := gobot.NewRobot("drone",
		[]gobot.Connection{ardroneAdaptor},
		[]gobot.Device{drone},
		work,
	)
	gbot.AddRobot(robot)

	gbot.Start()
}