44 lines
673 B
Go
44 lines
673 B
Go
//go:build example
|
|
// +build example
|
|
|
|
//
|
|
// Do not build by default.
|
|
|
|
/*
|
|
How to run:
|
|
Connect to the drone's Wi-Fi network from your computer. It will be named something like "TELLO-XXXXXX".
|
|
|
|
Once you are connected you can run the Gobot code on your computer to control the drone.
|
|
|
|
go run examples/tello.go
|
|
*/
|
|
|
|
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gobot.io/x/gobot/v2"
|
|
"gobot.io/x/gobot/v2/platforms/dji/tello"
|
|
)
|
|
|
|
func main() {
|
|
drone := tello.NewDriver("8888")
|
|
|
|
work := func() {
|
|
drone.TakeOff()
|
|
|
|
gobot.After(5*time.Second, func() {
|
|
drone.Land()
|
|
})
|
|
}
|
|
|
|
robot := gobot.NewRobot("tello",
|
|
[]gobot.Connection{},
|
|
[]gobot.Device{drone},
|
|
work,
|
|
)
|
|
|
|
robot.Start()
|
|
}
|