ardrone

package
v0.0.0-...-1595f01 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2014 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

README

Ardrone

This package provides the Gobot adaptor and driver for the Parrot Ardrone.

For more information about Gobot, check out the github repo at https://github.com/hybridgroup/gobot

Getting Started

Installing

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

Using

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

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 {
	gobot.Adaptor
	// 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() bool

Connect returns true when connection to ardrone is established correclty

func (*ArdroneAdaptor) Finalize

func (a *ArdroneAdaptor) Finalize() bool

Finalize returns true when connection is finalized correctly

type ArdroneDriver

type ArdroneDriver struct {
	gobot.Driver
}

func NewArdroneDriver

func NewArdroneDriver(adaptor *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) 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() bool

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) 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() bool

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