Documentation ¶
Index ¶
- Constants
- func CalculateCRC16(pkt []byte) uint16
- func CalculateCRC8(pkt []byte) byte
- func ValidatePitch(data float64, offset float64) int
- type Driver
- func (d *Driver) AddVector(x, y, z, psi float32) error
- func (d *Driver) BackFlip() (err error)
- func (d *Driver) Backward(val int) error
- func (d *Driver) Bounce() (err error)
- func (d *Driver) CeaseRotation()
- func (d *Driver) Clockwise(val int) error
- func (d *Driver) Connection() gobot.Connection
- func (d *Driver) CounterClockwise(val int) error
- func (d *Driver) Down(val int) error
- func (d *Driver) Flip(direction FlipType) (err error)
- func (d *Driver) Forward(val int) error
- func (d *Driver) FrontFlip() (err error)
- func (d *Driver) Halt() (err error)
- func (d *Driver) Hover()
- func (d *Driver) Land() (err error)
- func (d *Driver) Left(val int) error
- func (d *Driver) LeftFlip() (err error)
- func (d *Driver) Name() string
- func (d *Driver) PalmLand() (err error)
- func (d *Driver) ParseFlightData(b []byte) (fd *FlightData, err error)
- func (d *Driver) Rate() (err error)
- func (d *Driver) Right(val int) error
- func (d *Driver) RightFlip() (err error)
- func (d *Driver) SendCommand(cmd string) (err error)
- func (d *Driver) SendDateTime() (err error)
- func (d *Driver) SendStickCommand() (err error)
- func (d *Driver) SetExposure(level int) (err error)
- func (d *Driver) SetFastMode() error
- func (d *Driver) SetName(n string)
- func (d *Driver) SetPsi(psi float32) error
- func (d *Driver) SetSlowMode() error
- func (d *Driver) SetVector(x, y, z, psi float32) error
- func (d *Driver) SetVideoEncoderRate(rate VideoBitRate) (err error)
- func (d *Driver) SetX(x float32) error
- func (d *Driver) SetY(y float32) error
- func (d *Driver) SetZ(z float32) error
- func (d *Driver) Start() error
- func (d *Driver) StartVideo() (err error)
- func (d *Driver) StopLanding() (err error)
- func (d *Driver) TakeOff() (err error)
- func (d *Driver) ThrowTakeOff() (err error)
- func (d *Driver) Up(val int) error
- func (d *Driver) Vector() (x, y, z, psi float32)
- type FlightData
- type FlipType
- type VideoBitRate
- type WifiData
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" )
Variables ¶
This section is empty.
Functions ¶
func CalculateCRC16 ¶
CalculateCRC16 calculates the ending CRC16 bytes for packet.
func CalculateCRC8 ¶
CalculateCRC8 calculates the starting CRC8 byte for packet.
func ValidatePitch ¶
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.
Types ¶
type Driver ¶
type Driver struct { gobot.Eventer // contains filtered or unexported fields }
Driver represents the DJI Tello drone
func NewDriver ¶
NewDriver creates a driver for the Tello drone. Pass in the UDP port to use for the responses from the drone.
func NewDriverWithIP ¶ added in v1.15.0
NewDriverWithIP creates a driver for the Tello EDU drone. Pass in the ip address and UDP port to use for the responses from the drone.
func (*Driver) AddVector ¶ added in v1.13.0
AddVector adds to the current motion vector. Pass values from 0 to 1. See Vector() for the frame of reference.
func (*Driver) CeaseRotation ¶
func (d *Driver) CeaseRotation()
CeaseRotation stops any rotational motion
func (*Driver) Clockwise ¶
Clockwise tells drone to rotate in a clockwise direction. Pass in an int from 0-100.
func (*Driver) Connection ¶
func (d *Driver) Connection() gobot.Connection
Connection returns the Connection of the device.
func (*Driver) CounterClockwise ¶
CounterClockwise tells drone to rotate in a counter-clockwise direction. Pass in an int from 0-100.
func (*Driver) Hover ¶
func (d *Driver) Hover()
Hover tells the drone to stop moving on the X, Y, and Z axes and stay in place
func (*Driver) ParseFlightData ¶
func (d *Driver) ParseFlightData(b []byte) (fd *FlightData, err error)
ParseFlightData from drone
func (*Driver) SendCommand ¶
SendCommand is used to send a text command such as the initial connection request to the drone.
func (*Driver) SendDateTime ¶
SendDateTime sends the current date/time to the drone.
func (*Driver) SendStickCommand ¶
SendStickCommand sends the joystick command packet to the drone.
func (*Driver) SetExposure ¶
SetExposure sets the drone camera exposure level. Valid levels are 0, 1, and 2.
func (*Driver) SetFastMode ¶
SetFastMode sets the drone throttle to 1.
func (*Driver) SetPsi ¶ added in v1.13.0
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 ¶
SetSlowMode sets the drone throttle to 0.
func (*Driver) SetVector ¶ added in v1.13.0
SetVector sets the current motion vector. Pass values from 0 to 1. See Vector() for the frame of reference.
func (*Driver) SetVideoEncoderRate ¶
func (d *Driver) SetVideoEncoderRate(rate VideoBitRate) (err error)
SetVideoEncoderRate sets the drone video encoder rate.
func (*Driver) SetX ¶ added in v1.13.0
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 ¶ added in v1.13.0
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 ¶ added in v1.13.0
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) StartVideo ¶
StartVideo tells Tello to send start info (SPS/PPS) for video stream.
func (*Driver) StopLanding ¶
StopLanding tells drone to stop landing.
type FlightData ¶
type FlightData struct { BatteryLow bool BatteryLower bool BatteryPercentage int8 // How much battery left [in %]. CameraState int8 DroneBatteryLeft int16 DroneFlyTimeLeft int16 DroneHover bool // If the drone is in the air and not moving. EmOpen bool Flying bool // If the drone is currently in the air. OnGround bool // If the drone is currently on the ground. EastSpeed int16 // Movement speed towards East [in cm/s]. Negative if moving west. ElectricalMachineryState int16 FactoryMode bool FlyMode int8 FlyTime int16 // How long since take off [in s/10]. FrontIn bool FrontLSC bool FrontOut bool GravityState bool VerticalSpeed int16 // Movement speed up [in cm/s]. Height int16 // The height [in decimeters]. ImuCalibrationState int8 // The IMU calibration step (when doing IMU calibration). NorthSpeed int16 // Movement speed towards North [in cm/s]. Negative if moving South. ThrowFlyTimer int8 // Warnings: DownVisualState bool // If the ground is visible by the down camera. BatteryState bool // If there is an issue with battery. ImuState bool // If drone needs IMU (Inertial Measurement Unit) calibration. OutageRecording bool // If there is an issue with video recording. PowerState bool // If there is an issue with power supply. PressureState bool // If there is an issue with air pressure. TemperatureHigh bool // If drone is overheating. WindState bool // If the wind is too strong. }
FlightData packet returned by the Tello.
The meaning of some fields is not documented. If you learned more, please, contribute. See https://github.com/hybridgroup/gobot/issues/798.
func (*FlightData) AirSpeed ¶ added in v1.13.0
func (f *FlightData) AirSpeed() float64
func (*FlightData) GroundSpeed ¶
func (f *FlightData) GroundSpeed() float64
type FlipType ¶
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 ¶
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 )