I got this Tello Drone for Christmas a while back. Flying in circles was quite fun, but the control via the mobile phone was unfortunately not comfortable for me and I couldn't see anything on the small screen.
It quickly became boring and what does a developer do when he can't sleep at night: hacking.
🤓 Hacking
I first found the public text-based API. It was quite simple to integrate and I tried to control the drone with my GamePad. Unfortunately, movements like "20 cm to the left" are not compatible with a joystick. After some time, however, I came across https://tellopilots.com/. Some clever people took the trouble to dissect the API and document it. (https://tellopilots.com/wiki/development/)
Even though the Go implementation is probably the source of truth, the documentation is very good. Now there was only one problem. I want RUST.
After a few more hours of hacking, two broken propellers and luckily no fly-away, the time had come. Usable as SDK and implementable in any home-automation project. Who doesn't want drones to swarm out when someone rings the doorbell or comes in the driveway. 🙈
💡 Use it
The repo is on github: https://github.com/Alexander89/rust-tello with an example app to fly around with a joystick. You can easily receive the video stream with VNC.
Here is a small example of how the drone can be controlled via rust.
use tello::{Drone, Message, Package, PackageData, ResponseMsg};
use std::time::Duration;
fn main() -> Result<(), String> {
let mut drone = Drone::new("192.168.10.1:8889");
drone.connect(11111);
loop {
if let Some(msg) = drone.poll() {
match msg {
Message::Data(Package {data: PackageData::FlightData(d), ..}) => {
println!("battery {}", d.battery_percentage);
}
Message::Response(ResponseMsg::Connected(_)) => {
println!("connected");
drone.throw_and_go().unwrap();
}
_ => ()
}
}
::std::thread::sleep(Duration::new(0, 1_000_000_000u32 / 20));
}
}
Happy Hacking and stay tuned
Top comments (1)
My first Youtube video is finally released:
Rust SDK - DJI Tello Drone
youtube.com/watch?v=j5qqn2eOI2M