bebop

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2016 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

README

Bebop

The Bebop from Parrot is an inexpensive quadcopter that is controlled using WiFi. It includes 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 github.com/hybridgroup/gobot/... && go install github.com/hybridgroup/gobot/platforms/bebop

How to Use

package main

import (
	"time"

	"github.com/hybridgroup/gobot"
	"github.com/hybridgroup/gobot/platforms/bebop"
)

func main() {
	gbot := gobot.NewGobot()

	bebopAdaptor := bebop.NewBebopAdaptor("Drone")
	drone := bebop.NewBebopDriver(bebopAdaptor, "Drone")

	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,
	)
	gbot.AddRobot(robot)

	gbot.Start()
}

How to Connect

The Bebop is a WiFi device, so there is no additional work to establish a connection to a single drone. However, in order to connect to multiple drones, you need to perform some configuration steps on each drone via SSH.

Documentation

Overview

Package bebop provides the Gobot adaptor and driver for the Parrot Bebop.

Installing:

go get -d -u github.com/hybridgroup/gobot/... && go install github.com/hybridgroup/gobot/platforms/bebop

For more information refer to the bebop README: https://github.com/hybridgroup/gobot/tree/master/platforms/bebop

Index

Constants

View Source
const (
	// Flying event
	Flying = "flying"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BebopAdaptor

type BebopAdaptor struct {
	// contains filtered or unexported fields
}

BebopAdaptor is gobot.Adaptor representation for the Bebop

func NewBebopAdaptor

func NewBebopAdaptor(name string) *BebopAdaptor

NewBebopAdaptor returns a new BebopAdaptor

func (*BebopAdaptor) Connect

func (a *BebopAdaptor) Connect() (errs []error)

Connect establishes a connection to the ardrone

func (*BebopAdaptor) Finalize

func (a *BebopAdaptor) Finalize() (errs []error)

Finalize terminates the connection to the ardrone

func (*BebopAdaptor) Name

func (a *BebopAdaptor) Name() string

Name returns the BebopAdaptors Name

type BebopDriver

type BebopDriver struct {
	gobot.Eventer
	// contains filtered or unexported fields
}

BebopDriver is gobot.Driver representation for the Bebop

func NewBebopDriver

func NewBebopDriver(connection *BebopAdaptor, name string) *BebopDriver

NewBebopDriver creates an BebopDriver with specified name.

func (*BebopDriver) Backward

func (a *BebopDriver) Backward(speed int)

Backward causes the drone go forward, controls the pitch. speed can be a value from `0` to `100`.

func (*BebopDriver) Clockwise

func (a *BebopDriver) Clockwise(speed int)

Clockwise causes the drone to spin in clockwise direction speed can be a value from `0` to `100`.

func (*BebopDriver) Connection

func (a *BebopDriver) Connection() gobot.Connection

Connection returns the BebopDrivers Connection

func (*BebopDriver) CounterClockwise

func (a *BebopDriver) CounterClockwise(speed int)

CounterClockwise the drone to spin in counter clockwise direction speed can be a value from `0` to `100`.

func (*BebopDriver) Down

func (a *BebopDriver) Down(speed int)

Down makes the drone reduce altitude. speed can be a value from `0` to `100`.

func (*BebopDriver) Forward

func (a *BebopDriver) Forward(speed int)

Forward causes the drone go forward, controls the pitch. speed can be a value from `0` to `100`.

func (*BebopDriver) Halt

func (a *BebopDriver) Halt() (errs []error)

Halt halts the BebopDriver

func (*BebopDriver) HullProtection

func (a *BebopDriver) HullProtection(protect bool) error

HullProtection tells the drone if the hull/prop protectors are attached. This is needed to adjust flight characteristics of the Bebop.

func (*BebopDriver) Land

func (a *BebopDriver) Land()

Land causes the drone to land

func (*BebopDriver) Left

func (a *BebopDriver) Left(speed int)

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 (*BebopDriver) Name

func (a *BebopDriver) Name() string

Name returns the BebopDrivers Name

func (*BebopDriver) Outdoor

func (a *BebopDriver) Outdoor(outdoor bool) error

Outdoor tells the drone if flying Outdoor or not. This is needed to adjust flight characteristics of the Bebop.

func (*BebopDriver) Right

func (a *BebopDriver) Right(speed int)

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 (*BebopDriver) Start

func (a *BebopDriver) Start() (errs []error)

Start starts the BebopDriver

func (*BebopDriver) StartRecording

func (a *BebopDriver) StartRecording() error

StartRecording starts the recording video to the drones interal storage

func (*BebopDriver) Stop

func (a *BebopDriver) Stop()

Stop makes the drone to hover in place.

func (*BebopDriver) StopRecording

func (a *BebopDriver) StopRecording() error

StopRecording stops a previously started recording

func (*BebopDriver) TakeOff

func (a *BebopDriver) TakeOff()

TakeOff makes the drone start flying

func (*BebopDriver) Up

func (a *BebopDriver) Up(speed int)

Up makes the drone gain altitude. speed can be a value from `0` to `100`.

func (*BebopDriver) Video

func (a *BebopDriver) Video() chan []byte

Video returns a channel which raw video frames will be broadcast on

Directories

Path Synopsis
examples
This example will connect to the Bebop and stream it's video to a webpage via ffserver.
This example will connect to the Bebop and stream it's video to a webpage via ffserver.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL