hybridgroup.gobot/platforms/ardrone
Adrian Zankich 1d24bd8866 Update READMEs 2014-07-10 17:02:00 -07:00
..
docs WIP project restructure 2014-04-29 13:20:32 -07: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 ardrone package 2014-07-07 16:03:14 -07:00
ardrone_adaptor_test.go Refactor ardrone driver 2014-06-14 13:55:12 -07:00
ardrone_driver.go Clean up drivers 2014-07-09 18:32:27 -07:00
ardrone_driver_test.go Update test formatting 2014-06-13 16:01:39 -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()
}