-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0a5fd4
commit fe12816
Showing
13 changed files
with
1,177 additions
and
195 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
[package] | ||
name = "tello" | ||
description = "SDK for intel DJI Tello drone using the native api" | ||
version = "0.5.2" | ||
version = "0.6.0" | ||
authors = ["Alex Halemba <[email protected]>"] | ||
edition = "2018" | ||
repository = "https://github.com/Alexander89/rust-tello" | ||
license-file = "./LICENCE" | ||
license = "MIT" | ||
readme = "./README.md" | ||
keywords = ["Drone", "Tello", "Ryze", "DJI", "RyzeRobotics"] | ||
documentation = "https://docs.rs/tello" | ||
|
@@ -26,18 +27,28 @@ path = "examples/fly_gamepad/main.rs" | |
name = "command_mode" | ||
path = "examples/command_mode/main.rs" | ||
|
||
[[example]] | ||
name = "command_mode_tokio" | ||
path = "examples/command_mode_tokio/main.rs" | ||
required-features = ["tokio_async"] | ||
|
||
[[example]] | ||
name = "command_mode_keyboard" | ||
path = "examples/command_mode_keyboard/main.rs" | ||
|
||
[dependencies] | ||
byteorder = "1.4" | ||
chrono = "0.4.19" | ||
tokio = { version = "1.11.0", features = ["net", "rt", "sync", "macros", "rt-multi-thread"], optional = true } | ||
tokio-stream = { version = "0.1.7", optional = true } | ||
|
||
[dev-dependencies] | ||
sdl2 = {version = "0.34.5", features = ["ttf"]} | ||
# glib = "0.9" | ||
# gstreamer = "0.15" | ||
# gstreamer-video = "0.15" | ||
gilrs = "0.7.2" | ||
gilrs = "0.7.4" | ||
futures = "0.3.16" | ||
|
||
[features] | ||
tokio_async = ["tokio", "tokio-stream"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use std::time::Duration; | ||
use tello::Drone; | ||
use tokio::{select, time::sleep}; | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), String> { | ||
let mut drone = Drone::new("192.168.10.1:8889").command_mode(); | ||
// let mut drone = Drone::new("127.0.0.1:8880").command_mode(); | ||
drone.enable().await?; | ||
|
||
let mut state = drone.state_receiver().unwrap(); | ||
|
||
loop { | ||
let path = async { | ||
for _ in 0..6 { | ||
println!("forward {:?}", drone.forward(30).await); | ||
sleep(Duration::from_secs(5)).await; | ||
println!("cw {:?}", drone.cw(60).await); | ||
sleep(Duration::from_secs(4)).await; | ||
} | ||
println!("land {:?}", drone.land().await); | ||
}; | ||
|
||
select! { | ||
_ = state.changed() => { | ||
if let Some(s) = state.borrow_and_update().clone() { | ||
println!( "Battery {}% Height {}dm POS {:?}", s.bat, s.h, drone.odometry ); | ||
} | ||
}, | ||
_ = path => { | ||
println!("done"); | ||
break; | ||
} | ||
} | ||
} | ||
sleep(Duration::from_secs(3)).await; | ||
Ok(()) | ||
} |
Oops, something went wrong.