Struct tello::Drone [−][src]
Expand description
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
Implementations
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();
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.
convert the command into a Vec
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
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
SendDateTime sends the current date/time to the drone.
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();
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.
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();
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();
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();