Crates.io | ufo_rs |
lib.rs | ufo_rs |
version | 0.1.1 |
source | src |
created_at | 2019-04-03 19:54:55.99051 |
updated_at | 2019-04-04 00:31:27.418875 |
description | A Drone/UAV/Quad copter programming library for Rust |
homepage | |
repository | |
max_upload_size | |
id | 125718 |
size | 23,709 |
A Drone/UAV/Quadcopter/RC Plane
programming library for Rust
.
FYI: this is still a WIP, the traits and structs exist, but examples and documentation are lacking... Proceed with caution.
Add this to your Cargo.toml
[dependencies]
ufo_rs = "*"
And put something like this in src/main.rs
/// Import std stuff
use std::error::Error;
use std::time::Duration;
use std::thread;
// Import traits
use ufo_rs::traits::control::*;
use ufo_rs::traits::drone::*;
// Import controller
use ufo_rs::drones::jjrc::h61;
fn main() -> Result<(), Box<dyn Error>> {
let delay = Duration::from_millis(2000);
// Create a new drone driver
let mut driver = h61::Driver::new();
// Connect to drone
driver.connect()?;
// Calibrate drone
println!("Calibrating...");
driver.calibrate()?;
println!("Sent!");
// Wait 2 seconds
thread::sleep(delay);
// Take off
println!("Taking off...");
driver.take_off()?;
println!("Sent!");
// Wait again for 1 second
thread::sleep(Duration::from_millis(1000));
// Land
println!("Landing...");
driver.land()?;
println!("Sent!");
// Ta-dah!
Ok(())
}
See the examples/
directory for more information.
If you want to help with U.F.O, we could use support in two areas:
U.F.O.
is a safe and stable way to program drones. If we can find areas prone to bugs, we can build a more stable library quickly.src/drones/jjrc/h61.rs
.Inspired by:
Go
Rust