[−][src]Struct parrot_ar_drone::Drone
This is the main component you can access/control everything from here.
Methods
impl Drone
[src]
pub fn new() -> Drone
[src]
Returns a Drone object with default settings.
pub fn startup(&mut self) -> Result<(), String>
[src]
Initializes connection to the drone, starts navdata, control, and config threads. Sends basic commands to the drone to initialize it.
use parrot_ar_drone::*; fn main() { let mut drone = Drone::new(); drone.startup(); // Commands... }
pub fn trim(&mut self)
[src]
Tells the drone that it is horizontal (parallel to the ground).
Do this only when the drone is on the ground!
pub fn mtrim(&mut self)
[src]
pub fn mantrim(&mut self, theta: f32, phi: f32, yaw: f32)
[src]
pub fn mov(
&mut self,
left_right: f32,
back_front: f32,
down_up: f32,
turn_left_right: f32
)
[src]
&mut self,
left_right: f32,
back_front: f32,
down_up: f32,
turn_left_right: f32
)
The most basic move command.
Parameters: Speed from left ([-1.0, 0.0)) to right ((0.0, 1.0]) or none (0.0)
Speed from back ([-1.0, 0.0)) to front ((0.0, 1.0]) or none (0.0)
Speed from down ([-1.0, 0.0)) to up ((0.0, 1.0]) or none (0.0)
Turn rate from left ([-1.0, 0.0)) to right ((0.0, 1.0]) or none (0.0)
pub fn rel_mov(
&mut self,
left_right: f32,
back_front: f32,
down_up: f32,
turn_left_right: f32,
east_west: f32,
north_ta_accuracy: f32
)
[src]
&mut self,
left_right: f32,
back_front: f32,
down_up: f32,
turn_left_right: f32,
east_west: f32,
north_ta_accuracy: f32
)
Move relative to the controller
pub fn hover(&mut self)
[src]
Stops all movement and turns
pub fn stop(&mut self)
[src]
Same as hover
pub fn mov_right(&mut self, speed: f32)
[src]
This method requires explicit speed to be given to it from [-1.0, 1.0]
If you want to use the drones default speed use move_right()
pub fn mov_left(&mut self, speed: f32)
[src]
This method requires explicit speed to be given to it from [-1.0, 1.0]
If you want to use the drones default speed use move_left()
pub fn mov_forward(&mut self, speed: f32)
[src]
This method requires explicit speed to be given to it from [-1.0, 1.0]
If you want to use the drones default speed use move_forward()
pub fn mov_backward(&mut self, speed: f32)
[src]
This method requires explicit speed to be given to it from [-1.0, 1.0]
If you want to use the drones default speed use move_backward()
pub fn mov_up(&mut self, speed: f32)
[src]
This method requires explicit speed to be given to it from [-1.0, 1.0]
If you want to use the drones default speed use move_up()
pub fn mov_down(&mut self, speed: f32)
[src]
This method requires explicit speed to be given to it from [-1.0, 1.0]
If you want to use the drones default speed use move_down()
pub fn move_right(&mut self)
[src]
This method uses the drones default speed
If you want to give an explicit speed use move_right()
pub fn move_left(&mut self)
[src]
This method uses the drones default speed
If you want to give an explicit speed use mov_left()
pub fn move_forward(&mut self)
[src]
This method uses the drones default speed
If you want to give an explicit speed use mov_forward()
pub fn move_backward(&mut self)
[src]
This method uses the drones default speed
If you want to give an explicit speed use mov_backward()
pub fn move_up(&mut self)
[src]
This method uses the drones default speed If you want to give an explicit speed use mov_up()
pub fn move_down(&mut self)
[src]
This method uses the drones default speed
If you want to give an explicit speed use mov_down()
pub fn turn_right(&mut self, turn_rate: f32)
[src]
This method requires explicit turn rate to be given to it from [-1.0, 1.0]
pub fn turn_left(&mut self, turn_rate: f32)
[src]
This method requires explicit turn rate to be given to it from [-1.0, 1.0]
pub fn takeoff(&mut self)
[src]
Makes the drone take off
Message conforms SDK documentation
290718208=10001010101000000001000000000
Initializes connection to the drone, starts navdata, control, and config threads. Sends basic commands to the drone to initialize it.
use parrot_ar_drone::*; use time::Duration; use thread; fn main() { let mut drone = Drone::new(); drone.startup(); drone.takeoff(); thread::sleep(Duration::from_secs(5)) drone.mov_forward(0.5); thread::sleep(Duration::from_secs(2)) drone.hover(); thread::sleep(Duration::from_secs(5)) drone.land(); drone.shutdown(); }
pub fn land(&mut self)
[src]
Makes the drone land
Message conforms SDK documentation
290717696=10001010101000000000000000000
pub fn reset(&mut self)
[src]
Resets the drone in case the last landing was crashlanding.
Message conforms SDK documentation
290717952=10001010101000000000100000000
pub fn led(&mut self, anim: usize, frequency: f32, duration: i32)
[src]
Do a preset led animation (anim < 21; duration in seconds)
pub fn anim(&mut self, anim: usize, duration: i32)
[src]
Execute a preset movement (anim < 20; duration in seconds)
pub fn manual_engine(&mut self, fl: u32, fr: u32, rl: u32, rr: u32)
[src]
Control engines thrust manually (could be potentially dangerous)
Parameters in order are: front-left, front-right, rear-left, rear-right
All values should be between in [0, 1023], use at
pub fn aflight(&mut self, flag: bool)
[src]
This makes the drone fly around and follow 2D tags detected by it's camera
pub fn set_speed(&mut self, speed: f32)
[src]
Set the default seed of the drone that will be used in the move functions.
This value should be in the [0, 1.0] range
pub fn update_config(&mut self)
[src]
Requests an updated config from the drone
pub fn get_offline_config(&mut self, config_name: &str) -> Option<String>
[src]
This function doesn't guarantee that the config read is up to date!
To be sure please use the update_config function before this and
wait a little, to give time to the config thread to process the changes
pub fn send_config_ids(&mut self)
[src]
pub fn set_config(&mut self, config_name: &str, config_value: String)
[src]
This function sends a config to the drone, however it does not check if
the drone has gotten the command or not.
pub fn set_config_str(&mut self, config_name: &str, config_value: &str)
[src]
Same as set_config but this uses &str for config_value
pub fn use_demo_mode(&mut self, value: bool)
[src]
Enters the drone into demo mode
pub fn set_video_codec(&mut self, codec: VideoCodec)
[src]
Sets the codec that will be used by the drone for streaming and recording.
pub fn set_hd_video_stream(&mut self)
[src]
Stream (UDP 5555) will be in HD (H264_720p) and there will be nothing sent to the recording port (TCP 5553)
pub fn set_sd_video_stream(&mut self)
[src]
Stream (UDP 5555) will be in SD (H264_360p) and there will be nothing sent to the recording port (TCP 5553)
pub fn set_mp4_video_stream(&mut self)
[src]
Stream (UDP 5555) will be in SD (MP4_360p) and there will be nothing sent to the recording port (TCP 5553)
pub fn set_hd_video_capture(&mut self)
[src]
Stream (UDP 5555) will be in SD (MP4_360p) and a HD (H264_720p) capture will be sent to the recording port (TCP 5553)
pub fn set_sd_video_capture(&mut self)
[src]
Stream (UDP 5555) will be in SD (MP4_360p) and a SD (H264_360p) capture will be sent to the recording port (TCP 5553)
pub fn set_video_fps(&mut self, fps: u32)
[src]
Set the FPS for the video on (UDP 5555)
pub fn set_video_bitrate(&mut self, bitrate: u32)
[src]
Set the FPS for the video on (UDP 5555)
pub fn use_front_cam(&mut self)
[src]
Tells the drone to use it's front cam, for recording and streaming
pub fn use_ground_cam(&mut self)
[src]
Tells the drone to use it's ground cam, for recording and streaming
pub fn get_navdata(&mut self, name: &str) -> Option<NavDataValue>
[src]
Get Navdata from the drone (currently only supports DEMO mode)
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>,