Skip to main content

MspClient

Struct MspClient 

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

ctx.msp — read and write raw MSP to a Betaflight / iNav / KISS FC through the host’s MSP byte plane. The sibling of MavlinkClient for an FC that speaks MSP; the codec that builds/parses the bytes is ados_protocol::msp.

Implementations§

Source§

impl MspClient

Source

pub async fn send(&self, msg_bytes: &[u8]) -> Result<Value, ClientError>

Send already-framed MSP bytes (build them with ados_protocol::msp). Gated on msp.write.

Source

pub async fn send_raw_rc(&self, channels: &[u16]) -> Result<Value, ClientError>

Convenience: send an MSP_SET_RAW_RC with the given PWM channel values (v2 framing). Builds the frame with the codec and sends it. Returns an error if a v1 encode were requested with too many channels (v2 never overflows). This is the command that flies the FC in a rate mode.

Source

pub async fn send_sticks( &self, roll: f32, pitch: f32, yaw: f32, throttle: f32, ) -> Result<Value, ClientError>

Send an MSP_SET_RAW_RC from NORMALIZED stick inputs, applying the codec’s stick scaling. roll/pitch/yaw are bipolar -1.0..=1.0 (centre 0 → 1500 µs); throttle is 0.0..=1.0 (idle 0 → 1000 µs, NOT centre). Channels are packed AETR [roll, pitch, throttle, yaw], the codebase convention (the ados-crsf bank + the GCS mapping).

This is the safe way to fly an MSP FC from a control loop: send_raw_rc takes RAW PWM and applies NO scaling, so handing it normalized sticks sends near-centre garbage (and a 0.0 throttle would sit at 0, not idle). Prefer this whenever the loop produces normalized commands.

Source

pub async fn subscribe( &self, callback: EventCallback, ) -> Result<(), ClientError>

Subscribe to the raw FC->host MSP byte stream. The callback fires for each delivered chunk with the {bytes, timestamp_ms} map; the plugin’s own codec parses bytes. Gated on msp.read.

Trait Implementations§

Source§

impl Clone for MspClient

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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