1 Introduction

Robots are mainly used in the industrial field to replace people to complete search, rescue, and other complex works in dangerous or harsh environment. They can also be used in the military field to complete reconnaissance, demining and other tasks, as well as in the other fileds like medical and aerospace [1]. The tasks in the above fields are classified from the perspectives, mainly including target searching, rescuing, mechanical activities, exploration and humanoid applications like football etc. [2]. When working in complex and dangerous environments, there are more dangerous factors in manual operations, which threaten the life safety of workers. The multi-robot system collaborative target searching has broad application prospects in resource exploration, military anti-terrorism, post-disaster search and rescue, and replacing human beings to perform dangerous tasks in special environments [3].

Wang et al. [4] simplified obstacles into two situations: continuous and non-continuous obstacles, and moved to a specific boundary according to the situation. Particle swarm optimization (PSO) for target position estimation used the acquired target signal to estimate the target position, and reached the vicinity of the target, so as to achieve target search. There were obstacles in the planned path of this method, and the obstacle avoidance ability was poor. Gao et al. [5] provided a probability calculation model based on the actual working environment, built a probability map based on the model, and then proposed a robot target search path planning method with the expected shortest time as the optimization index. The method adopted a hierarchical planning mode and carried out topological point sequence planning in the upper topological map. The local path planning between topological points in the lower feature map was too long, and the path planning effect was not ideal. Fan et al. [6] proposed a target search and rounding framework for swarm robots based on consensus initiative, which improved the anti-ant colony algorithm and added a variety of pheromones to help swarm robots cooperate to explore the environment and generate pheromone maps. At the same time, the framework combined the pheromone map generated in the previous stage with the hierarchical gene regulatory network model to complete the task of searching and rounding up the dynamic target of swarm robots in the scene with unknown environmental information and limited communication. The path planning time required by this method was too long, and there were problems of low planning efficiency. Kumar et al. [7] proposed a path planning method for autonomous robots based on an improved grey wolf optimization method. By modifying and optimizing the traditional grey wolf optimization algorithm, the improved method can find the optimal path and maintain a safe distance from other objects and robots, with high efficiency and feasibility. However, this method required multiple iterations to achieve good results, resulting in a longer execution time. Nascimento et al. [8] proposed probabilistic foam based safe path planning algorithm for mobile robots, which ensured a safe path through a series of bubble structure constraints and provided a safe area. However, when performing path planning, the probabilistic foam method needed to build a series of bubble structures to limit the safe path and cover the free configuration space. This process required much calculation and time. Durakl et al. [9] proposed a new path planning method for mobile robots based on Bezier curves, using grid graphs to model the environment and traditional algorithms to find paths between the starting and ending points. By pruning based on Bezier curves to discard excess nodes and smoothing peaks, path planning was achieved. This method had high computational complexity and required a significant amount of computing resources and time, resulting in reduced planning efficiency.

The existing methods have some problems such as poor obstacle avoidance ability, long path and low planning efficiency. Therefore, the shortest path control method for robot target search in a large range of complex tasks is proposed. The main contributions of this article's method are shown as below.

  1. (1)

    Establishment of environmental map: Collect environmental information through laser sensors, and use line extraction, line matching, and line fitting techniques to establish an environmental map for target search. This method can accurately describe obstacles and target points in the environment, providing an important data foundation for subsequent path planning.

  2. (2)

    Application of slime mold optimization: By using slime mold optimization algorithm, the shortest path is found by establishing an objective function for target searching path, avoiding collision with obstacles. Compared to other shortest path planning algorithms, slime mold optimization algorithms has certain advantages in handling complex environments and large-scale tasks.

  3. (3)

    Path control design: By designing a controller, the robot is ensured to move along the optimal path and complete the target search task. This controller can respond in real-time to environmental changes and obstacle dynamics, ensuring that the robot can efficiently and safely complete tasks.

2 The Construction of Environment Map

The sensor carried by the robot detects environmental information, extracts the features of obstacles and targets, and generates a map that the robot can recognize. Maps are represented differently due to different sensors. The proposed method uses a laser sensor [10, 11], which collects a large number of information points per cycle with high accuracy, and can quickly collect data points at a higher frequency, making it suitable for extracting straight line features. Moreover, the linear map has low-level topological information and is suitable for a wide range of environments, a straight line is a line segment with a simple geometric shape, which is more convenient in description and modeling. In contrast, curves have complex shapes that require more data to describe and are more complex in processing and calculation. And line maps provide intuitive path information, making it easier for robots to plan and navigate, improving planning efficiency, so the linear map is chosen as the description method of the environmental model.

The construction of environmental maps is mainly divided into three steps: line extraction, line matching, and line fitting. The information about obstacles and target points collected through laser sensors is processed to extract straight line segments. Match these line segments with the generated line segments in the global map to determine if they are related. If there is no correlation, directly import the global map; If there is correlation, perform line fitting, generate new line segments, and update the global line map.

2.1 Straight-Line Extraction

2.1.1 Data Preprocessing

The laser sensor can obtain the distance information of the object within a range of 180°to ensure the accuracy of the measurement, only the monitoring data of the object within a certain range of the distance robot is extracted. These data are represented by the polar coordinates of the robot. In order to facilitate calculation, the data represented by polar coordinates are converted into data information in Cartesian coordinate system. The schematic diagram of coordinate transformation is shown in Fig. 1.

Fig. 1
figure 1

Diagram of coordinate transformation

In Fig. 1, the point \(J\) is the information point of an object detected by the laser sensor, \(\beta\) indicates the angle of \(OJ\) to the pole axis, \(OX\) and the point \(J\) Cartesian coordinates are:

$$\left\{\begin{array}{l}x=r\;\mathrm{cos}\;\beta \\ y=r\;\mathrm{sin}\;\beta \end{array}\right.$$
(1)

where \(r\) represents the distance between the point \(J\) and the origin \(O\) of the coordinate system. Through the above method, the polar coordinates of the objects detected by the laser sensor are converted to Cartesian coordinates.

2.1.2 Regional Division

After obtaining the right-angle coordinates of the obstacle, the coordinates of these points are divided into disconnected areas according to the size of the straight-line distance between the two points, and they are processed separately. The schematic diagram of regional division is shown in Fig. 2. There are obvious spacing between different obstacles \({E}_{1}\), \({E}_{2}\) \({E}_{3}\), which belong to the three regions that are not connected.

Fig. 2
figure 2

Diagram of region division

For the robot, after extracting the information of the points, a threshold \({F}_{1}\) is set to judge whether they are the same object. If the distance between two points is less than the threshold \({F}_{1}\), the two points are considered to be continuous and belong to the same object. If the distance between two points is greater than the threshold value \({F}_{1}\), the two points are considered to be the division points of the region, respectively representing an object, is not connected.

The specific judgment process is as follows:

  1. (1)

    Calculate the distance \({f}_{i}\) between the two points:

  2. (2)

    To judge the relationship between \({f}_{i}\) and the threshold value \({F}_{i}\), the region is divided into two parts when \({f}_{i}>{F}_{1}\) takes \(\left({x}_{i},{y}_{i}\right)\) as the split points, the regions \({E}_{1}\left\{\left({x}_{0},{y}_{0}\right),\left({x}_{1},{y}_{1}\right),Z\left({x}_{1},{y}_{1}\right)\right\}\) and \({E}_{N}\left\{\left({x}_{i+1},{y}_{i+1}\right),\left({x}_{i+2},{y}_{i+2}\right),Z\right\}\) can be obtained, and the \({E}_{N}\) is treated in the same way, thus obtaining \({E}_{2}\) and \({E}_{3}\). And so on, and the whole area \(\left({E}_{1}, {E}_{2},{E}_{3},L ,{E}_{n-1},{E}_{n}\right)\) can be eventually get.

2.1.3 Straight Line Segmentation

The IEPF algorithm is used to segment the line segment. The algorithm is an iterative algorithm, and the line segment is segmented by setting a fixed threshold. The region segmentation diagram is shown in Fig. 3.

Fig. 3
figure 3

Schematic diagram of region segmentation

All the points in Fig. 3(a) are the set of one of the regions \({E}_{i}\). Take the first point \(A\) and the last point \(D\) as the line segment \({Z}_{1}\), and calculate the distance from the remaining points in this region to \({Z}_{1}\). As can be seen from the figure, the maximum value \({P}_{1}\) is obtained at point \(P\), and a distance threshold \({F}_{2}\) for line segment segmentation is set. If \({P}_{1}\) is less than threshold \({F}_{2}\), the region can be represented by a straight line segment; if \({P}_{1}\) is greater than threshold \({F}_{2}\), the region is divided into \({S}_{1}\) and \({S}_{1}\) by using point \(C\) as the segmentation point, and then the region \({S}_{1}\) and \({S}_{1}\) are processed by the same method.

As shown in Fig. 3(b), connect points \(A\) and \(C\) to form A straight segment \({Z}_{2}\) in the region \({S}_{1}\), the maximum distance from \(B\) point to \({Z}_{2}\) is \({P}_{2}\), and then the size of it and threshold \({F}_{2}\) is determined. By this on, until the maximum distance between the beginning and the end of the region is less than the threshold value \({F}_{2}\), to obtain a set of \(N\) points that can be represented by a straight segment. The schematic representation of the region Ei segmentation is shown in Fig. 4.

Fig. 4
figure 4

Schematic representation of region Ei segmentation

In Fig. 4, two segmentation points \(B\) and \(C\) are obtained after the segmentation of \({E}_{i}\), thus dividing the region into three point sets, which are red, black and blue respectively.

After the above method, \(N\) point set \({Z}_{i}\) can be represented by a straight line segment is obtained. However, due to the existence of noise, these points are not strictly linear and need to be fitted. The least square method [12] was used to complete the parameter estimation of line segment features.

Suppose that the function relation of \(x\) and \(y\) is:

$$y={s}_{0}+{s}_{1}x$$
(2)

There are two undetermined parameters in the above equation, \({s}_{0}\) represents the intercept and \({s}_{1}\) represents the slope. For the \(N\) group of measurements to be fitted, their \(x\) values are considered to be fixed, and the error is related to \(y\).

When using the least square method to estimate the parameters, the deviation weighted sum of squares of \({y}_{i}\) should be minimized. For each set of observations, minimizing formula (2) is the optimal estimate \(\sum_{i=1}^{N}{y}_{i}-{\left.{\left({s}_{0}+{s}_{1}{x}_{1}\right)}^{2}\right|}_{s=\widehat{s}}\) of \(s\) (\({s}_{0}\) and \({s}_{1}\)). In order to minimize the deviation-weighted sum of squares of \({y}_{i}\), the following requirements need to be met:

$$\left\{\begin{array}{c}\frac{\partial }{{{\partial }_{S}}_{0}}\sum_{i=1}^{N}{y}_{i}-{\left.{\left({s}_{0}+{s}_{1}{x}_{i}\right)}^{2}\right|}_{s=\widehat{s}}=-2\sum_{i=1}^{N}\left({y}_{i}-{\widehat{s}}_{0}-{\widehat{s}}_{1}{x}_{1}\right)=0\\ \frac{\partial }{{{\partial }_{S}}_{0}}\sum_{i=1}^{N}{y}_{i}-{\left.{\left({s}_{0}+{s}_{1}{x}_{i}\right)}^{2}\right|}_{s=\widehat{s}}=-2\sum_{i=1}^{N}\left({y}_{i}-{\widehat{s}}_{0}-{\widehat{s}}_{1}{x}_{1}\right)=0\end{array}\right.$$
(3)

Solve the above formula to obtain the best estimates \({\widehat{s}}_{0}\) and \({\widehat{s}}_{1}\) of \({\widehat{s}}_{0}\) and \({s}_{1}\):

$$\left\{\begin{array}{c}{\widehat{s}}_{0}=\left[\left(\sum {x}_{i}^{2}\right)\left(\sum {y}_{i}\right)-\left(\sum {x}_{i}\right)\left(\sum {{x}_{i}y}_{i}\right)\right]/\left[N\left(\sum {x}_{i}^{2}\right)-{\left(\sum {x}_{i}\right)}^{2}\right]\\ {\widehat{s}}_{1}=\left[N\left(\sum {{x}_{i}y}_{i}\right)-\left(\sum {x}_{i}\right)\left(\sum {y}_{i}\right)\right]/\left[N\left(\sum {x}_{i}^{2}\right)-{\left(\sum {x}_{i}\right)}^{2}\right]\end{array}\right.$$
(4)

After fitting calculation by least square method, the optimal solution \(y={\widehat{s}}_{0}+{\widehat{s}}_{1}x\) of the line is obtained, which is converted into the standard linear equation \(Ax+By+C=0\), and the two endpoints of the fitted line segment are the projection point [13, 14] from the beginning and end point of the point set \({Z}_{i}\) to the line, that is, the vertical point from the beginning and end point of the line. The calculation of vertical coordinates is shown in Fig. 5. The vertical line is drawn from point \(A\left({x}_{0},{y}_{0}\right)\) to line, \({Z}_{i}\) the vertical foot is point B, and the coordinates of point B are:

Fig. 5
figure 5

Calculation of vertical coordinates

$$\left\{\begin{array}{c}{x}_{1}=\left({B}^{2}{x}_{0}-{ABy}_{0}-AC\right)/\left({A}^{2}+{B}^{2}\right)\\ {y}_{1}=\left({A}^{2}{y}_{0}-{ABx}_{0}-AC\right)/\left({A}^{2}+{B}^{2}\right)\end{array}\right.$$
(5)

After the above steps, parameters of the fitted line segment are obtained: slope, intercept, starting coordinates, ending coordinates and length of the line segment. The linear segment is extracted by the object data collected by the laser sensor, and the local map generated by the object information collected in the current period is obtained.

2.2 Straight Line Matching

After extracting the line segments, these line segments are matched with the existing line segments in the global map according to the correlation conditions. Suppose that the two endpoints of a line segment in the global map are \({P}_{k1}\) and \({P}_{k2}\), the two endpoints of a newly detected line segment in the local map are \({P}_{1}\) and \({P}_{2}\), and the Angle between the two line segments is \(\eta\). The relationship between two endpoints and another line segment exists in the following two cases:

  1. (1)

    The vertical point is in the line segment.

  2. (2)

    The vertical point is on the extension of the line segment.

The line where the line segment \(AB\) is located at point \(C\) is the vertical segment, and the vertical foot is \(D\). If \(AD>BD\) and \(AD>AB\) D, or \(BD>AD\) = and \(BD>AB\), the vertical point is on the extension of the line segment, otherwise the vertical point is on the line segment.

The vertical distance from the point to the line segment is represented by \({d}_{v}\), and the projection distance from the point to the line segment is represented by \({d}_{p}\) [15]. The vertical distance and projection distance are shown in Fig. 6. In Fig. 6(a), no matter in the first or second case, vertical distance represents the distance \({d}_{v1}\) and \({d}_{v2}\) from \({P}_{k1}\) and \({P}_{k2}\) to the line where line segment \({Z}_{n}\) is located. Vertical distance \(d\) can be calculated by the following formula:

Fig. 6
figure 6

Vertical and projected distance

$$d=\left|{Ax}_{0}+{B}_{{y}_{0}}+C\right|/\sqrt{{A}^{2}+{B}^{2}}$$
(6)

In Fig. 6(b), for the first case, the projected distance is the distance \({d}_{v2}\) from point \({P}_{k2}\) to line segment \({Z}_{n}\), which can be calculated by formula (8). For the second case, the projected distance \({d}_{p1}\) is the distance between \({P}_{k1}\) and \({P}_{1}\).

The distance between two points \({p}_{i}\) and \({p}_{j}\) is denoted by \(\left({p}_{i},{p}_{j}\right)=\Vert {p}_{i}-{p}_{j}\Vert\). The projected distance from point \({P}_{i}\) to line segment \(z\) is represented by \(\left({p}_{i},z\right)=\begin{array}{c}\mathrm{min}\\ {p}_{i}\epsilon z\end{array}\Vert {p}_{i}-{p}_{j}\Vert\), and the vertical distance from point \({p}_{i}\) to line segment \(z\) is represented by \({d}_{p}=\begin{array}{c}\mathrm{min}\\ {p}_{i}\epsilon z\cup z+\end{array}\Vert {p}_{i}-{p}_{j}\Vert\), where \(z+\) is the extension line of \(z\).

The distance relationship between two line segments is defined by the Hausdorff distance, which represents the maximum distance value in the projected distance between any point on one and another line segments [16, 17], that is, \({d}_{H}\left({z}_{i},{z}_{j}\right)=\underset{{p}_{i}{\mathit{\epsilon z}}_{i}}{\mathrm{min}}\left\{\underset{{p}_{i}{\mathit{\epsilon z}}_{i}}{\mathrm{min}}d\left({p}_{i},{p}_{j}\right)\right\}\). The Hausdorff distance is oriented rather than symmetric, that is, \({d}_{H}\left({z}_{i},{z}_{j}\right)\ne {d}_{H}\left({z}_{i},{z}_{j}\right)\). Hausdorff distance is used to define an undirected distance measure \({d}_{H}\left({z}_{i},{z}_{j}\right)=\underset{}{\mathrm{max}}\left[{d}_{H}\left({z}_{i},{z}_{j}\right),{d}_{H}\left({z}_{j},{z}_{i}\right)\right]\).

The straight-line matching process is as follows:

  1. (1)

    Take out a newly detected line segment, calculate its length, if less than 20 mm, it is considered to be interference line segment, delete it, and then take the next line segment for calculation until the line segment that meets the conditions is found;

  2. (2)

    Match the qualified line segments with each line segment in the global map in turn. If the following formula is met, it is considered that there is correlation between them and the matching is successful. Otherwise, the match fails:

    $$d({z}_{i},{z}_{j})<{F}_{3}$$
    (7)

    where, \({F}_{3}\) represents the distance threshold.

  3. (3)

    Repeat the above steps to complete the correlation judgment for each newly detected straight line segment.

2.3 Line Fitting

By matching the lines, determine the correlation between each newly detected line segment and the line segment in the global map. If the matching fails, it indicates that the line segment has not been detected before and is directly imported to the global map. If the match is successful, the least square method will be used to fit the two straight lines [18, 19], the fitted straight lines will be added to the straight line map, and the corresponding two straight lines in the global map and the local map will be deleted. The specific flow chart of the map update is shown in Fig. 7.

Fig. 7
figure 7

Map update flow chart

3 Robot Target Search Shortest Path Control

3.1 Shortest Path Planning

3.1.1 Path Planning Objective Function

The slime mold optimization algorithm (SMOA) is used to plan the shortest path of the robot in the process of target search. The slime mold optimization algorithm is an algorithm for finding the shortest path. Compared with other methods, this algorithm transforms the robot search path problem into a problem of finding the optimal solution in the search space by simulating the behavior of slime molds in nature when searching for food. During this process, slime molds continuously update their location and environmental information, and use pheromones to guide other slime molds to better locations. In this process, this method can greatly avoid falling into local optima and find the shortest path.

It is assumed that the robot moves in a finite area on a two-dimensional plane where there are finite static and dynamic obstacles. According to the map established in Section 2, the information of obstacles and targets within the range can be obtained, and the size and location of obstacles can be judged and estimated, and the moving speed and direction of moving objects can be estimated.

The task of path planning is to obtain the best path to avoid all obstacles between the robot's position and the local target position according to the real-time information of the environment [20, 21].

With a balance between convergence speed, faster decision-making ability and accuracy to achieve superior foraging ability and avoid falling into local minima, slime molds adapt to random search situations based on the source of food quality. In the case of abundant food quality, slime molds will forage near it and concentrate on the encirclement of the food source. When food quality is insufficient, slime molds explore other spaces in search of food.

The main stage of slime is the period of nutrient capture. During this period, the cytoplasm in the slime mold seeks out food, surrounds it, and secretes enzymes to digest it. During movement, the front end extends into a fan and then forms a network of interconnected veins that allow the cytoplasm to flow inside. Due to their unique patterns and characteristics, they can utilize multiple food sources at the same time, forming a network of interconnected veins.

Explore and find nutrients and food sources: slime bacteria follow the food odor in the air. Circular, this structure allows slime obacteria to explore food in all potential directions near the optimal solution. The population of myxobacteria is treated by initialization below \({X}_{i}(t)\):

$${X}_{i}(t)=unifrnd({L}_{B},{U}_{B},1,N)$$
(8)

where, \({L}_{B}\), \({U}_{B}\) are the upper and lower bound of the population, and \(N\) indicates the population size.

The food search behavior of the population can be described by:

$$\overrightarrow{X}(t+1)=\left\{\begin{array}{cc}{\overrightarrow{X}}_{b}(t)+{\overrightarrow{v}}_{b}+[W{\overrightarrow{X}}_{A}(t)-{\overrightarrow{X}}_{B}(t)]& r<p\\ {\overrightarrow{v}}_{c}\overrightarrow{X}(t)& r\ge p\end{array}\right.$$
(9)

where, \(\overrightarrow{X}(t)\) and \(\overrightarrow{X}(t+1)\) are the positions of individual myxobacteria before and after the search respectively. \({\overrightarrow{X}}_{A}(t)\) and \({\overrightarrow{X}}_{B}(t)\) are randomly selected individuals. \(W\) represents the weight coefficient; \({\overrightarrow{X}}_{b}(t)\) is the position of the best fitness; \({\overrightarrow{v}}_{b}\) and \({\overrightarrow{v}}_{c}\) both represent the learning factor.

The parameters \(r\) and \(p\) are calculated by the following formula:

$$\left\{\begin{array}{c}r=arctanh[-(t/{\mathrm{max}}_{t})+1]\\ p=tan|D(i)-{D}_{F}|\end{array}\right.$$
(10)

where, \(t\) is the number of current iterations. \({\mathrm{max}}_{t}\) represents the maximum number of iterations. \(D(i)\) is the fitness of the next generation. \({D}_{F}\) is the current best fitness.

Wrapping food: In this step, slime molds surround and devour food sources by extending their veins. The positive and negative feedback \(\overline{W }S(i)\) between myxomycetes vein width and food quality was calculated by the following formula

$$\overline{W }S(i)=\left\{\begin{array}{cc}1+r\mathrm{log}\{[{b}_{F}-D(i)]/[{b}_{F}+{w}_{F}]\}& condition\\ 1-r\mathrm{log}\{[{b}_{F}-D(i)]/[{b}_{F}+{w}_{F}]\}& other\end{array}\right.$$
(11)

where, \({b}_{F}\) is the best fitness of this generation. \({w}_{F}\) indicates the worst fitness of this generation.

The search population \(X\) at iteration \(i\) is updated with reference to the best position \({X}_{b}\) at iteration \(i\), whose position can be changed by fine-tuning \({\overrightarrow{v}}_{b}\), \({\overrightarrow{v}}_{c}\), and \(W\). The logarithmic factor increases the rate of change of the value to avoid random perturbations in the frequency of venous contraction. Slime molds adjust their exploration process according to the quality of the food. When the food source is larger, the weight near it becomes larger. When food is insufficient, the weight of the nearby area is reduced and other areas are explored.

Prey capture/Oscillation: Biological oscillators emit waves to locations with higher concentrations of food to alter cytoplasmic flow in the veins of the slime mold. The oscillation frequency in the SMO algorithm depends on \(W\). Where the concentration of food is higher, the oscillation frequency is higher. And where the concentration of food is lower, the oscillation frequency is lower, so the speed of reaching the food is slower. This process increases the proficiency of the SMO algorithm and results in a globally optimal solution (high concentration food source). The advantage of this approach is that even after the best food source is obtained, it still strives to explore nearby locations to obtain a higher optimal solution, thus avoiding local minima and early erroneous convergence.

Taking finding the shortest path and avoiding obstacles and collision [22, 23] as targets, the robot target search path planning objective function \(F\) is established

$$F(OV)={P}_{L}+\eta p{P}_{L}D$$
(12)

where, \(OV\) represents the target value, \({P}_{L}\) represents the path length, \(\eta\) represents the scale factor, and \(D\) represents the average distance value between all insertion points and all obstacles. This value is zero when the maximum number of insertion points is outside the obstacle.

The above objective function is intended to be minimized through all iterations of nature-inspired algorithm evolution. This minimizes the path length that satisfies the first constraint. The second goal is achieved by minimizing \(D\). Scale factors are used to determine the influence of path distance obstacles. The larger the scale factor, the more emphasis is placed on excluding paths that contain collisions.

3.1.2 Implementation of Path Planning Based on SMO

The path planning task is decomposed into multiple local planning tasks, and the local path planning is performed by moving the window in the established environment map.

The current position of the robot is the starting point \(S\), the target position is the target point \(T\), and a set of equally spaced points \({L}_{1},{L}_{2},\cdots ,{L}_{n-1}\) on the starting point and the target point line \(ST\) is defined as the subtarget.

Define a moving window \({Q}_{i}\), \(i=\mathrm{0,1},\cdots ,n-1\), with length \(||{L}_{i+1}-{L}_{i}||\) and width \(2I\), where \({L}_{0}=S\), \({L}_{n}=T\), and the window size is determined by the scope of the environment map.

The robot performs path planning in each scrolling window \({Q}_{0},{Q}_{1},\cdots ,{Q}_{n-1}\) in turn. When the robot reaches the sub-target \({L}_{i}\), the following procedure is performed:

  1. (1)

    Perceive obstacles in window \({Q}_{i}\) and save parameters about obstacles.

  2. (2)

    With \({L}_{i}\) as the starting point and \({L}_{i+1}\) as the target point, the slime mold optimization algorithm is used to plan the path, and a collision-free path with the shortest distance was planned.

  3. (3)

    The robot moves from the starting point \({L}_{i}\) to the target point \({L}_{i+1}\) at a constant speed along the shortest path planned in the previous step.

  4. (4)

    \(i+1\to i\), return to (1) for the path planning for the next window.

    This process continues until the robot reaches its target.

3.2 Translational Control

During the robot target search process, the controller shown in Fig. 8 is designed to control the robot to move along the optimal path obtained in Section 3.1. Based on the optimal path information, the controller will generate motion instructions for the robot, including forward, backward, turning, and other actions. Based on the node order of the optimal path, the controller will determine when the robot will turn and move forward to maintain movement on the optimal path, while guiding the robot to bypass obstacles to ensure that the robot can continue to move along the optimal path.

Fig. 8
figure 8

Diagram of Controller

In Fig. 8, \({o}_{d}\) represents the desired position vector. It can be expressed either as a fixed point or as a continuous trajectory. \(o\) represents the current position vector of the robot. The error \(e\) between \({o}_{d}\) and \(o\) is called the tracking error. \({K}_{e}\) is a diagonal matrix with dimensions consistent with the degree of freedom of the robot, called the compensation gain. The symbol \(\sum\) represents the accumulator, which adds up the the points \({K}_{e}e\) on the trajectory that have been tracked. The output of the accumulator is added to \({o}_{d}\) to obtain a new command or a corrected reference trace \({o}_{e}\). The controller then adjusts the robot motion according to the command error \(\delta o\), and \(\delta o\) is the error between \({o}_{e}\) and \(o\). When \({K}_{e}=0\), \({o}_{e}={o}_{d}\), \(\delta o=e\).

Assuming that the trajectory of each joint is discrete to an infinite number of points, the sampling time interval between adjacent points is \(T\). According to Fig. 8, the error between the first desired point and its current position is \({e}_{1}={o}_{d}^{(1)}-{o}^{(1)}\), and the new instruction \({o}_{e}^{(1)}={o}_{d}^{(1)}+{K}_{e}^{(1)}{e}_{1}\) and instruction error \(\delta {o}^{(1)}={o}_{e}^{(1)}-{o}^{(1)}\) after the first compensation.

The relationship between the first point tracking error and the instruction error is obtained from the above analysis:

$${e}_{1}=\delta {o}^{(1)}-{K}_{e}^{(1)}{e}_{1}$$
(13)

After the first point compensation, the joints of the robot reach position \({o}^{(2)}\) after the action of the controller. Similar to before, we can get:

$$\left\{\begin{array}{c}{e}_{2}={o}_{d}^{(2)}-{o}^{(2)}\\ {o}_{e}^{(2)}={o}_{d}^{(2)}+{K}_{e}^{(1)}{e}_{1}+{K}_{e}^{(2)}{e}_{2}\\ \delta {o}^{(2)}={o}_{e}^{(2)}-{o}^{(2)}\end{array}\right.$$
(14)

On the basis of the following:

$${e}_{2}=\delta {o}^{(2)}-{K}_{e}^{(1)}{e}_{1}-{K}_{e}^{(2)}{e}_{2}$$
(15)

By the same token, we obtain:

$$\left\{\begin{array}{c}{e}_{n}=\delta {o}^{(n)}-{K}_{e}^{(1)}{e}_{1}-{K}_{e}^{(2)}{e}_{2}-\cdots -{K}_{e}^{(n-1)}{e}_{n-1}-{K}_{e}^{(n)}{e}_{n}\\ {e}_{n+1}=\delta {o}^{(n+1)}-{K}_{e}^{(1)}{e}_{1}-{K}_{e}^{(2)}{e}_{2}-\cdots -{K}_{e}^{(n)}{e}_{n}-{K}_{e}^{(n+1)}{e}_{n+1}\end{array}\right.$$
(16)

Subtract the two formulas in formula (16) to obtain the following formula:

$${e}_{n+1}={(I+{K}_{e}^{(n+1)})}^{-1}({e}_{n}+{E}_{n+1})$$
(17)

where, \(I\) is the identity matrix. \({E}_{n+1}\) represents the difference of the instruction error.

For convenient description, \(E\) is used to represent the difference of the instruction error obtained in each compensation.

Expand the formula (18) iteratively to obtain:

$$\begin{array}{c}{e}_{n+1}={(}^{I}\cdots {(}^{I}({e}_{1}+{E}_{1})\cdots +\\ {(}^{I}\cdots {(}^{I}{E}_{j}\cdots +{(}^{I}{E}_{n+1}\end{array}$$
(18)

where, \({e}_{1}\) is the error between the joint position in the initial state and the expected trajectory. The above equation shows that as long as \({K}_{e}\) is a positive definite matrix and the difference \(E\) of the instruction error equals zero, the tracking error \({e}_{1}\) will converge and will not be affected by \({e}_{1}\), and the larger the element value in \({K}_{e}\), the faster the convergence rate.

4 Experiment and Discussion

In order to verify the overall effectiveness of the shortest path control method for robot target search in a large range of complex tasks, it is necessary to test it, select the Robotics System Toolbox in MATLAB for simulation, and establish an environment with a size of 50 m × 50 m, including obstacles and target devices. Select the LiDAR sensor and set its scanning range to 360 degrees with a maximum detection range of 30 m. Reference [4], reference [5] and reference [6] methods are introduced into the test process as comparison methods to ensure the authenticity of the test. The robot target search environment is shown in Fig. 9.

Fig. 9
figure 9

The target search environment

In the environment shown in Fig. 9, the proposed method, the reference [4] method, the reference [5] method and the reference [6] method are used, and the path planning results of the four methods are shown in Fig. 10

Fig. 10
figure 10

Path planning results

Analyzing Fig. 10, it was found that the path planned by the proposed method can successfully avoid dynamic and static obstacles in the environment, which proves that the proposed method has strong obstacle avoidance ability. The path planned by the method in reference [4] did not successfully avoid static obstacles, indicating that this method has certain limitations in avoiding static obstacles. Although the method in reference [5] can successfully avoid obstacles in the environment, the path is too long, which can affect the operational efficiency and time of the robot. The path planned by the method in reference [6] did not successfully avoid dynamic obstacles, indicating that this method has certain shortcomings in avoiding dynamic obstacles. Through the above tests, it has been verified that the proposed method has strong obstacle avoidance ability. In the field of industrial automation, this method can autonomously navigate through busy production lines, avoiding workpieces or other mobile devices, to ensure the stability and safety of the production process.

10 experimental environments are set up, use the above method to expand the path planning, and test the path length of the four methods. The results are shown in Fig. 11.

Fig. 11
figure 11

Path length

From Fig. 11, it can be seen that in different environments, the path length planned by the proposed method is the shortest, always within 6, while the path length planned by the methods in reference [4, 5], and [6] are all greater than the proposed method. Through comparison, it can be seen that the path length planned by the proposed method is the shortest. This is because the proposed method takes the shortest path length as the optimization objective when establishing the path planning objective function, so it can reach the search target with the shortest distance in complex environments. In practical applications, the proposed method has broad application potential in path planning. It can be applied in fields such as autonomous vehicles, drones, industrial robots, etc. to achieve more efficient, safe, and reliable path planning and navigation functions.

In the above path planning test, the time required by the four methods to plan the path is as following Fig. 12.

Fig. 12
figure 12

Path planning time

Analyzing Fig. 12, it can be seen that in path planning testing, under the same testing environment conditions, the proposed method takes much less time to plan the path than the methods in reference [4], reference [5], and reference [6], and overall remains within 55 s. This is because the proposed method establishes an environmental map before path planning, which can directly obtain the positions of obstacles and search targets in the environment. Based on this, the shortest path is planned, thus shortening the path planning time and improving the efficiency of path planning. In fields such as emergency rescue and industrial automation, rapid path planning can help robots quickly reach target points, execute corresponding tasks, and improve application effectiveness.

5 Conclusion

At present, robot target search path control methods have problems such as poor obstacle avoidance ability, too long path and low planning efficiency. A shortest path control method for robot target search under a large range of complex tasks is proposed. The environment map of robot target search is established by the proposed method, and the objective function of path planning is established on this basis, so as to obtain the shortest distance and effective obstacle avoidance path. The controller is designed to control the robot to move along the optimal path. It is proved that the proposed method can effectively realize the obstacle avoidance of the robot, and the planned path length is short and the path planning efficiency is high, which provides a guarantee for the development of robot technology.