Skip to main content

Platform

Struct Platform 

Source
pub struct Platform { /* private fields */ }
Expand description

Access to platform services

See the platform module documentation for more context and information.

Implementations§

Source§

impl Platform

Access to the platform services

Source

pub async fn protocol_version(&self) -> Result<u8>

Fetch the protocol version from Crazyflie

The protocol version is updated when new message or breaking change are implemented in the protocol. see the crate documentation for more information.

Compatibility is checked at connection time.

Source

pub async fn firmware_version(&self) -> Result<String>

Fetch the firmware version

If this firmware is a stable release, the release name will be returned for example 2021.06. If this firmware is a git build, between releases, the number of commit since the last release will be added for example 2021.06 +128.

Source

pub async fn device_type_name(&self) -> Result<String>

Fetch the device type.

The Crazyflie firmware can run on multiple device. This function returns the name of the device. For example Crazyflie 2.1 is returned in the case of a Crazyflie 2.1.

Source

pub async fn get_app_channel( &self, ) -> Option<(impl Sink<AppChannelPacket> + use<>, impl Stream<Item = AppChannelPacket> + use<>)>

Get sender and receiver to the app channel

This function returns the transmit and receive channel to and from the app channel. The channel accepts and generates AppChannelPacket which guarantees that the packet length is correct. the From trait is implemented to all possible [u8; n] and TryFrom to Vec for AppChannelPacket.

Source

pub async fn set_cont_wave(&self, activate: bool) -> Result<()>

Set radio in continious wave mode

If activate is set to true, the Crazyflie’s radio will transmit a continious wave at the current channel frequency. This will be active until the Crazyflie is reset or this function is called with activate to false.

Setting continious wave will:

  • Disconnect the radio link. So this function should practically only be used when connected over USB
  • Jam any radio running on the same frequency, this includes Wifi and Bluetooth

As such, this shall only be used for test purpose in a controlled environment.

Source

pub async fn send_arming_request(&self, do_arm: bool) -> Result<()>

Send system arm/disarm request

Arms or disarms the Crazyflie’s safety systems. When disarmed, the motors will not spin even if thrust commands are sent.

§Arguments
  • do_arm - true to arm, false to disarm
Source

pub async fn send_crash_recovery_request(&self) -> Result<()>

Send crash recovery request

Requests recovery from a crash state detected by the Crazyflie.

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, 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>,

Source§

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>,

Source§

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.