ardrone

package
v0.12.1 Latest Latest
Warning

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

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

README

Ardrone

The ARDrone 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.

For more info about the ARDrone platform click here.

How to Install

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

How to Use

package main

import (
	"time"

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

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

	ardroneAdaptor := ardrone.NewArdroneAdaptor("Drone")
	drone := ardrone.NewArdroneDriver(ardroneAdaptor, "Drone")

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

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

	gbot.Start()
}

How to Connect

The ARDrone 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 ardrone provides the Gobot adaptor and driver for the Parrot Ardrone.

Installing:

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

Example:

package main

import (
	"time"

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

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

	ardroneAdaptor := ardrone.NewArdroneAdaptor("Drone")
	drone := ardrone.NewArdroneDriver(ardroneAdaptor, "Drone")

	work := func() {
		drone.TakeOff()
		gobot.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,
	)
	gbot.AddRobot(robot)

	gbot.Start()
}

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArdroneAdaptor

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

ArdroneAdaptor is gobot.Adaptor representation for the Ardrone

func NewArdroneAdaptor

func NewArdroneAdaptor(name string, v ...string) *ArdroneAdaptor

NewArdroneAdaptor returns a new ArdroneAdaptor and optionally accepts:

string: The ardrones IP Address

func (*ArdroneAdaptor) Connect

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

Connect establishes a connection to the ardrone

func (*ArdroneAdaptor) Finalize

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

Finalize terminates the connection to the ardrone

func (*ArdroneAdaptor) Name

func (a *ArdroneAdaptor) Name() string

Name returns the ArdroneAdaptors Name

type ArdroneDriver

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

ArdroneDriver is gobot.Driver representation for the Ardrone

func NewArdroneDriver

func NewArdroneDriver(connection *ArdroneAdaptor, name string) *ArdroneDriver

NewArdroneDriver creates an ArdroneDriver with specified name.

It add the following events:

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

func (*ArdroneDriver) Backward

func (a *ArdroneDriver) Backward(speed float64)

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

func (*ArdroneDriver) Clockwise

func (a *ArdroneDriver) Clockwise(speed float64)

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

func (*ArdroneDriver) Connection

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

Connection returns the ArdroneDrivers Connection

func (*ArdroneDriver) CounterClockwise

func (a *ArdroneDriver) CounterClockwise(speed float64)

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

func (*ArdroneDriver) Down

func (a *ArdroneDriver) Down(speed float64)

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

func (*ArdroneDriver) Forward

func (a *ArdroneDriver) Forward(speed float64)

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

func (*ArdroneDriver) Halt

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

Halt halts the ArdroneDriver

func (*ArdroneDriver) Hover

func (a *ArdroneDriver) Hover()

Hover makes the drone to hover in place.

func (*ArdroneDriver) Land

func (a *ArdroneDriver) Land()

Land causes the drone to land

func (*ArdroneDriver) Left

func (a *ArdroneDriver) 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 (*ArdroneDriver) Name

func (a *ArdroneDriver) Name() string

Name returns the ArdroneDrivers Name

func (*ArdroneDriver) Right

func (a *ArdroneDriver) 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 (*ArdroneDriver) Start

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

Start starts the ArdroneDriver

func (*ArdroneDriver) TakeOff

func (a *ArdroneDriver) TakeOff()

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

func (*ArdroneDriver) Up

func (a *ArdroneDriver) Up(speed float64)

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

Jump to

Keyboard shortcuts

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