Skip to main content

LighthouseMemory

Struct LighthouseMemory 

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

Memory interface for lighthouse configuration data

This provides methods to read and write lighthouse base station geometry and calibration data to the Crazyflie.

Implementations§

Source§

impl LighthouseMemory

Source

pub const GEO_START_ADDR: usize = 0x00

Start address for geometry data

Source

pub const CALIB_START_ADDR: usize = 0x1000

Start address for calibration data

Source

pub const PAGE_SIZE: usize = 0x100

Size of one page (each base station uses one page)

Source

pub const MAX_BASE_STATIONS: usize = 16

Maximum number of base stations supported

Source

pub async fn read_geometry(&self, bs_id: u8) -> Result<LighthouseBsGeometry>

Read geometry data for a specific base station

§Arguments
  • bs_id - Base station ID (0-15)
§Returns

The geometry data, or an error if the read failed

Source

pub async fn write_geometry( &self, bs_id: u8, geometry: &LighthouseBsGeometry, ) -> Result<()>

Write geometry data for a specific base station

§Arguments
  • bs_id - Base station ID (0-15)
  • geometry - The geometry data to write
Source

pub async fn read_calibration( &self, bs_id: u8, ) -> Result<LighthouseBsCalibration>

Read calibration data for a specific base station

§Arguments
  • bs_id - Base station ID (0-15)
§Returns

The calibration data, or an error if the read failed

Source

pub async fn write_calibration( &self, bs_id: u8, calibration: &LighthouseBsCalibration, ) -> Result<()>

Write calibration data for a specific base station

§Arguments
  • bs_id - Base station ID (0-15)
  • calibration - The calibration data to write
Source

pub async fn read_all_geometries( &self, ) -> Result<HashMap<u8, LighthouseBsGeometry>>

Read all geometry data from the Crazyflie

Attempts to read geometry for all base stations (0-15). Only base stations with valid data are included in the result.

§Returns

A HashMap mapping base station ID to geometry data

Source

pub async fn read_all_geometries_with_progress<F>( &self, progress_callback: F, ) -> Result<HashMap<u8, LighthouseBsGeometry>>
where F: FnMut(usize, usize),

Read all geometry data with progress reporting

§Arguments
  • progress_callback - Called with (completed_count, total_count) after each read
Source

pub async fn read_all_calibrations( &self, ) -> Result<HashMap<u8, LighthouseBsCalibration>>

Read all calibration data from the Crazyflie

Attempts to read calibration for all base stations (0-15). Only base stations with valid data are included in the result.

§Returns

A HashMap mapping base station ID to calibration data

Source

pub async fn read_all_calibrations_with_progress<F>( &self, progress_callback: F, ) -> Result<HashMap<u8, LighthouseBsCalibration>>
where F: FnMut(usize, usize),

Read all calibration data with progress reporting

§Arguments
  • progress_callback - Called with (completed_count, total_count) after each read
Source

pub async fn write_geometries( &self, geometries: &HashMap<u8, LighthouseBsGeometry>, ) -> Result<()>

Write geometry data for multiple base stations

§Arguments
  • geometries - A HashMap mapping base station ID to geometry data
Source

pub async fn write_geometries_with_progress<F>( &self, geometries: &HashMap<u8, LighthouseBsGeometry>, progress_callback: F, ) -> Result<()>
where F: FnMut(usize, usize),

Write geometry data for multiple base stations with progress reporting

§Arguments
  • geometries - A HashMap mapping base station ID to geometry data
  • progress_callback - Called with (completed_count, total_count) after each write
Source

pub async fn write_calibrations( &self, calibrations: &HashMap<u8, LighthouseBsCalibration>, ) -> Result<()>

Write calibration data for multiple base stations

§Arguments
  • calibrations - A HashMap mapping base station ID to calibration data
Source

pub async fn write_calibrations_with_progress<F>( &self, calibrations: &HashMap<u8, LighthouseBsCalibration>, progress_callback: F, ) -> Result<()>
where F: FnMut(usize, usize),

Write calibration data for multiple base stations with progress reporting

§Arguments
  • calibrations - A HashMap mapping base station ID to calibration data
  • progress_callback - Called with (completed_count, total_count) after each write

Trait Implementations§

Source§

impl Debug for LighthouseMemory

Source§

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

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

impl FromMemoryBackend for LighthouseMemory

Source§

async fn from_memory_backend(memory: MemoryBackend) -> Result<Self>

Create a memory-specific type from a MemoryBackend. When created the memory is automatically read to populate the fields of the type. Read more
Source§

async fn initialize_memory_backend(memory: MemoryBackend) -> Result<Self>

Get a specific memory by its ID and initialize it according to the defaults. Note that the values will not be written to the memory by default, the user needs to handle this. Read more
Source§

fn close_memory(self) -> MemoryBackend

Close the memory and return the backend to the subsystem 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, 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.