This repository contains the source code for a full-stack embedded autonomous driving project built on the Quanser QCar2 platform.
This project is a Self-Driving Vehicle (SDV) system built on:
- Platform: Quanser QCar2
- Compute: NVIDIA Jetson Orin
- OS: Ubuntu 20.04
- Middleware: ROS2 Humble
- Language: Python 3.8
This is a real hardware-based embedded autonomy system involving perception, sensor fusion, planning, control, and safety logic.
The goal is to build a controlled, explainable autonomous system that can:
- Follow lanes or cone-defined corridors
- Detect and react to obstacles safely
- Integrate traffic sign understanding
- Operate reliably on the Quanser map
This is structured autonomy with safety and reasoning.
The system follows a modular autonomy pipeline:
-
Perception
- Lane detection (CSI camera)
- Traffic sign detection (RT-DETR)
- Depth-based obstacle reasoning (RealSense)
- LiDAR-based obstacle detection
-
Sensor Fusion
fusion_confidence = vision_score × depth_score- Sync gating (reject if timestamp mismatch > 100ms)
- Depth veto over vision
-
Planning
- Lane center tracking
- Corridor following (lane OR cones)
- Obstacle avoidance (Bug algorithm style)
-
Control
- Steering based on lane deviation:
steer = (lane_center - image_center) / image_center - Speed based on confidence levels
- Steering based on lane deviation:
-
Safety Logic (priority-based)
- LiDAR hard stop (highest priority)
- Depth obstacle veto
- Sync failure → STOP
- Lane loss → STOP
- CSI Front Camera → Primary lane perception
- RealSense Depth → Forward clearance
- LiDAR → Emergency stop + obstacle direction
- RealSense RGB → Debug/fallback
Important constraints:
- Resolution mismatch (CSI vs Depth)
- Timestamp mismatch
- Invalid depth pixels (~38%)
-
Traffic Sign Detection
- Model: RT-DETR
- ~92.6% mAP
- ~24 FPS
- Fixed issues:
- Left/right confusion (augmentation)
- Class imbalance
- Far-distance detection
-
Lane Detection Pipeline (8-step)
- Grayscale → Blur → Canny → ROI → Hough → Lane grouping
- Lane center estimation
- Steering from deviation
- Exponential smoothing
-
Sensor Fusion
- Vision + Depth combined
- Depth acts as a safety veto
- Sync validation required
-
Obstacle Avoidance
- LiDAR sector-based (Left / Center / Right)
- Bug algorithm:
- Choose clearer side
- Avoid obstacle
- Return to lane
- Backing logic if too close
-
Stability Improvements
- Frame-based state confirmation
- Steering smoothing
- LiDAR anti-flicker logic
Working:
- All sensors operational (CSI, RealSense, LiDAR)
- Lane detection + steering
- Traffic sign detection model
- Sensor fusion prototype
- Obstacle avoidance logic
- Integrated multi-sensor loop
Partial:
- Depth tuning (false positives)
- Steering stability on curves
- Lane offset filtering
Not complete:
- Full stable autonomous driving
- Traffic sign integration into control loop
- Path planning around stopped vehicles
- Calibration between sensors
- Stable lane/corridor following
- Reduce false depth stops
- Improve steering smoothness
- Visualize ego path and lane center
- Integrate traffic sign decisions
- Handle stopped vehicles intelligently
This project demonstrates:
- Real-world sensor debugging
- Embedded AI deployment
- Multi-sensor fusion design
- Transition from reactive → autonomous control
- Full-stack autonomy pipeline