//! Sensor fusion for autonomous vehicles use crate::{VisionResult, VisionError}; use crate::detection::three_d::BoundingBox3D; use crate::autonomous::{SensorFrame, TrackedObject}; /// Multi-sensor fusion system pub struct SensorFusion { fusion_method: FusionMethod, } impl SensorFusion { pub fn new() -> VisionResult { Ok(Self { fusion_method: FusionMethod::EarlyFusion, }) } /// Fuse detections from multiple sensors pub fn fuse_detections(&self, detections: &[BoundingBox3D], frame: &SensorFrame) -> VisionResult> { match self.fusion_method { FusionMethod::EarlyFusion => self.early_fusion(detections, frame), FusionMethod::LateFusion => self.late_fusion(detections, frame), FusionMethod::DeepFusion => self.deep_fusion(detections, frame), } } fn early_fusion(&self, detections: &[BoundingBox3D], _frame: &SensorFrame) -> VisionResult> { // Combine sensor data before processing Ok(detections.to_vec()) } fn late_fusion(&self, detections: &[BoundingBox3D], _frame: &SensorFrame) -> VisionResult> { // Combine detection results after individual processing Ok(detections.to_vec()) } fn deep_fusion(&self, detections: &[BoundingBox3D], _frame: &SensorFrame) -> VisionResult> { // Neural network-based fusion Ok(detections.to_vec()) } } /// Fusion methods #[derive(Debug, Clone, Copy)] pub enum FusionMethod { EarlyFusion, LateFusion, DeepFusion, }