gobot.io/x/gobot@v1.16.0/examples/bebop_rtp_video.go (about)

     1  // +build example
     2  //
     3  // Do not build by default.
     4  
     5  /*
     6  	This example will connect to the Parrot Bebop and streams the drone video
     7  	via the RTP protocol.
     8  
     9  	In order to run this example you will first need to connect to the drone with:
    10  		$ go run bebop_ps3_video.go
    11  
    12  	then in a separate terminal run this program:
    13  
    14  		$ mplayer examples/bebop.sdp
    15  
    16  	You can view the video feed by navigating to
    17  	http://localhost:8090/bebop.mjpeg in a web browser.
    18  	*NOTE* firefox works best for viewing the video feed.
    19  */
    20  package main
    21  
    22  import (
    23  	"gobot.io/x/gobot"
    24  	"gobot.io/x/gobot/platforms/parrot/bebop"
    25  )
    26  
    27  func main() {
    28  	bebopAdaptor := bebop.NewAdaptor()
    29  	drone := bebop.NewDriver(bebopAdaptor)
    30  
    31  	work := func() {
    32  		drone.VideoEnable(true)
    33  	}
    34  
    35  	robot := gobot.NewRobot("drone",
    36  		[]gobot.Connection{bebopAdaptor},
    37  		[]gobot.Device{drone},
    38  		work,
    39  	)
    40  
    41  	robot.Start()
    42  }