Obstacle Avoiding Wheeled Robot

1 minute read

Published:

I. Brief Description

The task for this program was to build a automatic robot which can navigate through several randomly placed obstacles and stop exactly at the finishing line. I was responsible for building the vision system as well as the controlling module. For user convenience, I developed this GUI based on OpenCV and Qt Creator.

Vision

I convert each frame captured by the camera into HSV color space for robust histogram matching. What is more, in order to reduce the influence of illumination variance, I mask out pixels whose saturation (the ‘S’ element in HSV space) is too high or too low. A tracking method called cam-shift is used as an assistance to histogram matching.



Controlling

I utilize finite state machine for the control of the robot. First, I define several implicit variables, and different values of these variables illustrate different state of the robot. Then I set a timer which will detect the robot’s ‘state’ every 10 ms, and the robot will decide what to do next based on the current state. It is important that these implicit variables should be updated independently, in another parallel thread, based on vision signals and commands from the user.

II. Source Code

Source code available here

Requirements

  • Qt Creator
  • OpenCV
  • Either Window or Linux operating system is OK (Qt Creator is a cross-platform IDE)

Main features

  • Object tracking using histogram matching.
  • Robot controlling through serial port using finite state machine software implementation.

III. Summary Reports

IV. Videos

Demo: Object detection and tracking based on histogram matching

18th National Robot Championship

Tags: OpenCV