tasks: simulation: refactor the simulation tasks to common types that can simulate any sensor

This commit is contained in:
2025-12-06 19:22:52 +01:00
parent 761dbb8951
commit 567cc0d6e5
3 changed files with 193 additions and 89 deletions

View File

@@ -80,11 +80,13 @@ pub enum Telemetry {
Prediction(Prediction),
}
// GPS data = 2, motion data = 1
#[derive(Debug, EnumSetType, Enum)]
pub enum SensorSource {
Unknown = 0,
// Real hardware
IMU,
GPS,
IMU = 1,
GPS = 2,
// Fusion outputs
GravityReference,
@@ -96,6 +98,16 @@ pub enum SensorSource {
Simulation
}
impl From<i8> for SensorSource {
fn from(value: i8) -> Self {
match value {
1 => SensorSource::IMU,
2 => SensorSource::GPS,
_ => SensorSource::Unknown
}
}
}
#[derive(Debug)]
pub struct BusGarage {
pub motion: Channel<NoopRawMutex, Measurement, 5>,