tasks: motion: move the entire motion prediction engine into the second core, dedicating core 1 to hardware
This commit is contained in:
@@ -4,7 +4,7 @@ use log::*;
|
||||
use crate::{ego::engine::BikeStates, events::{Measurement, Notification, Prediction, SensorSource, SensorState}};
|
||||
|
||||
#[embassy_executor::task]
|
||||
pub async fn motion_task(src: DynamicReceiver<'static, Measurement>, ui_sink: DynPublisher<'static, Notification>, prediction_sink: DynamicSender<'static, Prediction>) {
|
||||
pub async fn motion_task(src: DynamicReceiver<'static, Measurement>, prediction_sink: DynamicSender<'static, Prediction>) {
|
||||
let mut states = BikeStates::default();
|
||||
|
||||
loop {
|
||||
@@ -14,11 +14,11 @@ pub async fn motion_task(src: DynamicReceiver<'static, Measurement>, ui_sink: Dy
|
||||
match next_measurement {
|
||||
Measurement::IMU { accel, gyro } => {
|
||||
states.insert_imu(accel, gyro);
|
||||
states.commit(&prediction_sink, &ui_sink).await;
|
||||
states.commit(&prediction_sink).await;
|
||||
},
|
||||
Measurement::GPS(Some(gps_pos)) => {
|
||||
states.insert_gps(gps_pos);
|
||||
states.commit(&prediction_sink, &ui_sink).await;
|
||||
states.commit(&prediction_sink).await;
|
||||
},
|
||||
Measurement::GPS(None) => {
|
||||
states.has_gps_fix.set(false);
|
||||
@@ -26,7 +26,7 @@ pub async fn motion_task(src: DynamicReceiver<'static, Measurement>, ui_sink: Dy
|
||||
// FIXME: This needs harmonized with the automatic data timeout from above, somehow?
|
||||
Measurement::SensorHardwareStatus(source, state) => {
|
||||
warn!("Sensor {source:?} reports {state:?}!");
|
||||
ui_sink.publish(Notification::SensorStatus(source, state)).await;
|
||||
prediction_sink.send(Prediction::SensorStatus(source, state)).await;
|
||||
},
|
||||
Measurement::SimulationProgress(source, duration, _pct) => debug!("{source:?} simulation time: {}", duration.as_secs()),
|
||||
Measurement::Annotation => ()
|
||||
|
||||
@@ -87,6 +87,9 @@ pub async fn prediction_task(prediction_src: DynamicReceiver<'static, Prediction
|
||||
stationary = true
|
||||
}
|
||||
}
|
||||
},
|
||||
Prediction::SensorStatus(src, status) => {
|
||||
notify.publish(Notification::SensorStatus(src, status)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user