tello_asyncio.state
- class tello_asyncio.state.TelloStateListener(local_port)
Bases:
object
- class Protocol
Bases:
object
- connection_lost(error)
- connection_made(transport)
- datagram_received(data, addr)
- error_received(error)
- async connect(loop, on_state_received)
- async disconnect()
- tello_asyncio.state.parse_state_message(raw)
tello_asyncio.tello
- class tello_asyncio.tello.Tello(drone_host='192.168.10.1', on_state=None, on_video_frame=None, on_error=None)
Bases:
object
For ayncio-based interaction with the Tello EDU drone.
- Parameters:
drone_host – Drone IP address, defaults to ‘192.168.10.1’
on_state (Callable, optional) – Callback called when state data is received from the drone, taking
tello_asyncio.tello.Tello
drone andtello_asyncio.types.TelloState
state arguments.on_video_frame (Callable or awaitable function, optional) – Called when video frame data is received from the drone, taking
tello_asyncio.tello.Tello
drone and bytes frame argument containing the raw data from the drone.on_error – Called when a command fails for any reason, taking
tello_asyncio.tello.Tello
drone andtello_asyncio.tello.Tello.Error
frame arguments.
- exception Error
Bases:
Exception
Exception thrown if anything goes wrong controlling the drone.
- class Protocol
Bases:
object
UDP protocol for drone control using the Tello SDK. The basic flow from the user’s point of view is
SEND command → drone does something → RECEIVE response when it’s finished
Messages are plain ASCII text, eg command forward 10 → response ok
- connection_lost(error)
- connection_made(transport)
- datagram_received(data, addr)
- error_received(error)
- async connect()
Opens the UDP connection to the drone and puts it in SDK mode.
- Returns:
The response from the drone
- async connect_to_wifi(ssid, password)
Connect to another WiFi network and reboot.
NB this also sets the Wifi network prefix used by wifi_wait_for_network
- Parameters:
ssid – Network name
password – Password
- Returns:
The response from the drone
- async connect_video(on_frame=None)
Opens a connection to the video_url and listens for the video frame data streamed after start_video is called.
- Parameters:
on_frame (Callable, optional) – Callback called when a new frame arrives, taking
tello_asyncio.tello.Tello
drone and bytes frame raw data arguments
- property controller_hardware
The controller hardware - “TELLO” or “RMTT” for the open source controller.
Requires SDK 3+
- async curve_to(via_relative_position, relative_position, speed, mission_pad=None)
Fly in a curve defined by the two positions, which must lie on a circle with a radius of 50cm - 10m.
- Parameters:
via_relative_position (
tello_asyncio.types.Vector
) – First position relative to drone or mission padrelative_position (
tello_asyncio.types.Vector
) – Destination relative to drone or mission padspeed (int) – The speed to travel at 10-60cm/s
mission_pad (int, optional) – The mission pad ID, 1-8
- Returns:
The response from the drone
- async disable_mission_pads()
Stop detecting mission pads.
- Returns:
The response from the drone
- async disconnect()
Closes all UDP connections to this drone.
- async emergency_stop()
Stop all motors immediately. Warning - this will make the drone drop like a brick.
- async enable_mission_pads()
Start attempting to detect mission pads.
- Returns:
The response from the drone
- async flip(direction)
Do a flip in the given direction.
- Parameters:
direction (
tello_asyncio.types.Direction
) – The direction to flip in.- Returns:
The response from the drone
- async flip_back()
Flip backwards.
- Returns:
The response from the drone
- async flip_forward()
Flip forwards.
- Returns:
The response from the drone
- async flip_left()
Flip left.
- Returns:
The response from the drone
- async flip_right()
Flip right.
- Returns:
The response from the drone
- property flying
True if takeoff has been called but land has not.
- async go_to(relative_position, speed, mission_pad=None)
Go to the given position, either relative to a mission pad if given, otherwise relative to the current position.
- Parameters:
relative_position (
tello_asyncio.types.Vector
) – Position relative to drone or mission padmission_pad (int, optional) – The mission pad ID, 1-8
- Returns:
The response from the drone
- async jump(relative_position, speed, yaw, from_mission_pad, to_mission_pad)
Travel from one mission pad to another.
- Parameters:
relative_position (
tello_asyncio.types.Vector
) – Final position relative to the mission pad.speed – Speed of travel, 10-100 cm/s
yaw – Angle to turn on arrival 0-360°
- Returns:
The response from the drone
- async land()
Land and stop motors.
- Returns:
The response from the drone
- async motor_off()
Stops the motors if started in low speed mode.
Requires SDK 3+
- Returns:
The response from the drone
- async motor_on()
Starts the motors at low speed to keep the drone cool while lon the ground.
Requires SDK 3+
- Returns:
The response from the drone
- async move(direction, distance)
Move in a straight line in the given direction.
- Parameters:
direction (
tello_asyncio.types.Direction
) – Direction of movementdistance – The distance to travel, 20-500 cm
- Returns:
The response from the drone
- async move_back(distance)
Move straight backwards.
- Parameters:
distance – Distance to travel, 20-500 cm
- Returns:
The response from the drone
- async move_down(distance)
Move straight down.
- Parameters:
distance – Distance to travel, 20-500 cm
- Returns:
The response from the drone
- async move_forward(distance)
Move straight forwards.
- Parameters:
distance – Distance to travel, 20-500 cm
- Returns:
The response from the drone
- async move_left(distance)
Move straight left.
- Parameters:
distance – Distance to travel, 20-500 cm
- Returns:
The response from the drone
- async move_right(distance)
Move straight right.
- Parameters:
distance – Distance to travel, 20-500 cm
- Returns:
The response from the drone
- async move_up(distance)
Move straight up.
- Parameters:
distance – Distance to travel, 20-500 cm
- Returns:
The response from the drone
- async query_battery()
The battery level as a percentage, requested directly from the drone.
- async query_motor_time()
The active motor time in seconds, requested directly from the drone.
- async reboot()
Reboot the drone.
Requires SDK 3+
- Returns:
The response from the drone
- async remote_control(left_right, forward_back, up_down, yaw)
Send remote control commands.
- Parameters:
left_right – Desired speed to the left, -100-100 cm/s
forward_back – Desired speed forwards, -100-100 cm/s
up_down – Desired speed up, -100-100 cm/s
yaw – Desired yaw -100-100°/s
- Returns:
The response from the drone
- property sdk_version
The Tello SDK version.
- async send(message, timeout=10, response_parser=None)
Send a command message and wait for response.
- Parameters:
message – The command string
timeout – Time to wait in seconds for a response
response_parser – A function that converts the response into a return value.
- Returns:
The response from the drone
- Return type:
str, unless response_parser is used.
- async send_ext_command(command)
Sends a command like “EXT xxx” for the open source contoller, returning the response.
See the SDK 3.0 User Guide for command details.
Requires SDK 3+ and the open source controller
- Parameters:
ssid – Network name
password – Password
- Returns:
The response from the drone
- property serial_number
The unique drone serial number.
- async set_mission_pad_detection(mission_pad_detection)
Sets the directions to look for mission pads in - forwards, down or both.
- Parameters:
mission_pad_detection – Forwards, down or both.
mission_pad_detection –
tello_asyncio.types.MissionPadDetection
- Returns:
The response from the drone
- async set_multi_wifi_credentials(ssid, password)
Set WiFi credentials for connecting to multiple devices as a router.
Requires SDK 3+ and the open source controller.
- Parameters:
ssid – Network name
password – Password
- Returns:
The response from the drone
- async set_ports(status_port, video_port)
Sets the UDP ports for status and video data.
Requires SDK 3+
- Returns:
The response from the drone
- async set_speed(speed)
Set the forward speed.
- Parameters:
speed – Desired speed, 10-100 cm/s
- Returns:
The response from the drone
- async set_video_bit_rate(bit_rate)
Sets the video bit rate.
Requires SDK 3+
- Parameters:
bit_rate – 1-5Mbps, or zero for auto
- Returns:
The response from the drone
- async set_video_frame_rate(frame_rate)
Sets the video frame rate.
Requires SDK 3+
- Parameters:
frame_rate (
tello_asyncio.types.VideoFrameRate
) – “low” (5fps), “middle” (15fps) or “high” (30fps)- Returns:
The response from the drone
- async set_video_resolution(resolution)
Sets the video resolution.
Requires SDK 3+
- Parameters:
resolution – “low” 480p or “high” 720p
- Returns:
The response from the drone
- async set_wifi_channel(wifi_channel)
Sets the Wifi channel.
Requires SDK 3+ and the open source controller.
- Parameters:
wifi_channel – The WiFi channel
- Returns:
The response from the drone
- async set_wifi_credentials(ssid, password)
Set credentials for the drone’s own WiFi network
- Parameters:
ssid – Network name
password – Password
- Returns:
The response from the drone
- property speed
The drone speed in cm/s, requested directly from the drone.
- async start_video(on_frame=None, connect=True)
Start streaming video data. Only works in AP mode using the drone’s own WiFi.
- Parameters:
on_frame (Callable, optional) – Callback called when a new frame arrives, taking
tello_asyncio.tello.Tello
drone and bytes frame raw data argumentsconnect (Boolean, optional) – Whether to start receiving frame data, default True
- Returns:
The response from the drone
- property state
The current state of the drone, if any.
- Return type:
- property state_stream
In infinite stream of drone state objects.
- Return type:
- async stop()
Stop and hover in place.
- Returns:
The response from the drone
- async stop_video()
Stop streaming video.
- Returns:
The response from the drone
- async takeoff()
Take off and hover.
- Returns:
The response from the drone
- async throw_fly()
Launch the drone by throwing horizontally within 5 seconds.
Requires SDK 3+
- Returns:
The response from the drone
- async turn_clockwise(degrees)
Turn clockwise.
- Parameters:
degrees – int, Angle in degrees 1-360°
- Returns:
The response from the drone
- async turn_counterclockwise(degrees)
Turn anticlockwise.
- Parameters:
degrees – Angle in degrees 1-360°
- Returns:
The response from the drone
- property video_chunk_stream
Infinite stream of video frame data chunks.
- Return type:
bytes
- property video_frame
The most recent raw frame data, if any,
- Return type:
bytes
- property video_stream
Infinite stream of video frame data.
- Return type:
bytes
- property video_url
The URL for video data, if start_video has been called.
- property wifi_name_and_password
The WiFi access point name and password.
Requires SDK 3+ and the open source controller
- property wifi_signal_to_noise_ratio
The signal-to-noise ratio of the WiFi connection.
- property wifi_ssid
The WiFi SSID.
Requires SDK 3+ and the open source controller
- property wifi_version
The WiFi version.
Requires SDK 3+ and the open source controller
- async wifi_wait_for_network(prefix=None, prompt=False)
Waits until the WiFi network is established.
NB: - This does not actually connect to the WiFi network - Only works on Linux and macOS
- Parameters:
prefix – The WiFi network SSID name prefix, defaults to the hardware string “RMTT” or “TELLO” (if known, otherwise “TELLO”)
prompt – If true, ask the user for the prefix
tello_asyncio.types
- class tello_asyncio.types.ControllerHardware(value)
Bases:
Enum
An enumeration.
- OPEN_SOURCE = 'RMTT'
- TELLO = 'TELLO'
- class tello_asyncio.types.Direction(value)
Bases:
Enum
An enumeration.
- BACK = 'back'
- DOWN = 'down'
- FORWARD = 'forward'
- LEFT = 'left'
- RIGHT = 'right'
- UP = 'up'
- class tello_asyncio.types.MissionPadDetection(value)
Bases:
Enum
An enumeration.
- BOTH = 2
- DOWN = 0
- FORWARD = 1
- class tello_asyncio.types.TelloState(raw, roll, pitch, yaw, height, barometer, battery, time_of_flight, motor_time, temperature, acceleration, velocity, mission_pad, mission_pad_position)
Bases:
tuple
- acceleration
tello_asyncio.types.Vector
acceleration in cm/s/s in each axis direction
- barometer
Atmospheric pressure
- battery
Remaining battery percentage
- height
Height in cm
- mission_pad
Mission pad ID
- mission_pad_position
tello_asyncio.types.Vector
mission pad relative position
- motor_time
Time in seconds the motors have been active for
- pitch
Rotation in degrees around the drone’s local x axis
- raw
Raw state message string
- roll
Rotation in degrees around the drone’s local y axis
- temperature
Range in temperature in degrees Celsius
- time_of_flight
Time of flight returned by the height sensor
- velocity
tello_asyncio.types.Vector
speed in cm/s in each axis direction
- yaw
Rotation in degrees around the drone’s local z axis
tello_asyncio.video
- class tello_asyncio.video.TelloVideoListener
Bases:
object
Connects to the drone’s video data stream and reassembles h.264 encoded frames from UDP packet chunks before passing them on.
- class Protocol
Bases:
object
- connection_lost(error)
- connection_made(transport)
- datagram_received(data, addr)
- error_received(error)
- async connect(loop, on_video_frame_chunk_received, on_video_frame_received)
- async disconnect()