gobot: gobot.io/x/gobot/platforms/parrot/ardrone Index | Files

package ardrone

import "gobot.io/x/gobot/platforms/parrot/ardrone"

Package ardrone provides the Gobot adaptor and driver for the Parrot Ardrone.

Installing:

go get -d -u gobot.io/x/gobot/... && go install gobot.io/x/gobot/platforms/parrot/ardrone

Example:

package main

import (
	"time"

	"gobot.io/x/gobot"
	"gobot.io/x/gobot/platforms/parrot/ardrone"
)

func main() {
	ardroneAdaptor := ardrone.NewAdaptor()
	drone := ardrone.NewDriver(ardroneAdaptor)

	work := func() {
		drone.TakeOff()
		drone.On(drone.Event("flying"), func(data interface{}) {
			gobot.After(3*time.Second, func() {
				drone.Land()
			})
		})
	}

	robot := gobot.NewRobot("drone",
		[]gobot.Connection{ardroneAdaptor},
		[]gobot.Device{drone},
		work,
	)

	robot.Start()
}

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

Index

Package Files

ardrone_adaptor.go ardrone_driver.go doc.go pitch.go test_helper.go

Constants

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

func ValidatePitch Uses

func ValidatePitch(data float64, offset float64) float64

ValidatePitch helps validate pitch values such as those created by a joystick to values between 0-1.0 that are required as params to Parrot ARDrone PCMDs

type Adaptor Uses

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

Adaptor is gobot.Adaptor representation for the Ardrone

func NewAdaptor Uses

func NewAdaptor(v ...string) *Adaptor

NewAdaptor returns a new ardrone.Adaptor and optionally accepts:

string: The ardrones IP Address

func (*Adaptor) Connect Uses

func (a *Adaptor) Connect() (err error)

Connect establishes a connection to the ardrone

func (*Adaptor) Finalize Uses

func (a *Adaptor) Finalize() (err error)

Finalize terminates the connection to the ardrone

func (*Adaptor) Name Uses

func (a *Adaptor) Name() string

Name returns the Adaptor Name

func (*Adaptor) SetName Uses

func (a *Adaptor) SetName(n string)

SetName sets the Adaptor Name

type Driver Uses

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

Driver is gobot.Driver representation for the Ardrone

func NewDriver Uses

func NewDriver(connection *Adaptor) *Driver

NewDriver creates an Driver for the ARDrone.

It add the following events:

'flying' - Sent when the device has taken off.

func (*Driver) Backward Uses

func (a *Driver) Backward(speed float64)

Backward causes the drone go backward, controls the pitch. speed can be a value from `0.0` to `1.0`.

func (*Driver) Clockwise Uses

func (a *Driver) Clockwise(speed float64)

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

func (*Driver) Connection Uses

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

Connection returns the Driver Connection

func (*Driver) CounterClockwise Uses

func (a *Driver) CounterClockwise(speed float64)

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

func (*Driver) Down Uses

func (a *Driver) Down(speed float64)

Down makes the drone reduce altitude. speed can be a value from `0.0` to `1.0`.

func (*Driver) Forward Uses

func (a *Driver) Forward(speed float64)

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

func (*Driver) Halt Uses

func (a *Driver) Halt() (err error)

Halt halts the Driver

func (*Driver) Hover Uses

func (a *Driver) Hover()

Hover makes the drone to hover in place.

func (*Driver) Land Uses

func (a *Driver) Land()

Land causes the drone to land

func (*Driver) Left Uses

func (a *Driver) Left(speed float64)

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.0` to `1.0`.

func (*Driver) Name Uses

func (a *Driver) Name() string

Name returns the Driver Name

func (*Driver) Right Uses

func (a *Driver) Right(speed float64)

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.0` to `1.0`.

func (*Driver) SetName Uses

func (a *Driver) SetName(n string)

SetName sets the Driver Name

func (*Driver) Start Uses

func (a *Driver) Start() (err error)

Start starts the Driver

func (*Driver) TakeOff Uses

func (a *Driver) TakeOff()

TakeOff makes the drone start flying, and publishes `flying` event

func (*Driver) Up Uses

func (a *Driver) Up(speed float64)

Up makes the drone gain altitude. speed can be a value from `0.0` to `1.0`.

Package ardrone imports 3 packages (graph). Updated 2018-02-15. Refresh now. Tools for package owners.