use std::{sync::mpsc::RecvTimeoutError, time::Duration}; use px4sim::prelude::{get_boot_time, DroneData, DroneSimulator}; fn main() { let boot_time = get_boot_time(); let mut sim = DroneSimulator::new(5, boot_time, Some(("/home/balint/workspaces/px4", "10016"))); loop { match sim.recv_timeout(Duration::from_millis(10)) { Ok(data) => println!("Got {data:?}"), Err(RecvTimeoutError::Timeout) => {} Err(RecvTimeoutError::Disconnected) => break, } sim.send(DroneData::new() + DroneData::noise()).unwrap(); } sim.join().unwrap(); }