-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.
- β 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
βββββββββββββββββββββββββββββββββββββββββββ
β MAIN CONTROLLER β
β (Decision Logic) β
βββββββββββββ¬ββββββββββββββββββββββββββββββ
β
βββββββββ΄ββββββββ¬βββββββββββ¬βββββββββββ
β β β β
βΌ βΌ βΌ βΌ
ββββββββββ ββββββββββββ ββββββββββ ββββββββββ
β Kinect β β ArUco β βArduino β β Config β
β VFH β β Tracker β β Comm β βSettingsβ
ββββββββββ ββββββββββββ ββββββββββ ββββββββββ
- Trigger: Obstacle detected in one of the sectors
- Behavior: Avoid the obstacle by turning left/right
- Priority: Highest (Safety First!)
- Trigger: Path clear + ArUco marker detected
- Behavior: Follow marker (left/center/right zone)
- Priority: Medium (Goal Seeking)
- Trigger: Path clear + No ArUco detected
- Behavior: Stop or rotate (configurable)
- Priority: Lowest (Default State)
# Hardware
- Kinect v1 sensor (Xbox 360 Kinect)
- Arduino Uno dengan motor driver
- 2 DC motors
# Software
- Python 3.8+
- OpenNI2 drivers
- Arduino IDEcd robot_navigation_mvc
pip install -r requirements.txtDownload and install the OpenNI2 SDK from:
- Windows: https://structure.io/openni
- Linux:
sudo apt-get install libopenni2-dev
# 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.pypython main.py- Q: Quit program
- 1: VFH Only mode (disable ArUco)
- 2: ArUco Only mode (disable VFH)
- 3: Hybrid mode (default)
- Space: Emergency stop
- A/D: Rotate view left/right
- W/S: Zoom in/out
- Q: Quit
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' 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- Run the system without ArUco markers
- Place an obstacle on the front sensor
- Verify: The robot turns left/right to avoid obstacles
- Ensure the path is clear (no obstacles)
- Show the ArUco marker to the camera
- Verify: The robot turns to face the marker
- Verify: The robot advances when the marker is centered
- Show the ArUco marker + place an obstacle
- Verify: VFH takes priority (avoid obstacles first)
- Remove the obstacle
- Verify: Continue ArUco tracking
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
# Check OpenNI2 installation
# Windows: Check Device Manager
# Linux: lsusb | grep Kinect# Check COM port in Device Manager
# Edit config/settings.py: ARDUINO_PORT = 'COM_YOUR_PORT'
# Test: python tests/test_arduino_comm.py- Ensure sufficient lighting
- Print markers at least 10cm x 10cm
- Use high-contrast print (black and white)
- Check dictionary type: DICT_5X5_1000
- Tune threshold:
VFH_THRESHOLD_DISTANCEin settings.py - Check Kinect depth data is valid (not all zeros)
System save in folder logs/:
logs/robot_nav_YYYYMMDD_HHMMSS.log