Crate crazyflie_lib

Source
Expand description

§Crazyflie library

This crate allows to connect, communicate with and control the Crazyflie using the crazyflie-link crate to open a communication link. The link implementation only supports radio for now, but more will be implemented in the future (at least USB).

§Status

The crate aims at implementing a Rust API to control the Crazyflie. The Crazyflie functionalities are implemented in subsystems. The current status is:

SubsystemSupport
App channelNone
CommanderPartial (only RPYT)
ConsoleFull
High-level CommanderNone
LocalizationNone
LogFull (V2)
MemoryNone
ParamFull(V2)
PlatformFull

§Compatibility

This crate is compatible with Crazyflie protocol version > 4. This means Crazyflie firmware release >= 2018.08.

The Crazyflie guarantees backward functionalities for one protocol version so this lib will be compatible with version 4 (~2018-08) and 5 (future) of the protocol.

§Usage

The basic procedure to use the lib is:

  • Find the link URI to connect, either by scanning or as a config or user input
  • Create a Crazyflie object from the URI or a connected Link, this will connect to the Crazyflie and initializes the subsystems
  • Subsystems are available as public fields of the Crazyflie struct.
  • Use the subsystems in the Crazyflie object to control the Crazyflie
  • Drop the Crazyflie object or call crazyflie::Crazyflie::disconnect()

All subsystems functions are only taking an un-mutable reference to self (&self), the intention is for the Crazyflie object to be shared between tasks using Arc<> or Rc<>.

For example:

let link_context = crazyflie_link::LinkContext::new();

// Scan for Crazyflies on the default address
let found = link_context.scan([0xE7; 5]).await?;

if let Some(uri) = found.first() {
    let cf = crazyflie_lib::Crazyflie::connect_from_uri(&link_context, uri).await?;

    println!("List of params variables: ");
    for name in cf.param.names() {
        println!(" - {}", name);
    }

    println!("List of log variables: ");
    for name in cf.param.names() {
        println!(" - {}", name);
    }

    cf.disconnect().await;
}

Modules§

subsystems
Crazyflie subsystems

Structs§

Crazyflie
The Crazyflie

Enums§

Error
Error enum type
Value
Typed data value
ValueType
Value type

Constants§

SUPPORTED_PROTOCOL_VERSION
Supported protocol version

Type Aliases§

Result
Result alias for return types of the crate API