Unity Plugin for Android Application to use Tello Low-Level Protocol.
This is for running tello-llp-wrapper on android devices.
Android 10. This plugin has been tested with Meta Quest 2 and Meta Quest Pro.
- Download
tello-llp-wrapper-1.1.2.jar
from this page. - Copy
tello-llp-wrapper-1.1.2.jar
to the./tydrone-android-plugin/libs
folder. If the folder does not exist, create it. - Download javacv-platform-1.5.8-bin.zip
- Create a small jar file using a script like the following:
# unzip the downloaded file unzip javacv-platform-1.5.8-bin.zip # cd to the destination folder of the zip file cd javacv-platform-1.5.8-bin # create a working directory mkdir tmp # copy important files cp LICENSE.txt tmp cp README.md tmp cp CHANGELOG.md tmp # extract jar files to the tmp directory cd tmp jar xf ../ffmpeg.jar jar xf ../ffmpeg-android-arm64.jar jar xf ../javacpp.jar jar xf ../javacpp-android-arm64.jar jar xf ../javacv.jar jar xf ../openblas.jar jar xf ../openblas-android-arm64.jar jar xf ../opencv.jar jar xf ../opencv-android-arm64.jar # remove some files to avoid build errors rm -fr META-INF/versions rm -fr META-INF/native-image # create jar file jar cf javacv-1.5.8.jar *
- Copy the created jar file to the
./tydrone-android-plugin/libs
folder. - Copy
classes.jar
from Unity to the./tydrone-android-plugin/dev-libs
folder. - Build tydrone-android-plugin module.
- Copy
./tydrone-android-plugin/build/outputs/aar/tydrone-android-plugin-*.aar
toAssets/Plugins/Android
folder of your Unity Project.
The Facade interface of the tello-llp-wrapper can be used in Unity scripts by creating a simple wrapper class like the following:
public class TyDroneAndroidPlugin
{
private AndroidJavaObject tyDrone;
public TyDroneAndroidPlugin()
{
this.tyDrone = new AndroidJavaObject("com.xpfriend.tydrone.AndroidMain");
}
public void EntryCommand(string command)
{
tyDrone.Call("entryCommand", command);
}
public string GetNotice()
{
return tyDrone.Call<string>("getNotice");
}
public string GetSentCommand()
{
return tyDrone.Call<string>("getSentCommand");
}
public string GetStates()
{
return tyDrone.Call<string>("getStates");
}
public bool IsRecording()
{
return tyDrone.Call<bool>("isRecording");
}
public byte[] PickImage()
{
AndroidJavaObject obj = this.tyDrone.Call<AndroidJavaObject>("pickImage");
if (obj == null || obj.GetRawObject() == null)
{
return new byte[] { };
}
sbyte[] image = AndroidJNIHelper.ConvertFromJNIArray<sbyte[]>(obj.GetRawObject());
if (image == null)
{
return new byte[] { };
}
return (byte[])(Array)image;
}
public void SetRecording(bool value)
{
this.tyDrone.Call("setRecording", value);
}
public void Run()
{
this.tyDrone.Call("run");
}
}
For example, you can apply the video image obtained from Tello to Texture2D as follows:
byte[] bytes = tyDrone.PickImage();
if (bytes.Length == 0)
{
return;
}
Texture2D texture = new Texture2D(960, 720, TextureFormat.RGB24, false);
texture.LoadRawTextureData(bytes);
texture.Apply();
See README.md of the tello-llp-wrapper for information on the use of other methods.
This software is released under the MIT License, see LICENSE.
For dependent software licenses, see: