How amerblb/self-driving-rc-car works
Project Type and Purpose
• This is an embedded robotics / full-stack‐style system for an autonomous RC car.
• It consists of two main “modes”:
• An offline ML pipeline (data collection → training → evaluation)
• A real‐time control loop on the Raspberry Pi (perception → sensor fusion → safety → motor control)
• There is also a lightweight web component (in src/web) and a YAML‐based configuration service.
File Structure
• Top‐level directories:
• config / config.example.yaml → runtime and hardware parameters
• hardware / notebooks → hardware specs and analysis notebooks
• src/ → all Python modules and scripts
– src/core/ (motor_control, perception, safety_monitor, sensor_fusion) → real‐time control logic
– src/utils/ (data_augmentation) → offline data prep
– src/data_collection.py, src/train_model.py, src/evaluate_model.py → ML pipeline entry points
– src/autonomous_driver.py → main loop for autonomous driving
– src/web/ (static, templates) → optional monitoring/telemetry UI
– src/tests/ → unit tests
• Other files:
• requirements.txt, setup.py → packaging and dependencies
README Insights
• Describes NVIDIA‐inspired CNN for end‐to‐end steering
• Sensor fusion for robust state estimation
• Safety monitor for emergency stops
• Path planning and obstacle avoidance
• Quick‐start workflow: collect → train → run
1. Hardware Layer
– Sensors: Pi Camera, Ultrasonic sensor, IMU (if any)
– Actuators: L298N motor driver + DC motors
2. Configuration Service
– YAML loader, parameter server
3. Real‐Time Control Loop (on Pi)
– Perception Module (CNN inference)
– Sensor Fusion Module
– Safety Monitor
– Motor Control Module
4. Offline ML Pipeline
– Data Collection Script (manual‐drive UI)
– Data Augmentation utilities
– Model Training (TensorFlow)
– Model Evaluation
5. Web Interface (optional)
– Flask/HTML front‐end for telemetry & manual override
6. Storage
– Local disk or network share for datasets, trained models, logs
– Hardware → Perception & Sensor Fusion (raw frames, distance readings)
– Perception → Steering commands → Safety monitor → Motor Control → Hardware
– Configuration → all runtime modules (perception, control, safety)
– Data Collection → local storage → Training → trained model
– Trained model → deployed into Perception module
– Web UI ↔ Control Loop (for status, manual override)
c. Architectural Patterns & Principles
– Modular separation of concerns: Perception / Fusion / Control / Safety
– Clear offline vs online paths (ML pipeline vs real‐time loop)
– Config‐driven design (no hard‐coded parameters)
– Test harness for components (src/tests)
d. Key Technologies & Frameworks
– Python 3.8+
– TensorFlow 2.x (CNN inference & training)
– Flask or lightweight Python web server
– Raspberry Pi OS, RPi.GPIO (or similar)
– YAML for configuration