pub struct Tello<S = NoWifi> { /* private fields */ }
Expand description
For interacting with the Tello EDU drone using the simple text-based UDP protocol.
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
use tello_edu::{Tello, Result};
#[tokio::main]
async fn main() {
fly().await.unwrap();
}
async fn fly() -> Result<()> {
// create a new drone in the `NoWifi` state
let drone = Tello::new();
// wait until the host computer joins the drone's WiFi network
// (joining the network is not automatic - how it happens is up to you)
let drone = drone.wait_for_wifi().await?;
// establish connection and put the drone in "command" mode
let drone = drone.connect().await?;
// fly!
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
Implementations§
source§impl Tello<NoWifi>
impl Tello<NoWifi>
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new drone in a completely unconnected state.
Examples found in repository?
More examples
10 11 12 13 14 15 16 17 18 19 20 21
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
25 26 27 28 29 30 31 32 33 34 35 36 37
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.land().await?;
Ok(())
}
111 112 113 114 115 116 117 118 119 120 121 122 123 124
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn wait_for_wifi(&self) -> Result<Tello<Disconnected>>
pub async fn wait_for_wifi(&self) -> Result<Tello<Disconnected>>
Wait until the host joins the drone’s WiFi network
nb exactly how the the network is joined is up to you
Examples found in repository?
More examples
10 11 12 13 14 15 16 17 18 19 20 21
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
25 26 27 28 29 30 31 32 33 34 35 36 37
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.land().await?;
Ok(())
}
111 112 113 114 115 116 117 118 119 120 121 122 123 124
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn assume_wifi(&self) -> Result<Tello<Disconnected>>
pub async fn assume_wifi(&self) -> Result<Tello<Disconnected>>
Use this if you are already in the appropriate WiFi network.
source§impl Tello<Disconnected>
impl Tello<Disconnected>
sourcepub async fn connect(&self) -> Result<Tello<Connected>>
pub async fn connect(&self) -> Result<Tello<Connected>>
Connect to the drone using the default options, ie
- using the drone’s own WiFi
- drone address 192.168.10.1
- no state updates
- no video
Examples found in repository?
More examples
10 11 12 13 14 15 16 17 18 19 20 21
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.flip_left().await?;
drone.flip_right().await?;
drone.flip_forward().await?;
drone.flip_back().await?;
drone.land().await?;
Ok(())
}
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.move_up(50).await?;
drone.move_down(50).await?;
drone.move_left(50).await?;
drone.move_right(50).await?;
drone.move_forward(50).await?;
drone.move_back(50).await?;
drone.land().await?;
Ok(())
}
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
async fn wifi_wait_for_connection() -> Result<()>{
let drone = Tello::new();
println!("Created drone: {drone:?}");
let drone = drone.wait_for_wifi().await?;
println!("WiFi available, drone is now: {drone:?}");
let drone = drone.connect().await?;
println!("connected, drone is now: {drone:?}");
let drone = drone.disconnect().await?;
println!("disconnected, drone is now: {drone:?}");
Ok(())
}
sourcepub async fn connect_with(
&self,
options: TelloOptions
) -> Result<Tello<Connected>>
pub async fn connect_with( &self, options: TelloOptions ) -> Result<Tello<Connected>>
Connect to the drone using the given options
options
Connection options
Examples found in repository?
More examples
25 26 27 28 29 30 31 32 33 34 35 36 37
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.land().await?;
Ok(())
}
111 112 113 114 115 116 117 118 119 120 121 122 123 124
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let mut options = TelloOptions::default();
// we want state updates...
let mut state_receiver = options.with_state();
// ...so spawn task to receive them
tokio::spawn(async move {
loop {
let state = state_receiver.recv().await.unwrap();
println!("STATE {state:#?}");
}
});
// connect using these options
let drone = drone.connect_with(options).await?;
// go!
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
source§impl Tello<Connected>
impl Tello<Connected>
sourcepub async fn disconnect(&self) -> Result<Tello<Disconnected>>
pub async fn disconnect(&self) -> Result<Tello<Disconnected>>
Disconnect from the drone.
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
async fn wifi_wait_for_connection() -> Result<()>{
let drone = Tello::new();
println!("Created drone: {drone:?}");
let drone = drone.wait_for_wifi().await?;
println!("WiFi available, drone is now: {drone:?}");
let drone = drone.connect().await?;
println!("connected, drone is now: {drone:?}");
let drone = drone.disconnect().await?;
println!("disconnected, drone is now: {drone:?}");
Ok(())
}
sourcepub async fn send(&self, command: &str) -> Result<String>
pub async fn send(&self, command: &str) -> Result<String>
Sends a command to the drone using the simple Tello UDP protocol, returning the reponse.
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
command
the command to send, must be a valid Tello SDK command string
sourcepub async fn send_expect_ok(&self, command: &str) -> Result<()>
pub async fn send_expect_ok(&self, command: &str) -> Result<()>
Sends a command, resolving to an error if the response is not “ok”
command
the command to send, must be a valid Tello SDK command string
sourcepub async fn send_value_expect_ok<T: Display>(
&self,
command: &str,
value: T
) -> Result<()>
pub async fn send_value_expect_ok<T: Display>( &self, command: &str, value: T ) -> Result<()>
Sends a command with a single value, resolving to an error if the response is not “ok”
command
the command to send, must be a valid Tello SDK command stringvalue
the value to append to the command
sourcepub async fn send_expect_nothing(&self, command: &str) -> Result<()>
pub async fn send_expect_nothing(&self, command: &str) -> Result<()>
Sends a command, expecting no response at all from the drone.
command
the command to send, must be a valid Tello SDK command string
sourcepub async fn send_expect<T: FromStr>(&self, command: &str) -> Result<T>
pub async fn send_expect<T: FromStr>(&self, command: &str) -> Result<T>
Sends a command, expecting a response that can be parsed as type T
from the drone.
command
the command to send, must be a valid Tello SDK command string
sourcepub async fn serial_number(&self) -> Result<String>
pub async fn serial_number(&self) -> Result<String>
The unique drone serial number.
sourcepub async fn sdk_version(&self) -> Result<String>
pub async fn sdk_version(&self) -> Result<String>
The Tello SDK version.
sourcepub async fn wifi_signal_to_noise_ratio(&self) -> Result<u8>
pub async fn wifi_signal_to_noise_ratio(&self) -> Result<u8>
The WiFi signal to noise ratio as a percentage.
sourcepub async fn flight_time(&self) -> Result<u16>
pub async fn flight_time(&self) -> Result<u16>
The flight time in seconds, requested directly from the drone.
sourcepub async fn emergency_stop(&self) -> Result<()>
pub async fn emergency_stop(&self) -> Result<()>
Immediately stop all motors.
warning! this will make the drone drop like a brick!
sourcepub async fn take_off(&self) -> Result<()>
pub async fn take_off(&self) -> Result<()>
Take off and hover.
Examples found in repository?
More examples
10 11 12 13 14 15 16 17 18 19 20 21
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
25 26 27 28 29 30 31 32 33 34 35 36 37
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.land().await?;
Ok(())
}
111 112 113 114 115 116 117 118 119 120 121 122 123 124
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.flip_left().await?;
drone.flip_right().await?;
drone.flip_forward().await?;
drone.flip_back().await?;
drone.land().await?;
Ok(())
}
sourcepub async fn land(&self) -> Result<()>
pub async fn land(&self) -> Result<()>
Land and stop motors.
Examples found in repository?
More examples
10 11 12 13 14 15 16 17 18 19 20 21
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
25 26 27 28 29 30 31 32 33 34 35 36 37
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.land().await?;
Ok(())
}
111 112 113 114 115 116 117 118 119 120 121 122 123 124
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.flip_left().await?;
drone.flip_right().await?;
drone.flip_forward().await?;
drone.flip_back().await?;
drone.land().await?;
Ok(())
}
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.move_up(50).await?;
drone.move_down(50).await?;
drone.move_left(50).await?;
drone.move_right(50).await?;
drone.move_forward(50).await?;
drone.move_back(50).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn speed(&self) -> Result<f32>
pub async fn speed(&self) -> Result<f32>
The drone speed in cm/s, requested directly from the drone.
sourcepub async fn set_speed(&self, speed: u8) -> Result<()>
pub async fn set_speed(&self, speed: u8) -> Result<()>
Set the forward speed.
speed
Desired speed, 10-100 cm/s
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
// go away slowly
drone.set_speed(25).await?;
drone.move_forward(300).await?;
drone.turn_clockwise(180).await?;
// come back fast
drone.set_speed(100).await?;
drone.move_forward(300).await?;
drone.turn_clockwise(180).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn wait(&self, duration: Duration) -> Result<()>
pub async fn wait(&self, duration: Duration) -> Result<()>
Wait for the given length of time.
duration
The time to wait
sourcepub async fn turn_clockwise(&self, degrees: u16) -> Result<()>
pub async fn turn_clockwise(&self, degrees: u16) -> Result<()>
Turn clockwise.
degrees
Angle in degrees 1-360°
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
More examples
111 112 113 114 115 116 117 118 119 120 121 122 123 124
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
// go away slowly
drone.set_speed(25).await?;
drone.move_forward(300).await?;
drone.turn_clockwise(180).await?;
// come back fast
drone.set_speed(100).await?;
drone.move_forward(300).await?;
drone.turn_clockwise(180).await?;
drone.land().await?;
Ok(())
}
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let mut options = TelloOptions::default();
// we want state updates...
let mut state_receiver = options.with_state();
// ...so spawn task to receive them
tokio::spawn(async move {
loop {
let state = state_receiver.recv().await.unwrap();
println!("STATE {state:#?}");
}
});
// connect using these options
let drone = drone.connect_with(options).await?;
// go!
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn turn_counterclockwise(&self, degrees: u16) -> Result<()>
pub async fn turn_counterclockwise(&self, degrees: u16) -> Result<()>
Turn counter-clockwise.
degrees
Angle in degrees 1-360°
sourcepub async fn move_up(&self, distance: u16) -> Result<()>
pub async fn move_up(&self, distance: u16) -> Result<()>
Move straight up.
distance
Distance to travel, 20-500 cm
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.move_up(50).await?;
drone.move_down(50).await?;
drone.move_left(50).await?;
drone.move_right(50).await?;
drone.move_forward(50).await?;
drone.move_back(50).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn move_down(&self, distance: u16) -> Result<()>
pub async fn move_down(&self, distance: u16) -> Result<()>
Move straight down.
distance
Distance to travel, 20-500 cm
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.move_up(50).await?;
drone.move_down(50).await?;
drone.move_left(50).await?;
drone.move_right(50).await?;
drone.move_forward(50).await?;
drone.move_back(50).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn move_left(&self, distance: u16) -> Result<()>
pub async fn move_left(&self, distance: u16) -> Result<()>
Move straight left.
distance
Distance to travel, 20-500 cm
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.move_up(50).await?;
drone.move_down(50).await?;
drone.move_left(50).await?;
drone.move_right(50).await?;
drone.move_forward(50).await?;
drone.move_back(50).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn move_right(&self, distance: u16) -> Result<()>
pub async fn move_right(&self, distance: u16) -> Result<()>
Move straight right.
distance
Distance to travel, 20-500 cm
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.move_up(50).await?;
drone.move_down(50).await?;
drone.move_left(50).await?;
drone.move_right(50).await?;
drone.move_forward(50).await?;
drone.move_back(50).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn move_forward(&self, distance: u16) -> Result<()>
pub async fn move_forward(&self, distance: u16) -> Result<()>
Move straight forwards.
distance
Distance to travel, 20-500 cm
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.move_up(50).await?;
drone.move_down(50).await?;
drone.move_left(50).await?;
drone.move_right(50).await?;
drone.move_forward(50).await?;
drone.move_back(50).await?;
drone.land().await?;
Ok(())
}
More examples
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
// go away slowly
drone.set_speed(25).await?;
drone.move_forward(300).await?;
drone.turn_clockwise(180).await?;
// come back fast
drone.set_speed(100).await?;
drone.move_forward(300).await?;
drone.turn_clockwise(180).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn move_back(&self, distance: u16) -> Result<()>
pub async fn move_back(&self, distance: u16) -> Result<()>
Move straight backwards.
distance
Distance to travel, 20-500 cm
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.move_up(50).await?;
drone.move_down(50).await?;
drone.move_left(50).await?;
drone.move_right(50).await?;
drone.move_forward(50).await?;
drone.move_back(50).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn flip_left(&self) -> Result<()>
pub async fn flip_left(&self) -> Result<()>
Flip left.
nb fails if battery is low
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.flip_left().await?;
drone.flip_right().await?;
drone.flip_forward().await?;
drone.flip_back().await?;
drone.land().await?;
Ok(())
}
sourcepub async fn flip_right(&self) -> Result<()>
pub async fn flip_right(&self) -> Result<()>
Flip right.
nb fails if battery is low
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.flip_left().await?;
drone.flip_right().await?;
drone.flip_forward().await?;
drone.flip_back().await?;
drone.land().await?;
Ok(())
}
sourcepub async fn flip_forward(&self) -> Result<()>
pub async fn flip_forward(&self) -> Result<()>
Flip forward.
nb fails if battery is low
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.flip_left().await?;
drone.flip_right().await?;
drone.flip_forward().await?;
drone.flip_back().await?;
drone.land().await?;
Ok(())
}
sourcepub async fn flip_back(&self) -> Result<()>
pub async fn flip_back(&self) -> Result<()>
Flip back.
nb fails if battery is low
Examples found in repository?
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
async fn fly() -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect().await?;
drone.take_off().await?;
drone.flip_left().await?;
drone.flip_right().await?;
drone.flip_forward().await?;
drone.flip_back().await?;
drone.land().await?;
Ok(())
}
sourcepub async fn start_video(&self) -> Result<()>
pub async fn start_video(&self) -> Result<()>
Start video as stream of h264-encoded frames.
Use TelloOption::with_video()
to set up a channel for receiving the
video frames.
nb You must consume the frame data! The channel is unlimited and will eventually use up all available memory if you don’t.
Examples found in repository?
25 26 27 28 29 30 31 32 33 34 35 36 37
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.land().await?;
Ok(())
}
More examples
111 112 113 114 115 116 117 118 119 120 121 122 123 124
async fn fly(options:TelloOptions) -> Result<()> {
let drone = Tello::new()
.wait_for_wifi().await?;
let drone = drone.connect_with(options).await?;
drone.start_video().await?;
drone.take_off().await?;
drone.turn_clockwise(360).await?;
drone.land().await?;
Ok(())
}
sourcepub async fn stop_video(&self) -> Result<()>
pub async fn stop_video(&self) -> Result<()>
Stop video streaming.
sourcepub async fn remote_control(
&self,
left_right: i8,
forwards_backwards: i8,
up_down: i8,
yaw: i8
) -> Result<()>
pub async fn remote_control( &self, left_right: i8, forwards_backwards: i8, up_down: i8, yaw: i8 ) -> Result<()>
Remote control’
All arguments are -100 to 100 (not sure what units)
left_right
Movement sidewaysforwards_backwards
Forwards/backwardsup_down
Vertical movementyaw
Turn left or right