engine

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false

Debug flag. Set to true to view debug logs.

Functions

func Log

func Log(message string)

Log a message.

func Sleep

func Sleep(milliseconds int)

Sleep for the given number of milliseconds.

Types

type Engine

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

Engine is the main structure for controlling a drone.

func NewEngine

func NewEngine() *Engine

NewEngine will create a new instance of the engine.

func (*Engine) AddKeyboardDevice

func (e *Engine) AddKeyboardDevice()

AddKeyboardDevice will add the keyboard device and start handling key presses. This MUST be called before Start.

func (*Engine) BackFlip

func (e *Engine) BackFlip()

BackFlip will cause the drone to perform a back flip.

func (*Engine) Backward

func (e *Engine) Backward(speed int)

Backward will move the drone backward at the given speed.

func (*Engine) Bounce

func (e *Engine) Bounce()

Bounce will toggle "bouncing" the drone up and down.

func (*Engine) Down

func (e *Engine) Down(speed int)

Down will move the drone down at the given speed.

func (*Engine) Forward

func (e *Engine) Forward(speed int)

Forward will move the drone forward at the given speed.

func (*Engine) FrontFlip

func (e *Engine) FrontFlip()

FrontFlip will cause the drone to perform a front flip.

func (*Engine) GetLastKeyPressed

func (e *Engine) GetLastKeyPressed() string

GetLastKeyPressed will return the last key that was pressed or an empty string if none.

func (*Engine) Land

func (e *Engine) Land()

Land will lower the drone to the ground and stop the blades.

func (*Engine) Left

func (e *Engine) Left(speed int)

Left will move the drone left at the given speed.

func (*Engine) LeftFlip

func (e *Engine) LeftFlip()

LeftFlip will cause the drone to perform a left flip.

func (*Engine) ResetMovement

func (e *Engine) ResetMovement()

ResetMovement will set all drone movement to 0.

func (*Engine) Right

func (e *Engine) Right(speed int)

Right will move the drone right at the given speed.

func (*Engine) RightFlip

func (e *Engine) RightFlip()

RightFlip will cause the drone to perform a right flip.

func (*Engine) RotateLeft

func (e *Engine) RotateLeft(speed int)

RotateLeft will rotate the drone left at the given speed.

func (*Engine) RotateRight

func (e *Engine) RotateRight(speed int)

RotateRight will rotate the drone right at the given speed.

func (*Engine) Start

func (e *Engine) Start(autoRun bool)

Start the drone and allow input. If autoRun is true, this function will block.

func (*Engine) StartVideoStream

func (e *Engine) StartVideoStream()

StartVideoStream will initialize the video player and begin streaming from the drone.

func (*Engine) Stop

func (e *Engine) Stop()

Stop the drone.

func (*Engine) TakeOff

func (e *Engine) TakeOff()

TakeOff will start the blades and raise the drone to a normal flying height.

func (*Engine) Up

func (e *Engine) Up(speed int)

Up will move the drone up at the given speed.

Jump to

Keyboard shortcuts

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