bebop: add support/example of RTP video
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
12c12517e3
commit
e828f5617d
|
@ -0,0 +1,3 @@
|
|||
c=IN IP4 192.168.42.1
|
||||
m=video 55004 RTP/AVP 96
|
||||
a=rtpmap:96 H264/90000
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
This example will connect to the Parrot Bebop and streams the drone video
|
||||
via the RTP protocol.
|
||||
|
||||
In order to run this example you will first need to connect to the drone with:
|
||||
$ go run bebop_ps3_video.go
|
||||
|
||||
then in a separate terminal run this program:
|
||||
|
||||
$ mplayer examples/bebop.sdp
|
||||
|
||||
You can view the video feed by navigating to
|
||||
http://localhost:8090/bebop.mjpeg in a web browser.
|
||||
*NOTE* firefox works best for viewing the video feed.
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"gobot.io/x/gobot"
|
||||
"gobot.io/x/gobot/platforms/parrot/bebop"
|
||||
)
|
||||
|
||||
func main() {
|
||||
bebopAdaptor := bebop.NewAdaptor()
|
||||
drone := bebop.NewDriver(bebopAdaptor)
|
||||
|
||||
work := func() {
|
||||
drone.VideoEnable(true)
|
||||
}
|
||||
|
||||
robot := gobot.NewRobot("drone",
|
||||
[]gobot.Connection{bebopAdaptor},
|
||||
[]gobot.Device{drone},
|
||||
work,
|
||||
)
|
||||
|
||||
robot.Start()
|
||||
}
|
|
@ -161,6 +161,8 @@ type Bebop struct {
|
|||
tmpFrame tmpFrame
|
||||
C2dPort int
|
||||
D2cPort int
|
||||
RTPStreamPort int
|
||||
RTPControlPort int
|
||||
DiscoveryPort int
|
||||
c2dClient *net.UDPConn
|
||||
d2cClient *net.UDPConn
|
||||
|
@ -176,6 +178,8 @@ func New() *Bebop {
|
|||
NavData: make(map[string]string),
|
||||
C2dPort: 54321,
|
||||
D2cPort: 43210,
|
||||
RTPStreamPort: 55004,
|
||||
RTPControlPort: 55005,
|
||||
DiscoveryPort: 44444,
|
||||
networkFrameGenerator: networkFrameGenerator(),
|
||||
Pcmd: Pcmd{
|
||||
|
@ -212,11 +216,16 @@ func (b *Bebop) Discover() error {
|
|||
|
||||
b.discoveryClient.Write(
|
||||
[]byte(
|
||||
`{
|
||||
"controller_type": "computer",
|
||||
"controller_name": "go-bebop",
|
||||
"d2c_port": "43210"
|
||||
}`,
|
||||
fmt.Sprintf(`{
|
||||
"controller_type": "computer",
|
||||
"controller_name": "go-bebop",
|
||||
"d2c_port": "%d",
|
||||
"arstream2_client_stream_port": "%d",
|
||||
"arstream2_client_control_port": "%d",
|
||||
}`,
|
||||
b.D2cPort,
|
||||
b.RTPStreamPort,
|
||||
b.RTPControlPort),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue