Struct crazyflie_lib::Crazyflie

source ·
pub struct Crazyflie {
    pub log: Log,
    pub param: Param,
    pub commander: Commander,
    pub console: Console,
    pub platform: Platform,
    /* private fields */
}
Expand description

§The Crazyflie

This struct is one-time use: Creating it will connect to a Crazyflie and once disconnected, either as requested by the lib user or as a result of a connection loss, the object cannot be reconnected. A new one need to be created to connect again.

See the crazyflie-lib crate root documentation for more context and information.

Fields§

§log: Log

Log subsystem access

§param: Param

Parameter subsystem access

§commander: Commander

Commander/setpoint subsystem access

§console: Console

Console subsystem access

§platform: Platform

Platform services

Implementations§

source§

impl Crazyflie

source

pub async fn connect_from_uri( executor: impl Executor, link_context: &LinkContext, uri: &str ) -> Result<Self>

Open a Crazyflie connection to a given URI

This function opens a link to the given URI and calls Crazyflie::connect_from_link() to connect the Crazyflie.

The executor argument should be an async executor from the crate async_executors. See example in the crate root documentation.

An error is returned either if the link cannot be opened or if the Crazyflie connection fails.

Connect a Crazyflie using an existing link

Connect a Crazyflie using an existing connected link.

The executor argument should be an async executor from the crate async_executors. See example in the crate root documentation.

This function will return an error if anything goes wrong in the connection process.

source

pub async fn disconnect(&self)

Disconnect the Crazyflie

The Connection can be ended in two ways: either by dropping the Crazyflie object or by calling this disconnect() function. Once this function return, the Crazyflie is fully disconnected.

Once disconnected, any methods that uses the communication to the Crazyflie will return the error Error::Disconnected

source

pub async fn wait_disconnect(&self) -> String

Wait for the Crazyflie to be disconnected

This function waits for the Crazyflie link to close and for the Crazyflie to fully disconnect. It returns a string describing the reason for the disconnection.

One intended use if to call and block on this function from an async task to detect a disconnection and, for example, update the state of a GUI.

Trait Implementations§

source§

impl Drop for Crazyflie

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more