gobot: gobot.io/x/gobot/platforms/dji/tello Index | Files

package tello

import "gobot.io/x/gobot/platforms/dji/tello"

Index

Package Files

crc.go driver.go pitch.go

Constants

const (
    // BounceEvent event
    BounceEvent = "bounce"

    // ConnectedEvent event
    ConnectedEvent = "connected"

    // FlightDataEvent event
    FlightDataEvent = "flightdata"

    // TakeoffEvent event
    TakeoffEvent = "takeoff"

    // LandingEvent event
    LandingEvent = "landing"

    // PalmLandingEvent event
    PalmLandingEvent = "palm-landing"

    // FlipEvent event
    FlipEvent = "flip"

    // TimeEvent event
    TimeEvent = "time"

    // LogEvent event
    LogEvent = "log"

    // WifiDataEvent event
    WifiDataEvent = "wifidata"

    // LightStrengthEvent event
    LightStrengthEvent = "lightstrength"

    // SetExposureEvent event
    SetExposureEvent = "setexposure"

    // VideoFrameEvent event
    VideoFrameEvent = "videoframe"

    // SetVideoEncoderRateEvent event
    SetVideoEncoderRateEvent = "setvideoencoder"
)

func CalculateCRC16 Uses

func CalculateCRC16(pkt []byte) uint16

CalculateCRC16 calculates the ending CRC16 bytes for packet.

func CalculateCRC8 Uses

func CalculateCRC8(pkt []byte) byte

CalculateCRC8 calculates the starting CRC8 byte for packet.

func ValidatePitch Uses

func ValidatePitch(data float64, offset float64) int

ValidatePitch helps validate pitch values such as those created by a joystick to values between 0-100 that are required as params to Tello stick commands.

type Driver Uses

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

Driver represents the DJI Tello drone

func NewDriver Uses

func NewDriver(port string) *Driver

NewDriver creates a driver for the Tello drone. Pass in the UDP port to use for the responses from the drone.

func (*Driver) AddVector Uses

func (d *Driver) AddVector(x, y, z, psi float32) error

AddVector adds to the current motion vector. Pass values from 0 to 1. See Vector() for the frame of reference.

func (*Driver) BackFlip Uses

func (d *Driver) BackFlip() (err error)

BackFlip tells the drone to perform a back flip.

func (*Driver) Backward Uses

func (d *Driver) Backward(val int) error

Backward tells drone to go in reverse. Pass in an int from 0-100.

func (*Driver) Bounce Uses

func (d *Driver) Bounce() (err error)

Bounce tells drone to start/stop performing the bouncing action

func (*Driver) CeaseRotation Uses

func (d *Driver) CeaseRotation()

CeaseRotation stops any rotational motion

func (*Driver) Clockwise Uses

func (d *Driver) Clockwise(val int) error

Clockwise tells drone to rotate in a clockwise direction. Pass in an int from 0-100.

func (*Driver) Connection Uses

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

Connection returns the Connection of the device.

func (*Driver) CounterClockwise Uses

func (d *Driver) CounterClockwise(val int) error

CounterClockwise tells drone to rotate in a counter-clockwise direction. Pass in an int from 0-100.

func (*Driver) Down Uses

func (d *Driver) Down(val int) error

Down tells the drone to descend. Pass in an int from 0-100.

func (*Driver) Flip Uses

func (d *Driver) Flip(direction FlipType) (err error)

Flip tells drone to flip

func (*Driver) Forward Uses

func (d *Driver) Forward(val int) error

Forward tells the drone to go forward. Pass in an int from 0-100.

func (*Driver) FrontFlip Uses

func (d *Driver) FrontFlip() (err error)

FrontFlip tells the drone to perform a front flip.

func (*Driver) Halt Uses

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

Halt stops the driver.

func (*Driver) Hover Uses

func (d *Driver) Hover()

Hover tells the drone to stop moving on the X, Y, and Z axes and stay in place

func (*Driver) Land Uses

func (d *Driver) Land() (err error)

Land tells drone to come in for landing.

func (*Driver) Left Uses

func (d *Driver) Left(val int) error

Left tells drone to go left. Pass in an int from 0-100.

func (*Driver) LeftFlip Uses

func (d *Driver) LeftFlip() (err error)

LeftFlip tells the drone to perform a flip to the left.

func (*Driver) Name Uses

func (d *Driver) Name() string

Name returns the name of the device.

func (*Driver) PalmLand Uses

func (d *Driver) PalmLand() (err error)

PalmLand tells drone to come in for a hand landing.

func (*Driver) ParseFlightData Uses

func (d *Driver) ParseFlightData(b []byte) (fd *FlightData, err error)

ParseFlightData from drone

func (*Driver) Rate Uses

func (d *Driver) Rate() (err error)

Rate queries the current video bit rate.

func (*Driver) Right Uses

func (d *Driver) Right(val int) error

Right tells drone to go right. Pass in an int from 0-100.

func (*Driver) RightFlip Uses

func (d *Driver) RightFlip() (err error)

RightFlip tells the drone to perform a flip to the right.

func (*Driver) SendCommand Uses

func (d *Driver) SendCommand(cmd string) (err error)

SendCommand is used to send a text command such as the initial connection request to the drone.

func (*Driver) SendDateTime Uses

func (d *Driver) SendDateTime() (err error)

SendDateTime sends the current date/time to the drone.

func (*Driver) SendStickCommand Uses

func (d *Driver) SendStickCommand() (err error)

SendStickCommand sends the joystick command packet to the drone.

func (*Driver) SetExposure Uses

func (d *Driver) SetExposure(level int) (err error)

SetExposure sets the drone camera exposure level. Valid levels are 0, 1, and 2.

func (*Driver) SetFastMode Uses

func (d *Driver) SetFastMode() error

SetFastMode sets the drone throttle to 1.

func (*Driver) SetName Uses

func (d *Driver) SetName(n string)

SetName sets the name of the device.

func (*Driver) SetPsi Uses

func (d *Driver) SetPsi(psi float32) error

SetPsi sets the psi component (yaw) of the current motion vector Pass values from 0 to 1. See Vector() for the frame of reference.

func (*Driver) SetSlowMode Uses

func (d *Driver) SetSlowMode() error

SetSlowMode sets the drone throttle to 0.

func (*Driver) SetVector Uses

func (d *Driver) SetVector(x, y, z, psi float32) error

SetVector sets the current motion vector. Pass values from 0 to 1. See Vector() for the frame of reference.

func (*Driver) SetVideoEncoderRate Uses

func (d *Driver) SetVideoEncoderRate(rate VideoBitRate) (err error)

SetVideoEncoderRate sets the drone video encoder rate.

func (*Driver) SetX Uses

func (d *Driver) SetX(x float32) error

SetX sets the x component of the current motion vector Pass values from 0 to 1. See Vector() for the frame of reference.

func (*Driver) SetY Uses

func (d *Driver) SetY(y float32) error

SetY sets the y component of the current motion vector Pass values from 0 to 1. See Vector() for the frame of reference.

func (*Driver) SetZ Uses

func (d *Driver) SetZ(z float32) error

SetZ sets the z component of the current motion vector Pass values from 0 to 1. See Vector() for the frame of reference.

func (*Driver) Start Uses

func (d *Driver) Start() error

Start starts the driver.

func (*Driver) StartVideo Uses

func (d *Driver) StartVideo() (err error)

StartVideo tells Tello to send start info (SPS/PPS) for video stream.

func (*Driver) StopLanding Uses

func (d *Driver) StopLanding() (err error)

StopLanding tells drone to stop landing.

func (*Driver) TakeOff Uses

func (d *Driver) TakeOff() (err error)

TakeOff tells drones to liftoff and start flying.

func (*Driver) ThrowTakeOff Uses

func (d *Driver) ThrowTakeOff() (err error)

Throw & Go support

func (*Driver) Up Uses

func (d *Driver) Up(val int) error

Up tells the drone to ascend. Pass in an int from 0-100.

func (*Driver) Vector Uses

func (d *Driver) Vector() (x, y, z, psi float32)

Vector returns the current motion vector. Values are from 0 to 1. x, y, z denote forward, side and vertical translation, and psi yaw (rotation around the z-axis).

type FlightData Uses

type FlightData struct {
    BatteryLow               bool
    BatteryLower             bool
    BatteryPercentage        int8
    BatteryState             bool
    CameraState              int8
    DownVisualState          bool
    DroneBatteryLeft         int16
    DroneFlyTimeLeft         int16
    DroneHover               bool
    EmOpen                   bool
    Flying                   bool
    OnGround                 bool
    EastSpeed                int16
    ElectricalMachineryState int16
    FactoryMode              bool
    FlyMode                  int8
    FlyTime                  int16
    FrontIn                  bool
    FrontLSC                 bool
    FrontOut                 bool
    GravityState             bool
    VerticalSpeed            int16
    Height                   int16
    ImuCalibrationState      int8
    ImuState                 bool
    LightStrength            int8
    NorthSpeed               int16
    OutageRecording          bool
    PowerState               bool
    PressureState            bool
    SmartVideoExitMode       int16
    TemperatureHigh          bool
    ThrowFlyTimer            int8
    WindState                bool
}

FlightData packet returned by the Tello

func (*FlightData) AirSpeed Uses

func (f *FlightData) AirSpeed() float64

func (*FlightData) GroundSpeed Uses

func (f *FlightData) GroundSpeed() float64

type FlipType Uses

type FlipType int

FlipType is used for the various flips supported by the Tello.

const (
    // FlipFront flips forward.
    FlipFront FlipType = 0

    // FlipLeft flips left.
    FlipLeft FlipType = 1

    // FlipBack flips backwards.
    FlipBack FlipType = 2

    // FlipRight flips to the right.
    FlipRight FlipType = 3

    // FlipForwardLeft flips forwards and to the left.
    FlipForwardLeft FlipType = 4

    // FlipBackLeft flips backwards and to the left.
    FlipBackLeft FlipType = 5

    // FlipBackRight flips backwards and to the right.
    FlipBackRight FlipType = 6

    // FlipForwardRight flips forewards and to the right.
    FlipForwardRight FlipType = 7
)

type VideoBitRate Uses

type VideoBitRate int

VideoBitRate is used to set the bit rate for the streaming video returned by the Tello.

const (
    // VideoBitRateAuto sets the bitrate for streaming video to auto-adjust.
    VideoBitRateAuto VideoBitRate = 0

    // VideoBitRate1M sets the bitrate for streaming video to 1 Mb/s.
    VideoBitRate1M VideoBitRate = 1

    // VideoBitRate15M sets the bitrate for streaming video to 1.5 Mb/s
    VideoBitRate15M VideoBitRate = 2

    // VideoBitRate2M sets the bitrate for streaming video to 2 Mb/s.
    VideoBitRate2M VideoBitRate = 3

    // VideoBitRate3M sets the bitrate for streaming video to 3 Mb/s.
    VideoBitRate3M VideoBitRate = 4

    // VideoBitRate4M sets the bitrate for streaming video to 4 Mb/s.
    VideoBitRate4M VideoBitRate = 5
)

type WifiData Uses

type WifiData struct {
    Disturb  int8
    Strength int8
}

WifiData packet returned by the Tello

Package tello imports 11 packages (graph) and is imported by 1 packages. Updated 2019-09-13. Refresh now. Tools for package owners.