[−][src]Struct tello::Drone
Main connection and controller for the drone
Fields
rc_state: RCState
remote control values to control the drone
drone_meta: DroneMeta
current meta data from the drone
Methods
impl Drone
[src]
pub fn new(ip: &str) -> Drone
[src]
create a new drone and and listen to the Response port 8889 this struct implements a number of commands to control the drone
After connection to the drone it is very important to poll the drone at least with 20Hz. This will acknowledge some messages and parse the state of the drone.
Example
let mut drone = Drone::new("192.168.10.1:8889"); drone.connect(11111); // wait for the connection drone.take_off();
pub fn connect(&mut self, video_port: u16) -> usize
[src]
Connect to the drone and inform the drone on with port you are ready to receive the video-stream
The Video stream do not start automatically. You have to start it with
drone.start_video()
and pool every key-frame with an additional drone.start_video()
call.
pub fn send(&self, command: UdpCommand) -> Result<(), ()>
[src]
convert the command into a Vec
pub fn poll(&mut self) -> Option<Message>
[src]
poll data from drone and send common data to the drone
- every 33 millis, the sick command is send to the drone
- every 1 sec, a key-frame is requested from the drone
- logMessage packages are replied immediately with an ack package
- dateTime packages are replied immediately with the local SystemTime
- after the third status message some default data are send to the drone
To receive a smooth video stream, you should poll at least 35 times per second
impl Drone
[src]
pub fn take_off(&self) -> Result<(), ()>
[src]
pub fn throw_and_go(&self) -> Result<(), ()>
[src]
pub fn land(&self) -> Result<(), ()>
[src]
pub fn stop_land(&self) -> Result<(), ()>
[src]
pub fn palm_land(&self) -> Result<(), ()>
[src]
pub fn flip(&self, direction: Flip) -> Result<(), ()>
[src]
pub fn bounce(&self) -> Result<(), ()>
[src]
pub fn bounce_stop(&self) -> Result<(), ()>
[src]
pub fn get_version(&self) -> Result<(), ()>
[src]
pub fn get_alt_limit(&self) -> Result<(), ()>
[src]
pub fn set_alt_limit(&self, limit: u8) -> Result<(), ()>
[src]
pub fn get_att_angle(&self) -> Result<(), ()>
[src]
pub fn set_att_angle(&self) -> Result<(), ()>
[src]
pub fn get_battery_threshold(&self) -> Result<(), ()>
[src]
pub fn set_battery_threshold(&self, threshold: u8) -> Result<(), ()>
[src]
pub fn get_region(&self) -> Result<(), ()>
[src]
pub fn send_stick(
&self,
pitch: f32,
nick: f32,
roll: f32,
yaw: f32,
fast: bool
) -> Result<(), ()>
[src]
&self,
pitch: f32,
nick: f32,
roll: f32,
yaw: f32,
fast: bool
) -> Result<(), ()>
send the stick command via udp to the drone
pitch up/down -1 -> 1 nick forward/backward -1 -> 1 roll right/left -1 -> 1 yaw cw/ccw -1 -> 1
pub fn send_date_time(&self) -> Result<(), ()>
[src]
SendDateTime sends the current date/time to the drone.
pub fn add_time(command: UdpCommand) -> UdpCommand
[src]
pub fn add_date_time(command: UdpCommand) -> UdpCommand
[src]
impl Drone
[src]
pub fn start_video(&mut self) -> Result<(), ()>
[src]
start_video starts the streaming and requests the info (SPS/PPS) for the video stream.
Video-metadata: e.g.: caps = video/x-h264, stream-format=(string)avc, width=(int)960, height=(int)720, framerate=(fraction)0/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, alignment=(string)au, profile=(string)main, level=(string)4, codec_data=(buffer)014d4028ffe10009674d402895a03c05b901000468ee3880
Examples
let mut drone = Drone::new("192.168.10.1:8889"); drone.connect(11111); // ... drone.start_video().unwrap();
pub fn poll_key_frame(&mut self) -> Result<(), ()>
[src]
Same as start_video(), but a better name to poll the (SPS/PPS) for the video stream.
This is automatically called in the poll function every second.
pub fn set_video_mode(&mut self, mode: VideoMode) -> Result<(), ()>
[src]
Set the video mode to 960x720 4:3 video, or 1280x720 16:9 zoomed video. 4:3 has a wider field of view (both vertically and horizontally), 16:9 is crisper.
Examples
let mut drone = Drone::new("192.168.10.1:8889"); drone.connect(11111); // ... drone.set_video_mode(VideoMode::M960x720).unwrap();
pub fn set_exposure(&mut self, level: u8) -> Result<(), ()>
[src]
Set the camera exposure level. param level: it can be 0, 1 or 2
Examples
let mut drone = Drone::new("192.168.10.1:8889"); drone.connect(11111); // ... drone.set_exposure(2).unwrap();
pub fn set_video_bitrate(&mut self, rate: u8) -> Result<(), ()>
[src]
set the video encoder rate for the camera. param rate: TODO: unknown
Examples
let mut drone = Drone::new("192.168.10.1:8889"); drone.connect(11111); // ... drone.set_video_bitrate(3).unwrap();
pub fn take_picture(&self) -> Result<(), ()>
[src]
take a single picture and provide it to download it.
Examples
let mut drone = Drone::new("192.168.10.1:8889"); drone.connect(11111); // ... drone.take_picture(3).unwrap(); @TODO: download image
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Drone
impl Send for Drone
impl Sync for Drone
impl Unpin for Drone
impl UnwindSafe for Drone
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,