ardrone

package
v0.0.0-...-dd86721 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2015 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 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() {
		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()
}

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 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
}

func NewArdroneAdaptor

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

NewArdroneAdaptor creates a new ardrone and connects with default configuration

func (*ArdroneAdaptor) Connect

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

Connect returns true when connection to ardrone is established correclty

func (*ArdroneAdaptor) Finalize

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

Finalize returns true when connection is finalized correctly

func (*ArdroneAdaptor) Name

func (a *ArdroneAdaptor) Name() string

type ArdroneDriver

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

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 forward, 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

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 returns true if driver is halted succesfully

func (*ArdroneDriver) Hover

func (a *ArdroneDriver) Hover()

Hover makes the drone to hover in place.

func (*ArdroneDriver) Land

func (a *ArdroneDriver) Land()

Land makes the drone stop flying

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

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 returns true if driver is started succesfully

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