2014-10-16 05:43:38 +08:00
|
|
|
/*
|
2014-10-29 05:52:59 +08:00
|
|
|
Package ardrone provides the Gobot adaptor and driver for the Parrot Ardrone.
|
2014-10-16 05:43:38 +08:00
|
|
|
|
|
|
|
Installing:
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
go get -d -u gobot.io/x/gobot/... && go install gobot.io/x/gobot/platforms/parrot/ardrone
|
2014-10-16 05:43:38 +08:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2016-12-08 20:24:03 +08:00
|
|
|
"gobot.io/x/gobot"
|
|
|
|
"gobot.io/x/gobot/platforms/parrot/ardrone"
|
2014-10-16 05:43:38 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-09-25 17:46:55 +08:00
|
|
|
ardroneAdaptor := ardrone.NewAdaptor()
|
|
|
|
drone := ardrone.NewDriver(ardroneAdaptor)
|
2014-10-16 05:43:38 +08:00
|
|
|
|
|
|
|
work := func() {
|
|
|
|
drone.TakeOff()
|
2016-10-17 14:43:04 +08:00
|
|
|
drone.On(drone.Event("flying"), func(data interface{}) {
|
2014-10-16 05:43:38 +08:00
|
|
|
gobot.After(3*time.Second, func() {
|
|
|
|
drone.Land()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
robot := gobot.NewRobot("drone",
|
|
|
|
[]gobot.Connection{ardroneAdaptor},
|
|
|
|
[]gobot.Device{drone},
|
|
|
|
work,
|
|
|
|
)
|
|
|
|
|
2016-10-19 03:37:10 +08:00
|
|
|
robot.Start()
|
2014-10-16 05:43:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
For more information refer to the ardrone README:
|
2016-12-21 17:54:30 +08:00
|
|
|
https://github.com/hybridgroup/gobot/tree/master/platforms/parrot/ardrone/README.md
|
2014-10-16 05:43:38 +08:00
|
|
|
*/
|
2016-12-08 20:24:03 +08:00
|
|
|
package ardrone // import "gobot.io/x/gobot/platforms/parrot/ardrone"
|