tasks: simulation: refactor the simulation tasks to common types that can simulate any sensor
This commit is contained in:
@@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user