Complete autonomous and manual control system for Bin Diesel car using YOLO pose estimation and tracking.
See COMPLETE_SETUP.md for full setup instructions.
- Clone repository:
git clone https://github.com/wasumayan/bindiesel.git
cd bindiesel- Set up environment:
python3 -m venv venv
source venv/bin/activate # On Pi: source venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt- Configure:
cp .env.example .env # Edit .env with your API keys
# Edit config.py for GPIO pins and camera settings- Test components:
python test_yolo_pose_tracking.py --fps # Test pose detection + tracking
python hand_gesture_controller.py # Test hand gestures
python test_motor.py # Test motor
python test_servo.py # Test servo- Run full system:
python main.py- Wake word: "bin diesel"
- YOLO pose detection + tracking → car follows user
- Arm angle detection (60-90 degrees raised to side)
- TOF sensor stops car at 7-8cm from user
- Auto-return to starting position after trash collection
- Say "manual mode" after wake word
- Voice commands: FORWARD, LEFT, RIGHT, STOP, TURN AROUND
- Hand gestures: STOP, TURN_LEFT, TURN_RIGHT, FORWARD, TURN_AROUND
- Uses GPT API for voice recognition
- Uses YOLO hand keypoints for gesture recognition
- Say "radd mode" after wake word
- Car automatically drives towards users violating dress code:
- Not wearing full pants (shorts, skirt, or bare legs detected)
- Not wearing closed-toe shoes (sandals, flip-flops, or barefoot detected)
- Uses YOLO pose keypoints to analyze clothing/footwear
- Follows violating users until they comply or timeout
main.py- Main entry point and state machinetest_yolo_pose_tracking.py- YOLO pose detection + tracking (YOLOPoseTracker class)wake_word_detector.py- Wake word detection (Picovoice)hand_gesture_controller.py- Hand gesture control (YOLO hand keypoints)motor_controller.py- PWM speed controlservo_controller.py- PWM steering controltof_sensor.py- Distance measurement (VL53L0X)voice_recognizer.py- Voice commands for manual mode (OpenAI GPT)radd_detector.py- RADD mode: dress code violation detectionpath_tracker.py- Path recording for auto-returnlogger.py- Structured logging systemconfig.py- Configuration and GPIO pin assignmentsstate_machine.py- System state management
test_yolo_pose_tracking.py- YOLO pose detection + tracking testtest_yolo_obb.py- YOLO OBB (Oriented Bounding Boxes) test for trash detectiontest_visual_detection.py- Visual detection testtest_motor.py- Motor controller testtest_servo.py- Servo controller testtest_tof.py- TOF sensor testtest_voice_commands.py- Voice recognition test
COMPLETE_SETUP.md- Complete setup guide (start here!)AFTER_CLONE.md- Post-clone setup instructionsPI_GIT_SETUP.md- Git setup on Raspberry PiTRAINING_GUIDE.md- Hand keypoints model training guideSYSTEM_ARCHITECTURE.md- System architecture detailsTESTING_GUIDE.md- Component testing guideINSTALL_PACKAGES.md- Package installation guideAUTO_START_SETUP.md- Auto-start on boot setup
Default pins (configurable in config.py):
- Motor PWM: GPIO 12 (pin 32)
- Servo PWM: GPIO 13 (pin 33)
- TOF Sensor: GPIO 23 (pin 16) - I2C interface
- YOLO11 Pose: Person detection + pose estimation (17 keypoints)
- YOLO Tracking: BYTETracker for persistent person tracking
- Hand Keypoints: 21 keypoints per hand for gesture recognition
- Picamera2: Raspberry Pi camera interface
- Picovoice: Wake word detection
COMPLETE_SETUP.md- Complete setup guide (start here!)AFTER_CLONE.md- Post-clone setup instructionsTRAINING_GUIDE.md- Train hand keypoints model on MacBookSYSTEM_ARCHITECTURE.md- System architecture detailsTESTING_GUIDE.md- Component testing guideAUTO_START_SETUP.md- Auto-start on boot
- Python version: Python 3.9+ (tested on 3.11)
- Camera:
libcamera-hello --list-cameras - GPIO permissions:
sudo usermod -a -G gpio $USER(logout/login) - Camera upside down: Set
CAMERA_ROTATION = 180inconfig.py - Colors flipped: Set
CAMERA_SWAP_RB = Trueinconfig.py - Test components: See
TESTING_GUIDE.md
- Raspberry Pi (tested on Pi 4/5)
- Raspberry Pi Camera Module
- Python 3.9+ (venv recommended)
- See
requirements.txtfor Python packages - See
COMPLETE_SETUP.mdfor full requirements