Rust SDK – DJI Tello Drone

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…


This content originally appeared on DEV Community and was authored by Alexander Halemba

Tello Drone

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


This content originally appeared on DEV Community and was authored by Alexander Halemba


Print Share Comment Cite Upload Translate Updates
APA

Alexander Halemba | Sciencx (2021-08-11T10:01:55+00:00) Rust SDK – DJI Tello Drone. Retrieved from https://www.scien.cx/2021/08/11/rust-sdk-dji-tello-drone/

MLA
" » Rust SDK – DJI Tello Drone." Alexander Halemba | Sciencx - Wednesday August 11, 2021, https://www.scien.cx/2021/08/11/rust-sdk-dji-tello-drone/
HARVARD
Alexander Halemba | Sciencx Wednesday August 11, 2021 » Rust SDK – DJI Tello Drone., viewed ,<https://www.scien.cx/2021/08/11/rust-sdk-dji-tello-drone/>
VANCOUVER
Alexander Halemba | Sciencx - » Rust SDK – DJI Tello Drone. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/08/11/rust-sdk-dji-tello-drone/
CHICAGO
" » Rust SDK – DJI Tello Drone." Alexander Halemba | Sciencx - Accessed . https://www.scien.cx/2021/08/11/rust-sdk-dji-tello-drone/
IEEE
" » Rust SDK – DJI Tello Drone." Alexander Halemba | Sciencx [Online]. Available: https://www.scien.cx/2021/08/11/rust-sdk-dji-tello-drone/. [Accessed: ]
rf:citation
» Rust SDK – DJI Tello Drone | Alexander Halemba | Sciencx | https://www.scien.cx/2021/08/11/rust-sdk-dji-tello-drone/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.