Ryze Tello Matlab Control

Visualize and collect data on ryze tello state variables such as altitude and control input. All state variables can be collected.
140 Downloads
Updated 26 Apr 2023

View License

This version {1.0} toolbox provides an API for connecting with the ryze tello drone and streaming and visualizing in real time the drone's state variables that the user specifies with the API. The data collected can be used for system identification or modelling of the drone's dynamic behaviour. For example, a dynamic altitude model can be derived using matlabs system identification toolbox with altitude data collected from the tello drone using the API provided by this package.
Getting Started with Ryze Tello Matlab Control
NB: To access local documentation in Matlab doc browser, call help_rtmc in command window
Description
This version {1.0} toolbox provides an API for connecting with the ryze tello drone and streaming and visualizing in real time the drone's state variables that the user specifies with the API. The data collected can be used for system identification or modelling of the drone's dynamic behaviour. For example, a dynamic altitude model can be derived using matlab's system identification toolbox with altitude data collected from the ryze tello drone using the API.
For more information on the Drone's state variables and the Tello's SDK see, Ryze Tello SDK
This Toolbox makes use of 2 primary classes.
  • TelloControl
The TelloControl class rovides functions for connecting to the Ryze Tello Drone over WIFI using the UDP protocol, initializing the onboard SDK and a primary function, cmdTello(str:<cmd>), for sending control commands over UDP to the drone. See Ryze Tello SDK for more information on the acceptable commands. This class can be used independently.
This is the typical process for observing and collecting data.Initialize Ryze Tello Controller
Before the controller is initialized, it is important to clear all workspace variables and close all pre-existing figures as this may interfere with the proper starting of the script.
clear;clc;close all;
tc = TelloControl
tc =
TelloControl with properties:
telloSDKPort: 8889
telloDroneStatePort: 8890
telloIP: '192.168.10.1'
localhost: '0.0.0.0'
telloSDKClient: [1×1 udpport.byte.UDPPort]
telloStateClient: [1×1 udpport.byte.UDPPort]
telloCameraClient: [1×1 udpport.byte.UDPPort]
telloCameraPort: 11111
telloState: {}
Initialize the Drone's onboard SDK
Run this to initialize the Tello's onboard SDK to allow the controller to interact with the drone.
tc.initTello();
Pass the controller 'tc' to the TelloStateObserver class. See this implemented in the example below.
  • TelloStateObserver
The TelloStateObserver provides a way of observing the state variables and visualizing them in real time on a live matlab plot while accepting vertical mouse or trackpad motion
as control input for altitude control while the selected states are observed and collected.
The class is used as follows. Call the class by passing the following arguments. The controller 'tc' is the ony required positionial argument. The follwoing are optional named arguments that can be passed in addition. Pass them like regular matlab named arguments.
observers <cell{string}> : Cell of strings. These are those state variables you ony wish to observe and visualize in real time but not save or collect.
collectors <cell{string}>: Cell of strings. Like observers, and wish to save after running script.
limitAltitude <double> : Impose an approximate altitude limit
n_samples <double> : Number of samples to observe or run script for after which the controller issues a commanad to land the drone.
Example usage:
tso = TelloStateObserver(tc,"observers",{'h'},'collectors',{'h','vgz','agz'},limitAltitude=20,n_samples=100);
Typical Example
This example connects to the Ryze Tello Drone over WIFI and observes in real time the selected state variables. Recommended not to run in a live script. Recommended in a default .m script. Check example script 'tello_altitude_rc.m'
clear;clc;close all; %clear and close all workspace variables and pre-existing figures resp.
tc = TelloControl; %initialize controller
tc.initTello(); %initialize onboard tello sdk
initializing RYZE TELLO SDK...
ok: SDK initialization successful on IP: 192.168.10.1 at PORT: 8889
tc.getTelloState() %get and display initial states of drone - returns struct class wtih state variables as fieldnames
ans = struct with fields:
pitch: 0
roll: 0
yaw: 0
vgx: 0
vgy: 0
vgz: 0
templ: 86
temph: 88
tof: 10
h: 0
bat: 70
baro: 367.3100
time: 2
agx: -1
agy: 10
agz: -998
Pass the controller 'tc' to the TelloStateObserver class<required> and initial the TelloStateObserver class with chosen arguments<optional>. collectors, observers, n_samples and limitAltitude. Obsercers can be equal to collectors.
tso = TelloStateObserver(tc,"observers",{'h'},'collectors',{'h','vgz','agz'},limitAltitude=20,n_samples=100);
[collected,observed,input] = tso.stateObserve(); %run observer to collect and visualize state variables in real time
Elapsed time is 0.094937 seconds.
Elapsed time is 0.102760 seconds.
Elapsed time is 0.114103 seconds.
Elapsed time is 0.091744 seconds.
Elapsed time is 0.098859 seconds.
Elapsed time is 0.101793 seconds.
Elapsed time is 0.101825 seconds.
Elapsed time is 0.110450 seconds.
Elapsed time is 0.093097 seconds.
...
%post process collected states and save
disp('saving state collected state variables and input...')
saving state collected state variables and input...
telloStateData = {};
telloStateData.states = collected;
telloStateData.input = input;
save('tellosStateData.mat','telloStateData')

Cite As

WIlliam Akuffo (2025). Ryze Tello Matlab Control (/matlabcentral/fileexchange/125455-ryze-tello-matlab-control), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2023a
Compatible with R2014b and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

simulink_control

Version Published Release Notes
1.0.4.5

tlbx

1.0.4.4

packaged not as tlbx

1.0.4.3

resolved download bug*

1.0.4.2

added online doc link

1.0.4.1

Updated documentation (Integration with Simulink)

1.0.4

Added support for Simulink integration

1.0.3.1

added help_rtmc.m

1.0.3

Can now call documentation from the Matlab command window as help_rtmc
-----------------------------------------------------------------------------------------------------------------------
Ryze Matlab Tello Control ->(rtmc)

1.0.2

Updated Documentation

1.0.1

updated documentation

1.0