bebop

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0, Apache-2.0, Apache-2.0 Imports: 3 Imported by: 0

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

Please refer to the main README.md

How to Use

package main

import (
  "time"

  "gobot.io/x/gobot/v2"
  "gobot.io/x/gobot/v2/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,
  )

  if err := robot.Start(); err != nil {
		panic(err)
	}
}

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:

Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md)

For more information refer to the bebop README: https://github.com/hybridgroup/gobot/blob/release/platforms/parrot/bebop/README.md

Index

Constants

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

Variables

This section is empty.

Functions

func ValidatePitch

func ValidatePitch(data float64, offset float64) int

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

func NewAdaptor

func NewAdaptor() *Adaptor

NewAdaptor returns a new BebopAdaptor

func (*Adaptor) Connect

func (a *Adaptor) Connect() error

Connect establishes a connection to the ardrone

func (*Adaptor) Finalize

func (a *Adaptor) Finalize() error

Finalize terminates the connection to the ardrone

func (*Adaptor) Name

func (a *Adaptor) Name() string

Name returns the Bebop adaptors Name

func (*Adaptor) SetName

func (a *Adaptor) SetName(n string)

SetName sets the Bebop adaptors Name

type Driver

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

Driver is gobot.Driver representation for the Bebop

func NewDriver

func NewDriver(connection *Adaptor) *Driver

NewDriver creates an Bebop Driver.

func (*Driver) Backward

func (a *Driver) Backward(speed int) error

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

func (*Driver) Clockwise

func (a *Driver) Clockwise(speed int) error

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

func (a *Driver) CounterClockwise(speed int) error

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

func (*Driver) Down

func (a *Driver) Down(speed int) error

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

func (*Driver) Forward

func (a *Driver) Forward(speed int) error

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

func (*Driver) Halt

func (a *Driver) Halt() error

Halt halts the Bebop Driver

func (*Driver) HullProtection

func (a *Driver) 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 (*Driver) Land

func (a *Driver) Land() error

Land causes the drone to land

func (*Driver) Left

func (a *Driver) Left(speed int) error

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) Name

func (a *Driver) Name() string

Name returns the Bebop Drivers Name

func (*Driver) Outdoor

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

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

func (*Driver) Right

func (a *Driver) Right(speed int) error

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) SetName

func (a *Driver) SetName(n string)

SetName sets the Bebop Drivers Name

func (*Driver) Start

func (a *Driver) Start() error

Start starts the Bebop Driver

func (*Driver) StartRecording

func (a *Driver) StartRecording() error

StartRecording starts the recording video to the drones interal storage

func (*Driver) Stop

func (a *Driver) Stop() error

Stop makes the drone to hover in place.

func (*Driver) StopRecording

func (a *Driver) StopRecording() error

StopRecording stops a previously started recording

func (*Driver) TakeOff

func (a *Driver) TakeOff()

TakeOff makes the drone start flying

func (*Driver) Up

func (a *Driver) Up(speed int) error

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

func (*Driver) Video

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

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

func (*Driver) VideoEnable

func (a *Driver) VideoEnable(enable bool) error

VideoEnable tells the drone to start/stop streaming video

func (*Driver) VideoStreamMode

func (a *Driver) VideoStreamMode(mode int8) error

VideoStreamMode tells the drone what mode to use for streaming video

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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