Skip to content

autonomous robot navigation system uses Vector Field Histogram (VFH) for obstacle avoidance and ArUco marker tracking for goal-seeking navigation.

Notifications You must be signed in to change notification settings

devanys/DDMR-VFH-Collision-Avoidance

Repository files navigation

πŸ€– DDMR-VFH-Collision-Avoidance

-Path.Following.2.mp4

The autonomous robot navigation system uses Vector Field Histogram (VFH) for obstacle avoidance and ArUco marker tracking for goal-seeking navigation.

πŸ“‹ Features

  • βœ… VFH Obstacle Avoidance: Detect and avoid obstacles in real time
  • βœ… ArUco Marker Tracking: Track and approach ArUco markers as targets
  • βœ… Hybrid Decision Logic: Smart priority-based decision making
  • βœ… Modular Architecture: Clean, maintainable, and extensible code
  • βœ… Real-time Visualization: Point cloud + ArUco overlay + status display
  • βœ… Arduino Integration: Serial communication for motor control

πŸ—οΈ Arsitektur Sistem

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         MAIN CONTROLLER                 β”‚
β”‚      (Decision Logic)                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚               β”‚          β”‚          β”‚
    β–Ό               β–Ό          β–Ό          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Kinect β”‚   β”‚  ArUco   β”‚ β”‚Arduino β”‚ β”‚ Config β”‚
β”‚  VFH   β”‚   β”‚ Tracker  β”‚ β”‚  Comm  β”‚ β”‚Settingsβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🎯 Operation Mode

1. VFH_ACTIVE (Priority 1)

  • Trigger: Obstacle detected in one of the sectors
  • Behavior: Avoid the obstacle by turning left/right
  • Priority: Highest (Safety First!)

2. ARUCO_TRACKING (Priority 2)

  • Trigger: Path clear + ArUco marker detected
  • Behavior: Follow marker (left/center/right zone)
  • Priority: Medium (Goal Seeking)

3. SEARCH (Priority 3)

  • Trigger: Path clear + No ArUco detected
  • Behavior: Stop or rotate (configurable)
  • Priority: Lowest (Default State)

πŸ“¦ Instalasi

1. Requirements

# Hardware
- Kinect v1 sensor (Xbox 360 Kinect)
- Arduino Uno dengan motor driver
- 2 DC motors

# Software
- Python 3.8+
- OpenNI2 drivers
- Arduino IDE

2. Install Dependencies

cd robot_navigation_mvc
pip install -r requirements.txt

3. OpenNI2 Setup

Download and install the OpenNI2 SDK from:

Test Individual Modules

# Test Arduino communication
python tests/test_arduino_comm.py

# Test VFH only
python tests/test_vfh_only.py

# Test ArUco tracking only
python tests/test_aruco_only.py

Run Full System

python main.py

⌨️ Keyboard Controls

Main System

  • Q: Quit program
  • 1: VFH Only mode (disable ArUco)
  • 2: ArUco Only mode (disable VFH)
  • 3: Hybrid mode (default)
  • Space: Emergency stop

VFH Test

  • A/D: Rotate view left/right
  • W/S: Zoom in/out
  • Q: Quit

βš™οΈ Configuration

Edit config/settings.py untuk tuning parameters:

# VFH Settings
VFH_THRESHOLD_DISTANCE = 1.0  # meter
VFH_TURN_DURATION = 0.2       # seconds
VFH_FORWARD_DURATION = 0.4    # seconds

# ArUco Settings
ARUCO_DICT_TYPE = 'DICT_5X5_1000'
ARUCO_APPROACH_DISTANCE = 0.5  # meter

# Arduino Settings
ARDUINO_PORT = 'COM5' 

πŸ“Š Decision Logic

IF obstacle_detected:
    MODE = VFH_ACTIVE
    COMMAND = vfh_command
    
ELIF aruco_detected AND path_clear:
    IF distance < approach_distance:
        MODE = ARUCO_REACHED
        COMMAND = STOP
    ELSE:
        MODE = ARUCO_TRACKING
        COMMAND = aruco_command
        
ELSE:
    MODE = SEARCH
    COMMAND = STOP

πŸ§ͺ Test Scenarios

Scenario 1: VFH Obstacle Avoidance

  1. Run the system without ArUco markers
  2. Place an obstacle on the front sensor
  3. Verify: The robot turns left/right to avoid obstacles

Scenario 2: ArUco Tracking

  1. Ensure the path is clear (no obstacles)
  2. Show the ArUco marker to the camera
  3. Verify: The robot turns to face the marker
  4. Verify: The robot advances when the marker is centered

Scenario 3: Hybrid Navigation

  1. Show the ArUco marker + place an obstacle
  2. Verify: VFH takes priority (avoid obstacles first)
  3. Remove the obstacle
  4. Verify: Continue ArUco tracking

πŸ“ File Structure

robot_navigation_mvc/
β”œβ”€β”€ main.py                      # Main controller
β”œβ”€β”€ requirements.txt             # Dependencies
β”œβ”€β”€ README.md                    # Documentation
β”‚
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── settings.py             # Configuration parameters
β”‚
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ kinect_vfh.py          # VFH navigation module
β”‚   β”œβ”€β”€ aruco_tracker.py       # ArUco tracking module
β”‚   └── arduino_comm.py        # Arduino communication
β”‚
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── logger.py              # Logging utility
β”‚
└── tests/
    β”œβ”€β”€ test_arduino_comm.py   # Test Arduino
    β”œβ”€β”€ test_vfh_only.py       # Test VFH only
    └── test_aruco_only.py     # Test ArUco only

πŸ› Troubleshooting

Kinect not detected

# Check OpenNI2 installation
# Windows: Check Device Manager
# Linux: lsusb | grep Kinect

Arduino not connected

# Check COM port in Device Manager
# Edit config/settings.py: ARDUINO_PORT = 'COM_YOUR_PORT'
# Test: python tests/test_arduino_comm.py

ArUco not detected

  • Ensure sufficient lighting
  • Print markers at least 10cm x 10cm
  • Use high-contrast print (black and white)
  • Check dictionary type: DICT_5X5_1000

VFH always detects obstacles

  • Tune threshold: VFH_THRESHOLD_DISTANCE in settings.py
  • Check Kinect depth data is valid (not all zeros)

πŸ“ Logs

System save in folder logs/:

logs/robot_nav_YYYYMMDD_HHMMSS.log

About

autonomous robot navigation system uses Vector Field Histogram (VFH) for obstacle avoidance and ArUco marker tracking for goal-seeking navigation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages