예제 #1
0
func main() {
	bebop := client.New()

	if err := bebop.Connect(); err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println("hull")
	bebop.HullProtection(true)
	//fmt.Println("outdoor")
	//bebop.Outdoor(false)

	fmt.Println("takeoff")
	if err := bebop.TakeOff(); err != nil {
		fmt.Println(err)
		fmt.Println("fail")
		return
	}
	<-time.After(5 * time.Second)
	fmt.Println("land")
	if err := bebop.Land(); err != nil {
		fmt.Println(err)
		return
	}

	<-time.After(5 * time.Second)
	fmt.Println("done")
}
예제 #2
0
// NewBebopAdaptor returns a new BebopAdaptor
func NewBebopAdaptor(name string) *BebopAdaptor {
	return &BebopAdaptor{
		name:  name,
		drone: client.New(),
		connect: func(a *BebopAdaptor) error {
			return a.drone.Connect()
		},
	}
}
예제 #3
0
파일: video.go 프로젝트: aryanugroho/gobot
func main() {
	bebop := client.New()

	if err := bebop.Connect(); err != nil {
		fmt.Println(err)
		return
	}

	ffmpeg := exec.Command("ffmpeg", "-i", "pipe:0", "http://localhost:8090/bebop.ffm")

	ffmpegErr, err := ffmpeg.StderrPipe()

	if err != nil {
		fmt.Println(err)
		return
	}

	ffmpegIn, err := ffmpeg.StdinPipe()

	if err != nil {
		fmt.Println(err)
		return
	}

	if err := ffmpeg.Start(); err != nil {
		fmt.Println(err)
		return
	}

	go func() {
		for {
			buf, err := ioutil.ReadAll(ffmpegErr)
			if err != nil {
				fmt.Println(err)
			}
			if len(buf) > 0 {
				fmt.Println(string(buf))
			}
		}
	}()

	go func() {
		for {
			if _, err := ffmpegIn.Write(<-bebop.Video()); err != nil {
				fmt.Println(err)
			}
		}
	}()

	<-time.After(99 * time.Second)
}