pub struct Lighthouse { /* private fields */ }Expand description
Lighthouse positioning system interface
Provides functionality to receive lighthouse sweep angle data and manage lighthouse base station configuration persistence.
Implementations§
Source§impl Lighthouse
impl Lighthouse
Sourcepub async fn angle_stream(&self) -> impl Stream<Item = LighthouseAngleData>
pub async fn angle_stream(&self) -> impl Stream<Item = LighthouseAngleData>
Get a stream of lighthouse angle measurements
Returns a Stream that yields LighthouseAngleData whenever lighthouse sweep angle data is received from the Crazyflie. This is typically used for lighthouse base station calibration and geometry estimation.
To enable the angle stream, set the parameter locSrv.enLhAngleStream to 1
on the Crazyflie.
§Example
// Enable angle streaming
crazyflie.param.set("locSrv.enLhAngleStream", 1u8).await?;
let mut angle_stream = crazyflie.localization.lighthouse.angle_stream().await;
while let Some(data) = angle_stream.next().await {
println!("Base station {}: x={:?}, y={:?}",
data.base_station, data.angles.x, data.angles.y);
}Sourcepub async fn persist_lighthouse_data(
&self,
geo_list: &[u8],
calib_list: &[u8],
) -> Result<bool>
pub async fn persist_lighthouse_data( &self, geo_list: &[u8], calib_list: &[u8], ) -> Result<bool>
Persist lighthouse geometry and calibration data to permanent storage
Sends a command to persist lighthouse geometry and/or calibration data to permanent storage in the Crazyflie, then waits for confirmation. The geometry and calibration data must have been previously written to RAM via the memory subsystem.
§Arguments
geo_list- List of base station IDs (0-15) for which to persist geometry datacalib_list- List of base station IDs (0-15) for which to persist calibration data
§Returns
Ok(true)if data was successfully persistedOk(false)if persistence failedErrif there was a communication error or timeout (5 seconds)
§Example
// Persist geometry for base stations 0 and 1, calibration for base station 0
let success = crazyflie.localization.lighthouse
.persist_lighthouse_data(&[0, 1], &[0]).await?;
if success {
println!("Data persisted successfully");
}