Skip to content

Driver#209

Merged
m-zain-khawaja merged 8 commits intoautowarefoundation:mainfrom
pranavreddy23:driver
Dec 15, 2025
Merged

Driver#209
m-zain-khawaja merged 8 commits intoautowarefoundation:mainfrom
pranavreddy23:driver

Conversation

@pranavreddy23
Copy link
Collaborator

PR: CAN Bus Integration and Enhanced Rerun Logging

Overview

This PR integrates CAN bus data acquisition for ground truth and enhances Rerun logging with complete frame data, control outputs, and visualization.

Features

CAN Bus Integration

  • SocketCAN Support: Real-time CAN bus data acquisition via SocketCAN interface
  • File Replay: Support for .asc file replay for offline testing
  • Ground Truth Data: Captures steering angle and vehicle speed from CAN bus
  • Non-blocking: Graceful handling when CAN interface is unavailable
  • Thread-safe: CAN data polled in capture thread and passed through pipeline

Enhanced Rerun Logging

  • Unified Logging: All Rerun logging moved to display thread for synchronization
  • Complete Data: Logs frame, CAN bus, control outputs, visualization, and metrics
  • Zero-copy: Uses rerun::borrow() for efficient memory usage
  • 320x640 Frames: Optimized frame size for logging (reduces data by ~75%)
  • Synchronized: All data for each frame logged atomically

Technical Details

CAN Interface (drivers/can_interface.cpp)

  • Supports SocketCAN (real-time) and .asc file replay
  • Decodes steering angle (CAN ID 0xA4) and speed (CAN ID 0xA1)
  • Non-blocking socket operations
  • Automatic error handling and recovery

Rerun Logger Updates

  • New logData() method: Replaces logInference() with comprehensive logging
  • Entity Paths:
    • camera/image: Resized input frame (320x640)
    • lanes/ego_left, lanes/ego_right, lanes/other: Lane masks
    • visualization/stacked_view: Final visualization
    • can/steering_angle_deg, can/speed_kmph: CAN bus data
    • control/pid_steering_rad, control/pid_steering_deg, control/autosteer_angle_deg: Control outputs
    • pathfinder/cte, pathfinder/yaw_error, pathfinder/curvature: PathFinder outputs
    • metrics/inference_time_ms: Performance metrics

Data Flow

Capture Thread → [TimestampedFrame: frame + CAN] 
    ↓
Inference Thread → [InferenceResult: frame + CAN + inference + resized_frame_320x640]
    ↓
Display Thread → [Rerun Logging: All synchronized data]

Usage

CAN Bus

# Real-time CAN interface
./build/egolanes_pipeline video input.mp4 model.onnx ... --can-interface can0

# File replay
./build/egolanes_pipeline video input.mp4 model.onnx ... --can-interface data.asc

Rerun Logging

# Live viewer (recommended - streams directly, no RAM buffering)
./build/egolanes_pipeline video input.mp4 model.onnx ... --rerun

# Save to file (buffers in RAM until completion)
./build/egolanes_pipeline video input.mp4 model.onnx ... --rerun-save output.rrd

# Both (viewer + save)
./build/egolanes_pipeline video input.mp4 model.onnx ... --rerun --rerun-save output.rrd

pranavreddy23 and others added 8 commits December 14, 2025 16:57
Signed-off-by: Pranav Doma <pranavreddy2327@gmail.com>
Signed-off-by: Pranav Doma <pranavreddy2327@gmail.com>
Signed-off-by: Pranav Doma <pranavreddy2327@gmail.com>
Signed-off-by: Pranav Doma <pranavreddy2327@gmail.com>
Signed-off-by: Pranav Doma <pranavreddy2327@gmail.com>
Signed-off-by: Pranav Doma <pranavreddy2327@gmail.com>
Signed-off-by: Pranav Doma <pranavreddy2327@gmail.com>
@m-zain-khawaja m-zain-khawaja merged commit 20f9638 into autowarefoundation:main Dec 15, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants