Skip to main content

TelemetryPacket

Struct TelemetryPacket 

Source
#[repr(C, packed(1))]
pub struct TelemetryPacket { pub timestamp_ms: u32, pub roll: f32, pub pitch: f32, pub yaw: f32, pub pos_z: f32, pub motor_fl: f32, pub motor_fr: f32, pub motor_rl: f32, pub motor_rr: f32, pub status_flags: u8, }
Expand description

A packed, fixed-size snapshot of the vehicle state.

§Binary Layout

This struct uses #[repr(C, packed)] to ensure a stable, predictable memory layout across different platforms. It is exactly 37 bytes (36 for data + 1 for flags).

FieldTypeOffset
timestamp_msu320
roll..pos_zf32 x 44-19
motor_fl..rrf32 x 420-35
status_flagsu836

Fields§

§timestamp_ms: u32

System uptime in milliseconds.

§roll: f32

Current Euler angles (Radians).

§pitch: f32§yaw: f32§pos_z: f32

Vertical position (Altitude) in meters (NED frame).

§motor_fl: f32

Normalized motor output [0.0 - 1.0].

§motor_fr: f32§motor_rl: f32§motor_rr: f32§status_flags: u8

Bitmask for system status:

  • Bit 0: Armed state (1 = Armed, 0 = Disarmed)
  • Bit 1: Failsafe active
  • Bit 2: Battery critical

Implementations§

Source§

impl TelemetryPacket

Source

pub fn new( timestamp_ms: u32, attitude: Attitude, pos: Position, motors: QuadMotorSignals, armed: bool, ) -> Self

Constructs a new telemetry snapshot from high-level GNC types.

Source

pub fn as_bytes(&self) -> &[u8]

Views the packet as a byte slice for transmission.

§Safety

This uses unsafe to cast the struct directly to a byte slice. This is safe as long as:

  1. The struct is #[repr(C, packed)].
  2. The slice does not outlive the struct instance.

Trait Implementations§

Source§

impl Clone for TelemetryPacket

Source§

fn clone(&self) -> TelemetryPacket

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TelemetryPacket

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for TelemetryPacket

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