[][src]Struct parrot_ar_drone::Communication

pub struct Communication {
    pub drone_ip: String,
    pub nav_data_port: u32,
    pub video_port: u32,
    pub cmd_port: u32,
    pub ctl_port: u32,
    pub rec_port: u32,
    // some fields omitted
}

Component that is responsible for the communication between the drone and this API.

Fields

drone_ip: String

The drones IP (default is 192.168.1.1)

nav_data_port: u32

UDP port (default 5554) from which we receive Navigation Data

video_port: u32

UDP port (default 5555) from which we receive the video image. It should be readable by OpenCV without any fancy processing

cmd_port: u32

UDP port (default 5556) to which we send commands

ctl_port: u32

TCP port (default 5559) from which we get config information

rec_port: u32

TCP port (default 5553) from which we get the recording

Methods

impl Communication[src]

pub fn new() -> Communication[src]

Returns a Communication struct with default settings, if you didn't do any fancy shenanigans with the drones settings, this should be enough for you.

pub fn try_connection(&self) -> bool[src]

Tries connecting to the drone (may hang on routers which have the drones ip (default 192.168.1.1)

pub fn command(&mut self, command: &str, params: Vec<String>)[src]

Pushes a command to the send queue, every 50 ms a command is sent, if no command is in queue then every 200 ms a keepalive command is sent.

pub fn command_str(&mut self, command: &str, params: Vec<&str>)[src]

Same as command, however it takes Vec<&str> and converts is himself

pub fn start_connection(&mut self, echo_commands: &bool) -> Result<(), String>[src]

Initialises the connection with the drone, sends 2 commands which seem to initialize the drone (taken from ps_drone). Creates a separate thread to deal with sending these commands and the keepalive sign. Parameters: echo_commands: Should it print every command sent? (except keepalives)

pub fn shutdown_connection(&mut self)[src]

Shuts down the communication thread and the connection to the drone

pub fn get_ctl_tcp_connection(&self) -> Result<TcpStream, String>[src]

pub fn get_navdata_udp_connection(&self) -> Result<UdpSocket, String>[src]

pub fn get_video_udp_connection(&self) -> Result<UdpSocket, String>[src]

pub fn get_record_tcp_connection(&self) -> Result<TcpStream, String>[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.