hybridgroup.gobot/platforms/ardrone
Adrian Zankich abc1f0b201 Update platforms to support the new Driver and Adaptor interfaces 2014-11-16 12:25:48 -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 Update platforms to support the new Driver and Adaptor interfaces 2014-11-16 12:25:48 -08:00
ardrone_adaptor_test.go Update platforms to support the new Driver and Adaptor interfaces 2014-11-16 12:25:48 -08:00
ardrone_driver.go Update platforms to support the new Driver and Adaptor interfaces 2014-11-16 12:25:48 -08:00
ardrone_driver_test.go Update platforms to support the new Driver and Adaptor interfaces 2014-11-16 12:25:48 -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()
}