INFLUENCE OF MOBILE ROBOT CONTROL ALGORITHMS ON THE PROCESS OF AVOIDING OBSTACLES

. This article presents algorithms for controlling a mobile robot. An algorithms are based on artificial neural network and fuzzy logic. Distance was measured with the use of ultrasonic sensor. The equipment applied as well as signal processing algorithms were characterized. Tests were carried out on a mobile wheeled robot. The analysis of the influence of algorithm while avoiding obstacles was made.


Introduction
Controlling a mobile robot in the process of avoiding obstacles is a very important issue. The sensor system used to retrieve data should be adapted to the environment in which the location of obstacles may be unknown and variable. To adapt the robot's behaviour to any complex environmental dynamics without further human intervention, it is necessary to extract key information from the environment [3,11]. The most commonly used and described detector elements use infrared light, radio waves or ultrasonic waves. Simplified versions of these systems require the use of markers that limit the work area of the robot. For infrared light based systems, reflective stickers are used, while radio systems use, for example, RFID stickers. In the case of ultrasonic waves, it is necessary to use a special microphone and ultrasound transmitters as markers [13]. Then, the route is determined by detecting a specific marker and choosing an alternative route. This approach prevents correct detection in the event of a sudden appearance of the object. More advanced systems are equipped with CCD cameras, Global Navigation Satellite System (GNSS) and image sensors based on CMOS technology [13]. Ultrasound sensors have found the greatest application due to their low cost and availability on the market. They are very effective in measuring distances, they also work well when detecting obstacles and exploring an unknown environment. They are successfully used in complicated maneuvers of passing or parking. In the applications presented in the literature [5][6][7], the authors most often use six or eight ultrasound sensors to capture information about obstacles around them. The information is then processed in order to e.g. avoid an obstacle, calculate a new route, determine the shape of the surface or update the map (if it is created).
The solution for measuring the distance from the obstacle during the manoeuvre was presented in the literature [7,15]. An algorithm was then used that allowed the robot to maintain a safe distance from the obstacle while moving forward along the wall (mode T). A significant number of research papers using fuzzy logic navigation [1-2, 5-6, 10, 13] have been proposed. This approach requires adjustment of tuning parameters depending on the environment, which can be problematic. Another solution uses an artificial neural network for intelligent robot control, because it has the ability to educate itself and a high efficiency in the approximation of non-linear functions [8,11].
The study defines goals: the main is to exam how particular algorithm affects the process of avoiding an obstacle. Another is whether it suits for the size of the room and it can detect an obstacle during drive without stopping. In this research, an analisys of the influence mobile robot control algorithms has been done. The article is organized as follows: Chapter 1 discusses the structure of the robot, in particular mechanism of uses one sensor. Chapter 2 presents selected algorithms used to control robot. Chapter 3 and 4 describe conducted experiment and results.

The structure of a mobile robot
A mobile wheeled robot consisting of several modules was used for the research. The body was designed in the Autodesk Inventor environment (Fig. 1) and made in 3D printing technology using ABS plastic. The robot has two wheels driven by separate DC motors and one support wheel without a drive. The measuring system consists of an HC-015 ultrasonic sensor placed on a movable heada servo drive that allows the user to rotate left and right by a maximum of 90° to the front plane of the robot. This solution allows to reduce the number of sensors necessary for the correct location of obstacles in the case of moving, for example forward or along the wall. There is no need to use an extensive system of six or eight sensors, just to rotate one by a given angle. An additional advantage is the smaller number of ports necessary to operate the sensor. The system centre is a Wi-Fi module based on the ESP8266-NodeMCU system. It is responsible for processing the signal received from the ultrasonic sensor, controlling the sensor head, calculating and generating a motor control signal. The NodeMCU Motor Shield based on the L293D chip was used for the motor control itself, which allows independent power supply and control of two DC motors at the same time. The last element is a power supply system consisting of three Li-Ion battery packs to supply respectively: DC motors (2  3.7V Li-Ion), servo drives (2  3.7V Li-Ion together with L7805CV voltage stabiliser) and the NodeMCU system (1  3.7V Li-Ion).

Algorithms
This section presents proposed wheeled robot control algorithms in the process of bypassing obstacles. As an initial assumption it was taken for granted that until the obstacle was detected, the robot moved at a constant linear velocity. The main task was to travel the longest possible distance without colliding with an obstacle. Detection of an obstacle changed the route in a way depending on the specific algorithm. The distance reading was carried out using a sensor from five pre-set servo positionstwo positions were responsible for the left-hand reading, one for the front reading and two for the right-hand reading. Due to the fact that the main goal was to move forward, the possibility of turning the servo drive in other directions was abandoned. Pulse Width Modulation (PWM) was used to control the motors, if a change in the direction of the movement occurred, the signal fill ratio was adjusted correspondingly. Thanks to this, it was possible to smoothly perform an evasive manoeuvre without stopping the robot. Algorithms using fuzzy logic and artificial neural network were used.

The first caseapplication of fuzzy logic
Fuzzy systems describe imprecise, unspecified deterministically or non-specific information. Knowledge about the system is stored in the form of fuzzy rules. Stages of fuzzy system design:  Fuzzificationtransformation of input signals into qualitative values.  Fuzzy applicationdetermining the value of outputs in the field of quality based on inputs using a set of fuzzy rules.  Creating a database of rules describing qualitative knowledge about the system in the form of fuzzy rules. This is a set of character instructions: IF <CONDITIONS> THEN <SELECTED ACTION> The applied algorithm based on fuzzy logic consists of N steps. In the general case, it looks as follows:  Start and initial initialisation.  Initial distance readings from each servo position and direction selection.  Driving forward.  Check if an obstacle has been detected.  If yes, distance classification.  Pre-preparation for skipping manoeuvre.  Change in the ratio of PWM signals controlling motors (left or right).  Distance control when evading.  A mirror-change in the ratio of PWM signals controlling motors (return to the route if possible).  Checking the distancechoosing the direction.  Driving forward.
In the initial phase of the algorithm preliminary initialisation is started and the possible directions of motion are checked. This direction is selected where the detected obstacle is farthest away (or no obstacle is detected). The robot then moves forward and every 100 ms the distance is measured from the fixed servo positions. In the absence of obstacles, the robot will move steadily forward. If the read distance is qualified to the 0.4-0.5 m range, the robot will start preparations for the skipping maneuver. Depending on the position of the servo from which the measurement was made, a different ratio of the signal filling to the motors would be adjusted. For example, if the distance read from position 2 (Fig. 3) is in the above-mentioned range, the robot will perform a slight right turn manoeuvre. Speed will be varied for the same distance detected by sensor from position 1 or 2.

Fig. 3. Fixed sensor positions
While avoiding the obstacle, distance control is carried out to avoid collisions in case of a large obstacle (with a complicated shape). At the same time, a mirror turning manoeuvre is being carried out (if the first turn was to the right, the next turn would be to the left). After avoidance, another check of the movement possibility takes placechoice of the direction, then setting the robot and the movement is continued. The algorithm part is shown in Fig. 4. Three special cases of applying the algorithm have also been specified:  Detecting an obstacle too lateit may not be possible to bypass it without stopping.  Detecting large obstaclesit may not be possible to bypass them.  Failure to detect an obstaclecollision.

The second casethe use of artificial neural network
In conducted research artificial neural networks have been created in Arduino IDE application. The mathematical formulation on neuron output is as follows [9]: where: nis the neuron output, x iis value of I input, w iis weight of I input, Nis number of inputs, bindicates bias.
Algorithms based on an feedforwarded artificial neural network were used when planning path movements due to the possibility of approximating complex, non-linear dependencies, as well as learning and adaptation. The structure (Fig. 5) of the network used was as follows:  the entrance layer consists of five neuronscorresponding to the next positions of the ultrasonic sensor  the hidden layer consists of six neuronsresponsible for processing input signals  the output layer consists of two neuronscorresponding to the number of controlled motors The structure of artificial neuron network during research was optimized. Starting from a small number of neurons in the hidden layer, computed as geometric mean of the number of inputs and outputs, through the number of neurons determined based on Kolmogorov's Theorem, to networks containing several dozen neurons in the hidden layer.
The first stage of the algorithm is training the network and relies on such a selection of parameters (weights) that will allow linking the input signal with the output signalthat there is a dependence of the output from the input for each case. The scales determine the degree of influence of the information carried by the input signal on the final result which is the activation of the motor. Network learning is necessary each time after starting, because the selected weights are not saved on any durable medium and in the case of turning off the power, the learning procedure should be performed again. Thanks to this solution, the robot has the opportunity to train a different reaction to a given event. This process takes place iteratively.
Due to the fact that the network is taught every time the robot is started, the learning time has a significant impact on the operation of the device. It was important to find a solution that would allow fast and effective learning. The learning took place until the number of epoques equals to 150 or the maximum permissible error equals to 0.015 was reached. Weight values taken by individual neurons before starting learning process were designated randomly. Figure 6 compares learning times for a few standardly used modifications of the backpropagation algorithm (GD), i.e.: with momentum (GDM), with adaptive learning rate (GDA), momentum and adaptive learning rate (GDX) and scaled conjugate gradient (SCG) [4,12,14,16].
The effectiveness of passing the obstacles by the robot for each of the training algorithms was at a similar level (the difference was about 12%). Therefore, in the further stage of the research, a network taught by gradient descent with momentum and adaptive learning rate backpropagation algorithm was used.
After training the network, it can begin to be used in the process of avoiding obstacles. Each input neuron corresponds to a specific sensor position (Fig. 3) depending on the value received at the input, the robot decides whether and how to change the speed of a given motor, causing e.g. a turn. As in the case of the fuzzy logic algorithm, the measurement is carried out in five directions while driving. The robot has the task to drive in the direction determined by the farthest obstacle detected.

Experiment
The research involved the use of a mobile circular robot with a built-in programmable ESP8266 NodeMCU system. The software was created in C/C++ using the integrated development environment -Arduino IDE. The test involved uploading software in two versionsfirst based on the fuzzy logic algorithm and the second based on the artificial neural network.
The test used obstacles made of paper of various shapes and sizes. The algorithm tests were performed in the laboratory in area 3 m  4 m. The test scenario assumed that robot moved forward until the obstacle was detected. The evasive maneuver and drive forward were proceed. Fig. 6. Learning algorithms comparison

Discussion
As a result of the experiment, the analysis of the impact of mobile robot control algorithms in the process of avoiding obstacles was carried out. The algorithms based on fuzzy logic and using an artificial neural network were used.
In the case of the fuzzy logic algorithm, the calibration of parameters is necessary depending on the size of the room in which the test is carried out. Adjusting the speed of moving robot during the maneuver is necessary and depends on how much distance robot can overcome after the obstacle has been avoided. In addition, if the room size is small in relation to the number and size of obstacles it may be impossible to avoid without stopping. This situation was not considered in this work.
The next case was the use of an artificial neural network. Due to the fact that the set network weights were not permanently saved anywhere, it was necessary to train each time after turning on the power again. For this reason, the process of evading the obstacle looked different each time. Comparison of learning times for several modifications of the back propagation algorithm has been shown in figure 6.
In the case of both algorithms, there was a situation of insufficient adjustment of the robot's moving speed in relation to the sensor driving servo. It was possible that the sensor did not detect an obstacle (blind spot) and caused a collision.

Summary
An experimental system of checking the impact of robot control algorithms on the process of passing obstacles has been developed and tested. The work presents the algorithms used. The main conclusions include: The implementation process of the algorithm based on fuzzy logic is much simpler and takes less time, but requires initial calibration, which may cause difficulties if the robot is used in too large or too small areas.
The process of network training takes place each time after starting, it may cause a different reaction to the same situations.
It is very important to adjust the speed of the robot's movement to the velocity of the servo positioning the sensorit may happen that the obstacle is not detected because the robot moves too fast (or changes the position of the sensor too slowly).
Further work is planned to use wireless communication to signal the position of the obstacle and replace ultrasonic sensor with an optical. In addition, it will be possible to create a map of a given room.