Machine Vision-based Obstacle Avoidance for Mobile Robot

Received 03 December 2019, Revised 17 January 2020, Accepted 11 February 2020. Obstacle avoidance for mobile robots, especially humanoid robot, is an essential ability for the robot to perform in its environment. This ability based on the colour recognition capability of the barrier or obstacle and the field, as well as the ability to perform movements avoiding the barrier, detected when the robot detects an obstacle in its path. This research develops a detection system of barrier objects and a field with a colour range in HSV format and extracts the edges of barrier objects with the FindContoure method at a threshold filter value. The filter results are then processed using the Bounding Rect method so that the results are obtained from the object detection coordinate extraction. The test results detect the colour of the barrier object with OpenCV is 100%, the movement test uses the processing of the object's colour image and robot direction based on the contour area value> 12500 Pixels, the percentage of the robot making edging motion through the red barrier object is 80% and the contour area testing <12500 pixel is 70% of the movement of the robot forward approaching the barrier object.


INTRODUCTION
In recent years, personal service robots, robots designed to help people with special needs or older people in their daily activities, have attracted the attention of researchers in the field of robotics [1] [2]. Daily activities that we do, for example, in the home, it is very challenging to be carried out by a robotic system [3] [4], because the environmental conditions are complex, dynamic and designed for human needs. The robot must have the ability to manipulate mobile and interaction skills with humans to be able to function correctly [5]. Due to its function, it is a fact that most of the services robots are mobile robots. The mobility itself can be in the form of a wheeled or legged actuator. A humanoid robot is an example of a legged type robot. The humanoid form offers some advantages compared to other forms of a robot; one of the most important things is its resemblance with the human enables the robot to operate in a similar environment designed for humans [6] [7]. The humanoid robot has become a popular topic in the area of robotics research. Most of the humanoid robot research was conducted on a miniaturized scenario, i.e., the scaled version on the environment set-up and also the robot set-up due to its budget consideration. However, some researchers have proved that it is feasible to scale up this research to be implemented successfully in a full-size scenario [8].
This research aimed to develop a machine vision-based obstacle avoidance system for a miniature size humanoid robot. The obstacle avoidance system enabled the robot to perform its mobility safely in the obstacle cluttered area.

RESEARCH METHOD
Image processing as the central part of a computer vision is the main problem that needs to be solved in building an obstacle avoidance system. The computer vision system This system enables the robot to avoid an obstacle. The image processing itself must overcome any changes in light intensity variation of the working environment. The image processing part mainly based on segmentation techniques based on RGB, CMY, HSI, HSV dan normalized RGB [9]. The RGB and HSV are the most common model used because of their simple programming implementation and computationally light, which is very suitable to be used in obstacle avoidance for the mobile robot because of the limited computation power available onboard [10]. In this study the HSV image model was used due to its robustness in light intensity variation [11]

Hardware Configuration
The research was conducted on a 574 mm tall humanoid robot as used in [18], that utilizes a single-board computer as the main controller and an STM32 based sub-controller equipped with a three-axis gyroscope and three-axis accelerometer and also the necessary circuitry needed to communicate with the digital servomotor as the actuator. The electronics configuration described in Figure 1. This robot had twenty degrees of freedom, two of them located in its neck that enables a panning and tilting motion. Figure 2 depicting the robot and the pan movement.

Software Configuration
In the software configuration, OpenCV 2.4.9 based machine vision that performed all the necessary processes were developed on top of the Linux operating system installed on the single-board computer. The first process was converting the RGB to HSV Value. In order to determine the HSV value, a conversion (from RGB to HSV) requires the following steps: The conversion involves the ordering of R, G, and B components, i.e., finding the minimum and maximum of them. If they are equal, then it is the achromatic case when saturation (S) is 0 and hue (H) is undefined. Value (V) is always equal to the maximal RGB component. The formula for saturation is The formula for hue (H) includes computation of its fraction part and summation with appropriate sector offset. The fraction of hue is computed as The middle component and sector offset are determined according to previously found maximum (M) and minimum (m). Finally, H is divided by 6 in order to change the range to [0,1].
The next stage of the vision process was thresholding. Thresholding is a technique that is useful for image segmentation and provides assistance in many images [19]. Thresholding is a concept to convert an image into two types of intensity, namely 0 or 255, and the simplest method of image segmentation. From the gray image, thresholding can be used to create binary imagery. In the Motion Process thresholding process, each pixel is on an image marked as a pixel of the object if the value is higher than the threshold value.
Erosion operations are the opposite of dilation operations. In this operation, the size of the object is reduced by eroding the surrounding object. There are two ways that can be done. The first way is to change all the boundary points to be the background point and the second way by setting all three points around the background point to be the background point. Dilation is done to increase the size of the object segment by adding layers around the object.
FindContour is a function available in OpenCV that can be used to find a contour on an image. This function detects every single contour and all detected contour recorded as a node vector. Contours are defined as the line joining all the points along the boundary of an image that are having the same intensity. Contours can be used in shape analysis, finding the size of the object of interest, and object detection. The following process for the vision process was implemented using BoundingRect function in OpenCV that yields the position of the contour in the image in , coordinate. The processes conducted described in Figure 3.

RESULTS AND DISCUSSION
In this research, there was some test of the detection of blue and red objects with disturbance of objects in purple. This test aims to test the level of accuracy of the vision of the object detection performed. Then the test will be conducted on tracking red and blue objects with purple interference. Following the object detection test, the movement of robots based on image processing of object detection was also tested. This test aims to test the movement of the robot when it detects a barrier object.

Object detection test
The process begins from the initial image captured from the RBG to HSV conversion, then determine the color filter that is considered an object, and then after the results of the process, the system will detect the colored object chosen. The results of the blue object detection with purple object disturbance depicted in Figure  4 and Figure 5.  The object detection system also tested against distance variations, the figure shows the result of object detection in different distances. Figure 6 depicting these scenarios and the result of this test shown in Table 1.

Robot movement based on object detection
Robot movements were determined based on the object detection result done by the machine vision part of the software. There were two kinds of object detection criteria used in this process. The first was regarding the color of the object detected and the second was the area of the object detected. The first criteria rely on the blue and red distinction. As for the second criterion, it was actually used only when a red object detected. The process can be explained in the following. The result of the machine vision process passed information about whether a blue or red object detected in the robot sight, if a blue object was detected then the robot will check the blue object detected using the robot pan angle value. For a situation when the blue object was detected at an angle larger than 40° the robot made a move to avoid the blue object by shifting to the left, on the contrary, when the blue object was detected at an angle smaller than 40°, the robot made an evasive move by shifting to the right. Both scenarios can be seen in Figure 7 and Figure 8.  The second criteria i.e. when red object detected, applied as follows, the robot determined the movement based on the proximity of the red object. The proximity of the object was inferred from the pixel count (area calculation) of the red object detected. The research was conducted based on 320 x 240 camera resolution and the pixel count threshold was 12500 pixels. The robot then determined whether it takes an evasive move on to continue its normal walking motion. Therefore, the contour area of a red object was used as a parameter of robot motion. In Figure 9, when the robot detects a red barrier object, when a pixel value or contour area of the red object was detected <12500pixel the robot makes a walking motion toward the red object and when the pixel value> 12500pixel the robot crawls through the object barrier. The results of the robot movement when the detected red object area below 12500 pixels and exceeded 12500 shown in Table 2 and Table 3, respectively.

CONCLUSION
In the research that has been conducted, it can be concluded that the robot can detect barrier objects based on the color of the object and can make movements based on the detected object. The percentage of success of the results of testing the object detection system tested based on the detection distance, obtained the success rate, and accuracy of vision can detect barrier objects is 100%, for testing the movement using image color processing of objects and robot direction based on the value of the contour area> 12500 Pixels, the percentage of robots performing the movement of creeping past the red barrier object is 80% and the result of testing the contour area <12500 pixels is 70% of the robot's forward movement approaching the barrier object.