README ¶
Bebop
The Parrot Bebop and Parrot Bebop 2 are inexpensive quadcopters that can be controlled using their built-in API commands via a WiFi connection. They include a built-in front-facing HD video camera, as well as a second lower resolution bottom-facing video camera.
How to Install
go get -d -u gobot.io/x/gobot/...
How to Use
package main
import (
"time"
"gobot.io/x/gobot"
"gobot.io/x/gobot/platforms/parrot/bebop"
)
func main() {
bebopAdaptor := bebop.NewAdaptor()
drone := bebop.NewDriver(bebopAdaptor)
work := func() {
drone.HullProtection(true)
drone.TakeOff()
gobot.On(drone.Event("flying"), func(data interface{}) {
gobot.After(3*time.Second, func() {
drone.Land()
})
})
}
robot := gobot.NewRobot("drone",
[]gobot.Connection{bebopAdaptor},
[]gobot.Device{drone},
work,
)
robot.Start()
}
How to Connect
By default, the Parrot Bebop is a WiFi access point, so there is no additional work to establish a connection to a single drone, you just connect to it.
Once connected, if you want to stream drone video you can either:
- Use the RTP protocol with an external player such as mplayer or VLC.
- Grab the video frames from the drone's data frames, and work with them directly.
Documentation ¶
Overview ¶
Package bebop provides the Gobot adaptor and driver for the Parrot Bebop.
Installing:
go get -d -u gobot.io/x/gobot/... && go install gobot.io/x/gobot/platforms/parrot/bebop
For more information refer to the bebop README: https://github.com/hybridgroup/gobot/tree/master/platforms/parrot/bebop/README.md
Index ¶
- Constants
- func ValidatePitch(data float64, offset float64) int
- type Adaptor
- type Driver
- func (a *Driver) Backward(speed int)
- func (a *Driver) Clockwise(speed int)
- func (a *Driver) Connection() gobot.Connection
- func (a *Driver) CounterClockwise(speed int)
- func (a *Driver) Down(speed int)
- func (a *Driver) Forward(speed int)
- func (a *Driver) Halt() (err error)
- func (a *Driver) HullProtection(protect bool) error
- func (a *Driver) Land()
- func (a *Driver) Left(speed int)
- func (a *Driver) Name() string
- func (a *Driver) Outdoor(outdoor bool) error
- func (a *Driver) Right(speed int)
- func (a *Driver) SetName(n string)
- func (a *Driver) Start() (err error)
- func (a *Driver) StartRecording() error
- func (a *Driver) Stop()
- func (a *Driver) StopRecording() error
- func (a *Driver) TakeOff()
- func (a *Driver) Up(speed int)
- func (a *Driver) Video() chan []byte
- func (a *Driver) VideoEnable(enable bool) error
- func (a *Driver) VideoStreamMode(mode int8) error
Constants ¶
const (
// Flying event
Flying = "flying"
)
Variables ¶
This section is empty.
Functions ¶
func ValidatePitch ¶ added in v1.2.0
ValidatePitch helps validate pitch values such as those created by a joystick to values between 0-100 that are required as params to Parrot Bebop PCMDs
Types ¶
type Adaptor ¶
type Adaptor struct {
// contains filtered or unexported fields
}
Adaptor is gobot.Adaptor representation for the Bebop
type Driver ¶
Driver is gobot.Driver representation for the Bebop
func (*Driver) Backward ¶
Backward causes the drone go forward, controls the pitch. speed can be a value from `0` to `100`.
func (*Driver) Clockwise ¶
Clockwise causes the drone to spin in clockwise direction speed can be a value from `0` to `100`.
func (*Driver) Connection ¶
func (a *Driver) Connection() gobot.Connection
Connection returns the Bebop Drivers Connection
func (*Driver) CounterClockwise ¶
CounterClockwise the drone to spin in counter clockwise direction speed can be a value from `0` to `100`.
func (*Driver) Forward ¶
Forward causes the drone go forward, controls the pitch. speed can be a value from `0` to `100`.
func (*Driver) HullProtection ¶
HullProtection tells the drone if the hull/prop protectors are attached. This is needed to adjust flight characteristics of the Bebop.
func (*Driver) Left ¶
Left causes the drone to bank to the left, controls the roll, which is a horizontal movement using the camera as a reference point. speed can be a value from `0` to `100`.
func (*Driver) Outdoor ¶
Outdoor tells the drone if flying Outdoor or not. This is needed to adjust flight characteristics of the Bebop.
func (*Driver) Right ¶
Right causes the drone to bank to the right, controls the roll, which is a horizontal movement using the camera as a reference point. speed can be a value from `0` to `100`.
func (*Driver) StartRecording ¶
StartRecording starts the recording video to the drones interal storage
func (*Driver) StopRecording ¶
StopRecording stops a previously started recording
func (*Driver) VideoEnable ¶ added in v1.1.0
VideoEnable tells the drone to start/stop streaming video
func (*Driver) VideoStreamMode ¶ added in v1.1.0
VideoStreamMode tells the drone what mode to use for streaming video