Introduction

Researchers have developed multiple methods in tackling a major hurdle that is obstacle avoidance when it comes to development of various robots. Autonomous robots need to be able to navigate through and around obstacles to be able to carry out tasks efficiently. This can be split into two tasks, path planning and obstacle avoidance [1, 2]. Path planning relies on global information and knowledge of the area that needs to be explored. Obstacle avoidance relies on local information in the present obtained through sensors. While path planning is important to minimize time taken to reach a destination, good obstacle avoidance is critical to ensure that the planned path can be carried out with few hindrances.

One of the most used algorithms in the real world for obstacle avoidance is the artificial potential field algorithm (APF) [3]. In this algorithm, T represents the target where the robot moves to and O represents the obstacles which the robot avoids. This is like how magnets apply attractive and repulsive forces. A combination of these forces around the object make up the path of the robot to reach its destination. One of the common problems with a generic force field algorithm is usually an oscillation problem in narrow spaces [3].

ANNs can be used to aid in obstacle avoidance for mobile robots. Neural networks can be used recognize environments surrounding robots and accordingly control speed to guide the robot to the required destination [17]. In this paper, two methods of procuring and processing the local sensor data to carry out obstacle avoidance are explored. The first method uses a modified force field algorithm. The second method uses a neural network to perform obstacle avoidance. Other algorithms for obstacle avoidance include gap method [4], particle swarm optimization [5], genetic algorithm [6], and fuzzy logic [7]. However, they were not considered as part of the scope of this paper.

A modified force field method (also called APF) and a neural network approach are evaluated in this paper. In terms of robot application for the modified APF algorithm, each proximity sensor is given a weight based on the trajectory at which the robot would face the obstacle on forward movement [8]. The obstacles are given repulsive forces, while the target destination is given an attractive force [9]. In the case of no destination, there are only repulsive forces present. The sum of the repulsive forces and the sensor readings aim to provide a sense of direction to the robot. Changes were made to the more commonly used force field method to better adapt for narrow spaces in this paper.

In the neural network approach, a multilayer feed-forward neural network is used. The network takes in sensor inputs and approximates a trajectory for the robot to follow to reach the end position [10, 11]. The neural network was trained with a dataset consisting of possible obstacle cases that could be encountered in a real-world environment.

This paper starts by reviewing existing work related to the force field method and artificial neural networks in the context of obstacle avoidance. Next, the experimental methods used to test the novel modified force field method and the artificial neural network method are presented. The results of the experiments are then discussed, and analysis is carried out. Finally, the paper gives closing thoughts and draws conclusions based on the obtained results.

Review of Previous Literature

Seyyed et al. proposed two modified versions of an artificial potential field (APF) algorithm [3]. The first algorithm proposed was called Bug1. In this algorithm, the robot completely bypasses an object and covers it. The weakness of the algorithm is its inefficiency. An example of the Bug1 algorithm pathing can be seen in Fig. 1.

Fig. 1
figure 1

Bug1 algorithm showcasing pathing of a single robot [3]

Seyyed et al. managed to overcome this problem by introducing another modified algorithm called Bug2 [3]. In the Bug2 algorithm, the robot tries to maintain a path directly from start to end while circling any obstacles. When the robot can get back to the line path, the robot continues to move straight to the target location. An example of this pathing can be seen in Fig. 2. One of the major downsides of the APF algorithm includes the inability to handle scenarios in cases where the robot is unable to get back on path or if the robot is surrounded by obstacles. The robot is therefore trapped. The proposed algorithm successfully tackled this problem and they were able to show simulation results for verification.

Fig. 2
figure 2

Bug2 algorithm showcasing direct pathing of a single robot [3]

However, no practical testing was performed to validate the results. Moreover, both algorithms shown did not account for cases in which obstacles are entirely blocking the path to a target and assumes that there is a target location to begin with. This algorithm could be further tested in situations where a robot is set to free roam to look for certain objects in applications such as search and rescue. The algorithms shown also did not account for cases in which multiple robots are made to navigate an area at once. These algorithms could be further tested in a swarm robotics environment.

Anh et al. proposed a force field method that used rotational force fields and repulsive forces to better avoid more complex shapes [12]. Both clockwise and anti-clockwise forces were analyzed. Simulations were carried out for multiple robots as part of a swarm robot capable of taking either V-shaped or circular-shaped positions while avoiding obstacles and trying to maintain on course for the target. They had one robot in the swarm as a leader robot which was selected using an algorithm, as shown in Fig. 3.

Fig. 3
figure 3

Leader Selection of Obstacle Avoidance Algorithm to determine target tracking control [12]

The leader is set to determine the target tracking control algorithm function, while the members of the swarm follow the function. In cases where the leader gets trapped or cannot maintain shape, the leadership role is passed onto the nearest free member. The robots follow a V-shaped path until the tracked object trajectory is identified. The robots then assume a circular shape to surround the object while maintaining relative velocity. This can be seen in Figs. 4 and 5.

Fig. 4
figure 4

a Swarm robots in a V-shape formation. b Swarm robots in a circular formation [12]

Fig. 5
figure 5

Path followed by swarm robots using rotational force field algorithm [12]

The algorithm successfully demonstrated the function. However, a few critical areas were missed in the work. The performance of this algorithm was not verified with respect to time. While moving objects were tracked by rotational means, many obstacles were of a static nature, and therefore, performance of this algorithm in a dynamic environment is unknown. Moreover, the requirement of a leader in the algorithm meant that robots cannot adapt and carry out individual tasks if needed.

F Shamsfakr et al. proposed a neural network approach to obstacle avoidance in dynamic and unknown environments for a mobile robot. They used a multilayer feed-forward neural network to approximate an appropriate trajectory between the initial position and the target position [13]. They used two different neural networks to achieve better performance. There were two path planning strategies in their approach, this included normal action and wall-following action [14, 15]. In their approach, they were successfully able to showcase two scenarios of obstacle avoidance and path planning in both static and dynamic environments. However, their approach did not cover multi robot setups such as those that would be required in swarm robotics.

Experimental Methods

In this paper, the modified force field method of obstacle avoidance was evaluated in a single robot and swarm environments. The number of robots was varied between one, four, and ten depending on the experiment. The experiments were all carried out in Simulink using MATLAB and results were recorded in the form of time taken to achieve a certain goal. Each robot was made to have eight forward infrared proximity sensors. The experiment was carried out using the Robotics Toolbox differential drive algorithm provided by MathWorks [16]. The algorithms were modified to incorporate the modified force field algorithm.

The modified force field method assumed simplified weightings as opposed to existing methods. Depending on the expected type of navigation required, each sensor can be assigned a weight. For example, in the case of exploration in an open area with less narrow spaces, weights are assigned uniformly for all sensors. However, if the robots are expected to travel in narrow spaces, less weights can be given to side sensors to reduce oscillation. An example of a single robot with eight forward sensors is shown in Fig. 6.

Fig. 6
figure 6

A swarm robot depiction with eight forward sensors

In the case of the proposed force field algorithm, each sensor is given a weight from − 1 to 1 for the direction of x and y based on the expected path. For the purposes of both evaluations, the weights were made the same and can be found in Table 1. The theory behind the selection of these weights are not covered in the scope of this paper.

Table 1 Sensor weights chosen for proposed modified force field method

The sum of the sensor readings multiplied by the contribution is then obtained for both x and y. Using these data, the velocity of the robot is calculated. This is given by:

$$Sum\_x={\sum }_{k=0}^{7}|SensorReading\left(k\_x\right)|$$
(1)
$$Sum\_y={\sum }_{k=0}^{7}|SensorReading\left({k}_{y}\right)|.$$
(2)

A random noise was also added to reduce oscillation in cases where the pathway around obstacles are too tight. This algorithm was designed in MATLAB and incorporated into the robotics toolbox to carry out the test. A flowchart of the algorithm used can be found in Fig. 7.

Fig. 7
figure 7

Algorithm showcasing modified force field algorithm applied robot simulation for the purpose of evaluation 1

For the first evaluation, an open area with multiple target points was selected. A single robot was made to move through the 2-D space until all checkpoints were identified and passed through. The path of the robot was tracked as well to draw other conclusions based on navigation. The purpose of this evaluation was to test the functionality of the tested algorithm and the divergence distance from the object (waypoint in this case). An example of the area used can be seen in Fig. 8.

Fig. 8
figure 8

2-D environment for robot travel created in MATLAB for evaluation 1

The map consists of multiple checkpoints and the program records the time taken for the robot to cover all the different checkpoints. The robot is considered successful once all checkpoints are reached.

In the second evaluation, 2-D maps were also used. However, this time, moving objects were introduced into the simulation to act as obstacles along with the robots themselves. The purpose of the second evaluation is to test how the algorithm performs in a dynamic environment in cases where one, four, or ten robots are used. The goal was for this experiment was to have a robot leave the map. The tests were also carried about for 500 iterations to normalize the effect of having a robot spawn too close to the exit and to get a more average result. The average reading of the results is then recorded. A 2-D map was created in which these robots were made to maneuver. This test environment can be seen in Fig. 8.

In this second evaluation, the robots were placed in random areas and moving objects were made to try and block the path. The timer stopped when any one robot was able to cross the exit out of the grid.

In the third evaluation, a multi-layered feed-forward neural network was used to determine the trajectory of the robots. Each robot uses an independent neural network which consists of inputs from each of the sensors as well as the location of another robot in the setup. The neural network used to determine the trajectory can be seen in Fig. 9.

Fig. 9
figure 9

Multilayered feed-forward neural network used to approximate the trajectory of the robots based on the location of the other robots and the sensor data

R1x and R1y represent the Cartesian co-ordinates of a particular swarm robot in a 2-D plane with reference to one robot. This means one robot input will always be [0,0], but the other robots will have different co-ordinates that change based on the relative position. Sensors one through eight represent the eight sensors present on a robot. It was designed specifically for a swarm robot consisting of four robots. This can be scaled to n number of robots as needed. Back propagation was done to carry out training of the neural network. The data set used was obtained by carrying out simulations of the FFM and obtaining the various turn angles. The obstacle avoidance algorithm was then implemented in MATLAB to carry out simulations to find the efficacy of the algorithm.

The neural network was then applied to the robots used for evaluations 1 and 2 to obtain simulation results for the time taken to reach the exit target similarly to how it was carried out for evaluation 2. 2-D maps were used like in Fig. 10. The purpose of the third evaluation is to identify how well the neural network approach performs in comparison to the modified force field algorithm. This evaluation was also carried out for one, four, and ten robots, respectively. The tests were also carried about for 500 iterations to normalize the effect of having a robot spawn too close to the exit and to get a more average result. The average reading of the results is then recorded.

Fig. 10
figure 10

2-D environment for robot travel created in MATLAB for evaluation 2

Results and Analysis

In the first experiment, the modified force field algorithm was simulated to run in an open area and was tasked with crossing four checkpoints. This was performed for 100 iterations to obtain more reliable results. An example of the result for the force field method experiment with respect to pathing can be seen in Fig. 11.

Fig. 11
figure 11

Pathing of robot using force field method in Evaluation 1

The divergence from each waypoint after the first was recorded to evaluate functionality, and this can be seen in Fig. 12.

Fig. 12
figure 12

Average divergence observed from robot to waypoint over 100 iterations

It was observed that the simplified modified force field method had a bigger divergence from the waypoint path following a much looser restriction. However, due to this nature of the algorithm, this was expected. Moreover, the robot was successfully able to navigate around the test environment proving the functionality of this algorithm.

In the second experiment, the modified force field algorithm was run in an open area with multiple robots and tasked to find the exit. This was done to evaluate how different number of robots perform in a dynamic environment. An example of the simulation results of this experiment being run with four robots can be seen in Fig. 13.

Fig. 13
figure 13

Pathing of four robots using force field method in Evaluation 2

The performance with respect to time taken was also recorded to identify the time taken for every robot to exit via the red goal. This result over 500 iterations was averaged out and recorded in Fig. 14 for three cases where one, four, and ten swarm robots were navigating the space.

Fig. 14
figure 14

Average time taken over 500 iterations for each robot to exit space

The red line crossing through the moving objects was added as a guide for clarity to determine the moving path. The red crosses serve as guides for the robots to reach the destination. For example, in Fig. 13, robot 3 can be seen successfully leaving the area.

From analysis of Fig. 14, one swarm robot takes the most time to exit with 89.6 s compared to adding multiple robots into the same experiment. This was the expected result since random placements onto the escape grid and lack of robot interaction reduces the ability of the robot to navigate the space. In contrast, the experiment with four and ten swarm robots take 26.4 and 29.4 s, respectively. This was again expected as adding more robots provide a multi-robot environment in where the robots can interact with each other and exit the environment. However, in the ten-robot scenario, the initial robot took longer than for four robots which was inconsistent with the expectation. This can be attributed to the size of the experiment space; an observation was made where the correct number of swarm robots needs to be selected depending on the available space for the experiment.

The results obtained from the third evaluation also included the identification of the time taken to exit the red goal, as shown in Fig. 13. These results are, however, shown for when the multi-layered feed-forward neural network is applied to the robots. The average time taken over 500 iterations for each robot to exit the space can be seen in Fig. 15.

Fig. 15
figure 15

Average time taken over 500 iterations for each robot to exit space using the neural network approach

From analysis of Figs. 14 and 15, the neural network approach can identify the exit and path more efficiently as compared to the modified force field algorithm. This was expected, since the neural network is trained with many scenarios so can optimize the pathing on the fly. Whereas the modified force field algorithm uses a set of specified weights. The difference for one robot was 89.6 s for the modified force field algorithm and 76.2 s for the neural network approach which is an improvement of ~ 15%. The difference is even more noticeable when you add more robots. The time taken for the first exit with ten robots in the modified force field algorithm was found to be 29.4 s. However, the time taken was found to be 18.5 s for the neural network approach. This is an improvement of ~ 58%. The improvement diminishes as the robots that exit move up. However, it was found that the overall aggregate improvement was approximately ~ 27%.

Conclusion

In this paper, the performance and functionality of a modified yet simplified force field algorithm and a neural network approach for obstacle avoidance was analyzed. The experiments and simulations used infrared sensors and tested three scenarios where there were one, four, or ten robots present at a given time. The algorithms were successful in navigating an open environment and a dynamic environment in the MATLAB simulation environment.

In open areas, the algorithm with force field methods was shown to have a moderate divergence (0.23–0.44 cm) which could be improved with a different sensor type. In more dynamic areas, the infrared algorithm with force field methods was shown to be slower by about 340% over 500 iterations with only one robot due to hindrances caused by obstacles and the lack of robots to interact. However, the swarm robotics environments showcased much faster results (26.4–29.4 s) compared to a single robot which was in line with what was expected. Moreover, the neural network approach showed an even further improvement in performance as compared to the modified force field algorithm. The neural network approach showed an improvement by approximately ~ 27%.