50 lines
1.6 KiB
Rust
50 lines
1.6 KiB
Rust
//! 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<Self> {
|
|
Ok(Self {
|
|
fusion_method: FusionMethod::EarlyFusion,
|
|
})
|
|
}
|
|
|
|
/// Fuse detections from multiple sensors
|
|
pub fn fuse_detections(&self, detections: &[BoundingBox3D], frame: &SensorFrame) -> VisionResult<Vec<BoundingBox3D>> {
|
|
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<Vec<BoundingBox3D>> {
|
|
// Combine sensor data before processing
|
|
Ok(detections.to_vec())
|
|
}
|
|
|
|
fn late_fusion(&self, detections: &[BoundingBox3D], _frame: &SensorFrame) -> VisionResult<Vec<BoundingBox3D>> {
|
|
// Combine detection results after individual processing
|
|
Ok(detections.to_vec())
|
|
}
|
|
|
|
fn deep_fusion(&self, detections: &[BoundingBox3D], _frame: &SensorFrame) -> VisionResult<Vec<BoundingBox3D>> {
|
|
// Neural network-based fusion
|
|
Ok(detections.to_vec())
|
|
}
|
|
}
|
|
|
|
/// Fusion methods
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub enum FusionMethod {
|
|
EarlyFusion,
|
|
LateFusion,
|
|
DeepFusion,
|
|
} |