Intelligent agent path-finding driving method based on shepherd dog self-propelling particle model

By combining the Shepherd's self-propelled particle model to pursue target points and path tangent strategies, the driving direction of the agent is the sum of the vectors of the local tangent direction and the target point direction, solving the problem of long driving path time and high deviation of the robot, achieving a more efficient driving effect.

CN120338219APending Publication Date: 2025-07-18CHONGQING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510327555.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-19
Publication Date
2025-07-18

AI Technical Summary

Technical Problem

In the prior art, robots have long time to find and drive paths and have high deviations, so they cannot effectively deal with the application limitations of complex terrain.

Method used

The agent's path-seeking and driving method based on the Shepherd's self-propelled particle model. By combining the goal point pursuit strategy and the path tangent strategy, the driving direction of the agent is the sum of the vectors of the local tangent direction and the target point direction, and the single or double-agent model is used for the driving operation.

Benefits of technology

Based on the traditional shepherd self-propelled particle model, the driving path time and deviation are reduced, especially under the dual-agent model, the time for completing tasks is significantly shortened, and the fit of the trajectory is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120338219A_ABST
    Figure CN120338219A_ABST
Patent Text Reader

Abstract

The invention discloses an agent path-finding driving method based on a shepherd dog self-propelling particle model, and the method specifically comprises the following steps: A1, converting a driving path of an agent into a plurality of continuous coordinate points, and forming a path coordinate point sequence; the number of the intelligent agent is single; a2, coordinate points are selected from the route coordinate point sequence according to a preset sequence to serve as driving target points of the to-be-driven object, and 1 is added to the time step number; a3, the intelligent agent judges whether driving operation or gathering operation should be carried out according to the state of the to-be-driven object, and the positions of the to-be-driven object and the intelligent agent are updated; a4, whether the distance between the mass center of the object to be repelled and the repelling target point is smaller than a preset threshold value or not is judged, if yes, A5 is executed, and if not, A3 is repeated; and A5, selecting a next coordinate point as a driving target point, and stopping until the coordinate point is used up.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of bionic intelligent technologies, and particularly to an intelligent agent path-finding and driving method based on a shepherd dog self-propelled particle model. Background Art

[0002] Swarm intelligence is a phenomenon in which collective wisdom is demonstrated through the local interaction and self-organization behavior of a large number of simple individuals. Swarm intelligence computing attempts to solve problems that are difficult to solve by traditional centralized computing by studying the distributed mechanisms behind the behaviors of biological groups. The inspiration for swarm intelligence comes from the behaviors of biological groups in nature such as ant colonies, bird flocks, and sheep flocks. Among them, the behavior of a shepherd dog herding sheep is a classic example of swarm intelligence and can be used for robots to guide and evacuate crowds, intelligent sheep herding, fire evacuation, earthquake relief, etc. for driving objects (such as crowds).

[0003] The driving of intelligent agents (including robots, drones, etc.) generally uses one or more intelligent agents (shepherd dogs) to gather a group of objects to be driven (sheep) and guide them to a pre-specified location. Specifically, each object to be driven will react to the approach of the robot, flee from the predator, and at the same time flee to the center, resulting in aggregation. Robots are generally smarter than the objects to be driven, aiming to maintain the aggregation of the objects to be driven and drive the objects to be driven to the destination.

[0004] Currently, the research on robot driving at home and abroad mainly has three directions: the reproduction of shepherd dog behavior; the robot control and drone control strategies designed inspired by shepherd dog behavior; and reinforcement learning under multiple intelligent agents. The latter two research directions are mostly based on the principle of reproducing shepherd dog behavior.

[0005] In the research on reproducing shepherd dog behavior, the research directions of most scholars are to optimize the behavior rules of shepherd dogs or to expand the application scenarios, and generally a single dog model is adopted.

[0006] Single dog model: For a single shepherd dog agent, this paper proposes a strategy of pursuing a target point. This strategy evolved from the traditional strategy of a shepherd dog driving sheep to a designated area. By taking each coordinate point on the path as a target driving point, the target point is switched when driving to a target point until all target points are completed. The time step for this strategy to complete the task is relatively long, and the distance traveled by the shepherd dog is relatively large, but one shepherd dog can complete it, and the deviation of the centroid trajectory of the sheep flock from the original path is relatively small, and the deviation is basically less than 5 in a straight driving task.

[0007] Although the above research has optimized the behavior rules of shepherd dogs, making the robot drive the objects to be driven better or more closely to reality, it has not considered the complexity of the terrain in the real scene and the accessibility of the selected path during the driving process, and has great limitations in real-life applications. Summary of the Invention

[0008] In view of the problems of high path finding and driving path time and high deviation in the prior art, the present invention provides an intelligent agent path finding and driving method based on the self-propelled particle model of a shepherd dog. By combining the strategy of pursuing the target point and the path tangent strategy, the driving direction of the robot is changed to the sum of the local tangent direction and the target point direction, thereby reducing the path finding and driving path time and deviation.

[0009] To achieve the above object, the present invention provides the following technical solutions:

[0010] The intelligent agent path finding and driving method based on the self-propelled particle model of a shepherd dog specifically includes the following steps:

[0011] A1: Convert the driving path of the intelligent agent into a plurality of consecutive coordinate points to form a route coordinate point sequence; the intelligent agent is a single one.

[0012] A2: Select a coordinate point from the route coordinate point sequence as the driving target point of the object to be driven in a preset order, and increment the time step by 1.

[0013] A3: The intelligent agent determines whether to perform a driving operation or an aggregation operation according to the state of the object to be driven, and updates the positions of the object to be driven and the intelligent agent.

[0014] A4: Determine whether the distance between the centroid of the object to be driven and the driving target point is less than a preset threshold. If so, enter A5; otherwise, repeat A3.

[0015] A5: Select the next coordinate point as the driving target point until all the coordinate points are used up and then stop.

[0016] Preferably, in S1, the coordinates of the driving path are extracted by detecting the maximum contour.

[0017] Preferably, in S3, when there is an object to be driven outside the circle formed by the global center point with a radius of f(N), an aggregation operation is performed; when all the objects to be driven are within the circle formed by the global center point with a radius of f(N), a driving operation is performed.

[0018] Preferably, when there are two intelligent agents, it includes the following steps:

[0019] B1: Convert the driving path of the intelligent agents into a plurality of consecutive coordinate points to form a route coordinate point sequence.

[0020] B2: Select the first coordinate point from the route coordinate point sequence as the first target point of the object to be driven, then drive the object to be driven to the first target point, and increment the time step by 1.

[0021] B3: The first intelligent agent calculates the traveling direction based on the current first target point and the second target point, and updates the positions of the first intelligent agent and the object to be driven away.

[0022] B4: The second intelligent agent selects an aggregation operation or a driving operation according to the state of the object to be driven away, and updates the positions of the second intelligent agent and the object to be driven away.

[0023] B5: Determine whether the distance between the centroid of the object to be driven away and the second target point is less than a preset threshold. If so, enter B6; otherwise, repeat B3 - B4.

[0024] B6: Select the next coordinate point as the driving target point and stop until all coordinate points are used up.

[0025] Preferably, B3 includes:

[0026] Let the coordinates of the first target point be target_point, and the coordinates of the second target point be next_point. Then the traveling direction at this moment is the tangent direction:

[0027]

[0028] In formula (1), tan_slope represents the traveling tangent direction; target_point[0] represents the abscissa of the first target point, target_point[1] represents the ordinate of the first target point; next_point[0] represents the abscissa of the second target point, and next_point[1] represents the ordinate of the second target point.

[0029] Convert the traveling direction to the traveling direction tangent vector tan_dir = [1, tan_slope]. Then the target position of the first intelligent agent at the next moment is:

[0030] P d =-ε d ·tan_dir + GCM (2)

[0031] In formula (2), P d represents the target position of the first intelligent agent at the next moment; ε d represents the driving parameter, GCM represents the central position of the object to be driven away; tan_dir represents the traveling direction tangent vector.

[0032] Preferably, the target position of the first intelligent agent at the next moment is updated to:

[0033] Add a judgment condition to expand the driving direction to four directions:

[0034]

[0035] Combining formula (3) and formula (2), it can be known that the actual position of the first agent at the next moment is:

[0036]

[0037] In formula (4), S , 1 represents the actual updated position of the first agent at the next moment; S1 represents the original position of the first agent; δ s represents the movement speed of the first agent.

[0038] Preferably, the B4 includes:

[0039] B4-1: During the movement, if each object to be driven is within the range of the circle formed by the global center point with a radius of f(N), the second agent needs to make the object to be driven perform a driving operation, then the target position P of the second agent at the next moment c is:

[0040]

[0041] In formula (5), P c represents the target position of the second agent at the next moment; ε d represents the driving parameter, GCM represents the central position coordinates of the object to be driven; next_point represents the coordinates of the second target point;

[0042] B4-2: During the driving process, when there is an object to be driven outside the range of the circle formed by the global center point with a radius of f(N), the second agent needs to perform an aggregation behavior;

[0043] First, it is necessary to find the object to be driven that is farthest from the central position of the object to be driven:

[0044] i farthest = arg max|A i -GCM| (6)

[0045] In formula (6), i farthest represents the position of the farthest object to be driven; GCM represents the central position of the object to be driven; A i represents the coordinates of the i-th object to be driven;

[0046] Then, the farthest object to be driven is regarded as the aggregation object for this aggregation:

[0047]

[0048] In formula (7), P c represents the aggregation position; Afarthest Denote the coordinates of the farthest object to be driven away; ε c Denote the aggregation parameter;

[0049] Therefore, the position S , 2 of the second agent at the next time step is:

[0050]

[0051] In formula (8), S , 2 represents the actual updated position of the second agent at the next moment; S2 represents the original position of the second agent; δ s Denote the movement speed of the second agent.

[0052] Preferably, the B3 further includes C3: The first agent calculates the driving direction according to the first target point, the second target point and the centroid of the object to be driven away:

[0053] Let the coordinates of the first target point be target_point, and the coordinates of the second target point be next_point, then the tangent direction of travel at this moment is:

[0054]

[0055] In formula (9), tan_slope represents the tangent direction of travel; target_point[0] represents the abscissa of the first target point, target_point[1] represents the ordinate of the first target point; next_point[0] represents the abscissa of the second target point, next_point[1] represents the ordinate of the second target point;

[0056] Then convert the travel direction into the form of a travel direction tangent vector tan_dir = [1, tan_slope];

[0057] Finally, calculate the vector between the first target point and the centroid of the object to be driven away:

[0058] d_dir = GCM - target_point (10)

[0059] In formula (10), d_dir represents the vector between the first target point and the centroid of the object to be driven away; GCM represents the centroid coordinates of the object to be driven away; target_point represents the first target point coordinates;

[0060] Combine the vector between the first target point and the centroid of the object to be driven away and the travel direction tangent vector, which is the driving direction of the first agent:

[0061] direction = -α·tan_dir + β·d_dir (11)

[0062] In Formula (11), direction represents the driving direction of the first agent; tan_dir represents the tangent vector of the traveling direction; d_dir represents the vector between the first target point and the centroid of the substance to be driven; α and β represent hyperparameters.

[0063] Preferably, the target position of the first agent at the next moment is:

[0064] P d =-ε d ·direction + GCM(12)

[0065] In Formula (12), P d represents the target position of the first agent at the next moment; ε d represents the driving parameter; GCM represents the central position of the substance to be driven.

[0066] In summary, due to the adoption of the above technical solutions, compared with the prior art, the present invention has at least the following beneficial effects:

[0067] Based on the traditional shepherd dog self-propelled particle model, the fixed target point for driving is changed to continuously changing path coordinate points to obtain the strategy for pursuing the target point. The time step used to complete the driving task is relatively long, but the deviation is small;

[0068] In order to shorten the task time, a model of two agents jointly driving is formed, and its driving direction is the tangential direction of the path. When the aggregation standard is not met, the substance to be driven is driven closer to the path, and the target point for driving is the next coordinate point of the current coordinate point; otherwise, the substance to be driven is aggregated. This strategy greatly reduces the time to complete the task. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 It is a schematic diagram of driving by the traditional shepherd dog self-propelled particle model.

[0070] Figure 2 It is a schematic diagram of aggregation by the traditional shepherd dog self-propelled particle model.

[0071] Figure 3 It is a schematic diagram of the intelligent agent path finding and driving method based on the shepherd dog self-propelled particle model according to Exemplary Embodiment 1 of the present invention.

[0072] Figure 4 It is a schematic diagram of different paths according to Exemplary Embodiment 1 of the present invention.

[0073] Figure 5 It is a schematic diagram of comparison of driving along different paths according to Exemplary Embodiment 1 of the present invention.

[0074] Figure 6Schematic diagram of the agent path - finding and driving method based on the sheepdog self - propelled particle model according to Exemplary Embodiment 2 of the present invention.

[0075] Figure 7 Schematic diagram of the traveling direction of the first agent according to Exemplary Embodiment 2 of the present invention.

[0076] Figure 8 Schematic diagram of the comparison of the time steps of the driving task between the traditional sheepdog self - propelled particle model and Exemplary Embodiment 2 according to the present invention.

[0077] Figure 9 Schematic diagram of the comparison of the driving deviation between the traditional sheepdog self - propelled particle model and Exemplary Embodiment 2 according to the present invention.

[0078] Figure 10 Schematic diagram of the driving direction of the first agent according to Exemplary Embodiment 3 of the present invention.

[0079] Figure 11 Schematic diagram of different trajectory deviations according to Exemplary Embodiments 2 and 3 of the present invention. Detailed implementation manner

[0080] The present invention will be further described in detail below in conjunction with embodiments and specific implementation manners. However, this should not be understood as limiting the scope of the above - mentioned subject matter of the present invention to the following embodiments. All technologies implemented based on the content of the present invention belong to the scope of the present invention.

[0081] In the description of the present invention, it should be understood that the orientation or positional relationships indicated by the terms "longitudinal", "transverse", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. are based on the orientation or positional relationships shown in the drawings. They are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation to the present invention.

[0082] In this embodiment, as Figure 1 shown, the traditional sheepdog self - propelled particle model needs to model the behavior of the sheepdog driving the flock. In 2014, a heuristic algorithm using a single sheepdog was proposed, defining the basic behavior rules of the sheepdog and the flock.

[0083] A. The behavior rules of the sheep are as follows:

[0084] Each sheep in the flock is affected not only by the force exerted by the sheepdog but also by the forces of other sheep in the flock. Specifically, the main behavior patterns of the sheep are as follows:

[0085] (1) Each sheep can sense the position of the center point of the flock and has a tendency to move towards this center point.

[0086] (2) When the distance between sheep is less than r, a repulsive force will be generated.

[0087] (3) When the sheepdog is within the visual range v of the sheep, the sheep will move away from the sheepdog.

[0088] In summary, the next moving direction of the sheep can be determined by the following formula:

[0089]

[0090] In formula (1), represents the moving direction of the flock; is the inertia term of the flock; is the vector for the sheep to approach the local center; is the vector of mutual repulsion between sheep; is the vector for the sheep to move away from the sheepdog; is the noise term of the sheep; h, c, ρ a 、ρ s 、e represent weights, h = 0.5, c = 1.05, ρ a = 2, ρ s = 1, e = 0.5, which can be obtained from the research results.

[0091] Then, is normalized, and the new position coordinates of the sheep can be expressed as:

[0092]

[0093] In formula (2), represents the updated position coordinates of the i-th sheep; represents the original position coordinates of the i-th sheep; δ can represent the traveling speed of the flock.

[0094] Assume that sheep i has k neighbors within the range r, and their original position coordinates are respectively Then the direction of the combined repulsive force of the flock on sheep i is:

[0095]

[0096] In formula (3), represents the direction of the combined repulsive force of the flock on the i-th sheep; represents the original position coordinates of the i-th sheep; represents the original position coordinates of the j-th sheep; k represents the number of neighbors of the i-th sheep.

[0097] When the sheepdog appears within the visual range v of sheep i, the direction of the driving force exerted on sheep i by the sheepdog is as follows:

[0098]

[0099] In formula (4), represents the direction of the driving force exerted on the i-th sheep by the sheepdog; represents the original position coordinates of the i-th sheep; S represents the current position of the sheepdog.

[0100] Similarly, the direction in which the sheep approaches the local center is:

[0101]

[0102] In formula (5), represents the direction in which the i-th sheep approaches the local center; represents the position coordinates of the local center.

[0103] In this embodiment, the inertia of the flock can be understood as the direction in which the flock will move when there is no driving force from the sheepdog, that is, the moving direction of the flock in the previous time step.

[0104] B. Behavior rules of the sheepdog

[0105] The sheepdog mainly has two motion modes. When the flock is relatively dispersed, it performs an aggregation operation on the flock; when the flock is relatively concentrated, it performs a driving operation on the flock.

[0106] B.1. Aggregation.

[0107] As Figure 2 shown, use f(N) to represent the tightness of the flock aggregation, that is, the aggregation radius of the flock. (r represents the interaction distance between sheep, and N represents the number of sheep). When there is a sheep outside the range of the circle formed by the global center point with a radius of f(N), the sheepdog needs to perform an aggregation operation on this sheep. Each time of aggregation, the sheep farthest from the center point is used as the aggregation object.

[0108] First, it is necessary to find the sheep furthest from the center of the flock GCM (Global Centre of Mass, center of the flock):

[0109] i furthest = arg max|A i - GCM| (6)

[0110] In formula (6), i furthest represents the position of the furthest sheep (the object to be driven); GCM represents the position of the center of the flock; Ai Denote the coordinates of the \(i\)-th sheep;

[0111] Judge the distance \(d\) from the farthest sheep to the center of the flock farthest Whether it is greater than \(f(N)\). If \(d\) farthest is greater than \(f(N)\), then regard this sheep as the aggregation object for this aggregation. The actual target position is \(P\) behind this sheep c in the direction position. This offset is to avoid the direct repulsion of the sheepdog to the sheep and play a buffering role:

[0112]

[0113] In formula (7), \(P\) c represents the aggregation position; \(A\) farthest represents the coordinates of the sheep with the farthest distance from the center; \(\varepsilon\) c represents the aggregation parameter, which is \(r\).

[0114] Therefore, the position \(S'\) of the sheepdog at the next time step is:

[0115]

[0116] In formula (8), \(S'\) represents the position of the sheepdog at the next time step; \(S\) represents the original position of the sheepdog; \(\delta\) s represents the movement speed of the sheepdog, which can be \(1.5\delta\).

[0117] B.2. Driving

[0118] When all the sheep in the flock are within the range of the circle formed by the global center point with a radius of \(f(N)\), the sheepdog performs a driving operation on the entire flock. The driving operation is mainly to drive towards the target point. Therefore, the sheepdog needs to find the position after the offset directly behind the connection line between the target position and the center of the flock.

[0119] The target position of the sheepdog at the next moment is:

[0120]

[0121] In formula (9), \(P\) d represents the driving position; \(\varepsilon\) d represents the driving parameter, \(D\) represents the coordinates of the driving position.

[0122] Then the actual position \(S'\) of the sheepdog at the next moment is (the actual position means that the sheepdog has not reached the target position \(P_d\) and needs to move towards the target position):

[0123]

[0124] In formula (10), S′ represents the actual position of the sheepdog at the next moment; S represents the original position of the sheepdog; δ s represents the moving speed of the sheepdog.

[0125] Embodiment 1

[0126] The time step for the traditional sheepdog self-propelled particle model to complete the task is relatively long, and the distance traveled by the sheepdog is relatively large. Therefore, as Figure 3 shown, the present invention provides an intelligent agent path-finding and driving method based on the sheepdog self-propelled particle model, which can also be called a pursuit target point strategy, and is mainly used for single-agent driving, specifically including the following steps:

[0127] A1: Convert the driving path of the intelligent agent into a plurality of consecutive coordinate points, and arrange and record the coordinates of the coordinate points in sequence to form a route coordinate point sequence.

[0128] In this embodiment, the driving path of the intelligent agent is actually composed of a plurality of consecutive coordinate points, that is, each coordinate point on the driving path has a corresponding coordinate. Therefore, the coordinates of the coordinate points can be recorded to form a route coordinate point sequence M = {m1, m2,..., m P}, m P represents the p-th coordinate point; this belongs to the existing technical means.

[0129] For example, in this paper, the method of detecting the maximum contour is used to extract the coordinates of the driving path. Specifically, first, the original image is read and converted into a grayscale image, then the Canny algorithm is used for edge detection, the contours in the image are extracted and the maximum contour is selected as the target path, then the y coordinates of the contour points are reversed and offset (so that the image can be correctly displayed on the canvas), and finally the coordinates are saved to a CSV file. The advantage of using the method of the maximum contour to extract the path coordinate points is to simplify the complexity of the path and is easy to expand.

[0130] A2: Select coordinate points from the route coordinate point sequence as the driving target points of the object to be driven according to the preset order, and increment the time step by 1.

[0131] A3: The intelligent agent determines whether to perform a driving operation or an aggregation operation according to the state of the object to be driven, and updates the positions of the object to be driven and the intelligent agent.

[0132] When there is an object to be driven outside the range of the circle formed by the global center point with a radius of f(N), perform an aggregation operation; when all the objects to be driven are within the range of the circle formed by the global center point with a radius of f(N), perform a driving operation.

[0133] A4: Determine whether the distance between the centroid of the object to be driven and the driving target point is less than a preset threshold. If so, proceed to A5; otherwise, repeat A3.

[0134] A5: Select the next coordinate point as the driving target point (i.e., there are remaining coordinate points), and execute A2; stop until all coordinate points are used up.

[0135] To verify the above method, the present invention conducted experimental verification. All experiments in this article were carried out on an Intel PC with a benchmark speed of 2.7 GHz, which has 16 GB of main memory and a 64-bit Windows system. The experimental environment was implemented using Python 3.11, and the code editor used VSCode.

[0136] It is mainly to verify whether the agent in this embodiment can drive the object to be driven along the specified path. Therefore, it is assumed that the object to be driven has been gathered and is located at the starting coordinate of the path. The way the agent drives the object to be driven is to make the centroid of the object to be driven slide along the specified path.

[0137] To ensure the diversity of the experiment, as Figure 4 shown, 4 common paths were selected for the experiment, namely the straight-line path, the circular path, the zigzag path, and the curved path.

[0138] The experimental results are as Figure 5 shown. The experiment proves that this method can well complete the task of driving the flock under different path conditions. In the set experimental environment, for the straight-line path, the sheepdog can complete the task within 1200 time steps; for the circular path, the zigzag path, and the curved path, the sheepdog can complete the task within 2500 time steps. For the straight-line path, the coordinates of the centroid of the flock were recorded in this article, and they were fitted to a straight line for comparison with the original trajectory. It was found that the maximum distance between the two straight lines does not exceed 5. At the same time, it can also be seen from the images of other trajectories that the deviation of this strategy is very small and almost fits the original trajectory.

[0139] Embodiment 2

[0140] The method described in Embodiment 1 can indeed complete the driving task. However, due to the continuous change in the aggregation degree of the object to be driven, the driving position of the agent also changes continuously, resulting in a large number of walking steps of the agent, and thus a long time is required to complete the task. Therefore, the driving strategy of the agent was improved, and two agents were used to drive the object to be driven, thereby reducing the driving time.

[0141] In this embodiment, as Figure 6 shown, an agent path-finding and driving method based on the shepherd dog self-propelled particle model is provided, which can also be called the double-dog driving strategy, mainly used for double-agent driving, and specifically includes the following steps:

[0142] B1: Convert the driving path of the agent into multiple consecutive coordinate points, and arrange and record the coordinates of the coordinate points in sequence to form a sequence of route coordinate points.

[0143] In this embodiment, the driving path of the agent is actually composed of multiple consecutive coordinate points, that is, each coordinate point on the driving path has a corresponding coordinate. Therefore, the coordinates of the coordinate points can be recorded to form a sequence of route coordinate points M = {m1, m2,..., m P}, m P represents the p-th coordinate point; this belongs to the existing technical means.

[0144] For example, in this article, the method of detecting the largest contour is used to extract the coordinates of the driving path. Specifically, first read the original image and convert it into a grayscale image, then use the Canny algorithm for edge detection, extract the contours in the image and select the largest contour as the target path, then reverse and offset the y coordinates of the contour points (so that the image can be correctly displayed on the canvas), and finally save the coordinates to a CSV file. The advantage of using the method of the largest contour to extract the path coordinate points is to simplify the complexity of the path and is easy to expand.

[0145] B2: Select the first coordinate point from the sequence of route coordinate points as the first target point of the object to be driven according to the preset order. Then, the agent uses the traditional shepherd dog self-propelled particle model to drive the object to be driven to the first target point and increment the time step by 1.

[0146] B3: The first agent calculates the traveling direction based on the current first target point and the second target point, and updates the positions of the first agent and the object to be driven.

[0147] In this embodiment, let the coordinates of the first target point be target_point and the coordinates of the second target point be next_point. Then the traveling direction at this moment is the tangent direction, as Figure 7 shown:

[0148]

[0149] In formula (11), tan_slope represents the traveling tangent direction; target_point[0] represents the abscissa of the first target point, target_point[1] represents the ordinate of the first target point; next_point[0] represents the abscissa of the second target point, next_point[1] represents the ordinate of the second target point;

[0150] Convert the traveling direction into the form of a vector tan_dir = [1, tan_slope], then the target position of the first agent at the next moment is:

[0151] P d = -ε d ·tan_dir + GCM(12)

[0152] In formula (12), P d represents the target position of the first agent at the next moment; ε d represents the driving parameter, GCM represents the central position of the object to be driven; tan_dir represents the tangent vector of the traveling direction.

[0153] At this time, the driving direction of the sheepdog has only two directions, namely from the lower left to the upper right and from the upper left to the upper right. Because for the traditional coordinate system, both the horizontal and vertical coordinates increase in the positive direction. So the traditional tangent direction has only these two trends.

[0154] Therefore, a judgment condition needs to be added to expand the driving direction to four directions:

[0155]

[0156] For the case where the abscissas are the same, for example, moving on a vertical line, at this time, next_point[0] - target_point[0] = 0. Or for some non-differentiable points, set the tangent slope at this time to ±10000, and the specific sign depends on the driving direction.

[0157] Then, by combining formula (13) and formula (12), it can be known that the actual position of the first agent at the next moment is:

[0158]

[0159] In formula (14), S , 1 represents the actual updated position of the first agent at the next moment; S1 represents the original position of the first agent; δ s represents the movement speed of the first agent.

[0160] However, at this time, a problem will occur. After the improvement, the driving direction of the first agent has nothing to do with the target point and the center of the object to be driven. If the first agent is made to perform both the driving and gathering tasks at the same time, the object to be driven will gradually deviate from the trajectory. Because when gathering the object to be driven, the position of the first agent is changing, but the driving direction remains unchanged, which will lead to driving in the wrong direction. Therefore, a second agent needs to be introduced.

[0161] B4: The second agent selects an aggregation operation or a driving operation according to the state of the object to be driven, and updates the positions of the second agent and the object to be driven.

[0162] The first agent needs to stay behind the object to be driven throughout the process to ensure the moving direction of the object to be driven. In this paper, a second agent is introduced to perform the aggregation work of the object to be driven and ensure that the object to be driven does not deviate from the established trajectory. The aggregation strategy of the object to be driven is the same as the traditional strategy, but the second agent has an additional responsibility to ensure that the object to be driven does not deviate from the trajectory.

[0163] Therefore, a behavior rule needs to be added to the second agent:

[0164] During the movement, if each object to be driven is within the range of the circle formed by the global center point with a radius of f(N), the second agent needs to let the object to be driven perform a driving operation, then the target position P of the second agent at the next moment c is:

[0165]

[0166] In formula (15), P c represents the target position of the second agent at the next moment; ε d represents the driving parameter, GCM represents the central position coordinate of the object to be driven; next_point represents the coordinate of the second target point.

[0167] The reason for choosing next-point instead of target_point here is that the extracted coordinate points are very close to each other, and it may be that when reaching one target point, it immediately reaches the next target point. Selecting target_point may not be able to keep up with the movement changes. At the same time, selecting next-point will also give the second agent a pushing force to the object to be driven.

[0168] Essentially, it is similar to the driving strategy in the traditional strategy, except that the target position becomes the next target point of the current target point.

[0169] If during the driving process, there is an object to be driven outside the range of the circle formed by the global center point with a radius of f(N), the second agent needs to perform an aggregation behavior. First, it is necessary to find the object to be driven that is farthest from the central position of the object to be driven:

[0170] i farthest = arg max|A i - GCM| (16)

[0171] In formula (16), i farthest represents the position of the farthest object to be driven; GCM represents the central position of the object to be driven; Ai Denote the coordinates of the \(i\)-th object to be driven away;

[0172] Then, regard the object to be driven away that is the farthest as the aggregation object for this aggregation. The actual target position is \(P\) behind this sheep c Direction position:

[0173]

[0174] In formula (17), \(P\) c Denotes the aggregation position; \(A\) farthest Denotes the coordinates of the object to be driven away that is the farthest; \(\epsilon\) c Denotes the aggregation parameter, which is \(r\).

[0175] Therefore, the position \(S\) of the sheepdog at the next time step , 2 is:

[0176]

[0177] In formula (18), \(S\) , 2 represents the actual updated position of the second agent at the next moment; \(S_2\) represents the original position of the second agent; \(\delta\) s Denotes the movement speed of the second agent, which can be \(1.5\delta\).

[0178] B5: Determine whether the distance between the centroid of the objects to be driven away and the second target point is less than a preset threshold. If so, enter B6; if not, repeat B3 - B4.

[0179] B6: Select the next coordinate point as the driving target point (i.e., there are remaining coordinate points), and execute B2; stop until all coordinate points are used up.

[0180] To verify the method described in this embodiment, mainly compare the time steps and the deviation degree of the trajectory from the original path of the first agent and the second agent when driving the objects to be driven away along a straight - line path to compare the advantages and disadvantages of different strategies.

[0181] As Figure 8 (a) shows the time steps obtained when using the traditional strategy to perform the driving task when the sensing distance of the objects to be driven away is 120; Figure 8 (b) shows the time steps obtained when using the method described in this embodiment to perform the driving task when the sensing distance of the objects to be driven away is 100.

[0182] Then, through Figure 8It can be seen that when using the method described in this embodiment for driving, the time efficiency can be greatly improved. As the number of objects to be driven increases, the difference in time steps will become more and more obvious. When the number of objects to be driven is 10, the double-agent model is 2 times faster than the single-agent model; but when the number of objects to be driven is 25, the double-agent model is 6 times faster than the single-agent model.

[0183] However, when using the method described in this embodiment for driving, the task completion is not very stable, and this situation is particularly obvious when the sensing distance is large and the scale of the objects to be driven is small. When the scale of the number of objects to be driven is too small, for example, when the number of objects to be driven is 5, the method described in this embodiment cannot complete the driving task.

[0184] Next, continue to compare the deviation degree between the trajectory of the object to be driven and the original path. Through experiments and Figure 9 , it can be obtained that the average deviation degree under the traditional strategy is 1.08, while the average deviation degree under the method described in this embodiment is 68.88. The average deviation degree of the method described in this embodiment is nearly 70 times higher than that of the traditional strategy.

[0185] Therefore, it can be concluded that the method described in this embodiment is applicable to large-scale driving tasks, and the traditional strategy is applicable to small-scale driving tasks.

[0186] Embodiment 3

[0187] When applying the method described in Embodiment 2, the deviation degree of the established trajectory is still relatively large. The reason is that the first agent completely ignores the deviation of the object to be driven, and the second agent adjusts the position of the object to be driven in a timely manner. Therefore, in this embodiment, a new intelligent agent path-finding driving method based on the shepherd dog self-propelled particle model is proposed, which is mainly used for double-agent driving, and specifically includes the following steps:

[0188] C1: Convert the driving path into multiple consecutive coordinate points, and arrange and record the coordinates of the coordinate points in sequence to form a route coordinate point sequence.

[0189] In this embodiment, the driving path of the intelligent agent is actually composed of multiple consecutive coordinate points, that is, each coordinate point on the driving path has a corresponding coordinate. Therefore, the coordinates of the coordinate points can be recorded to form a route coordinate point sequence M = {m1, m2,..., m P}, m P represents the pth coordinate point; this belongs to the existing technical means.

[0190] For example, in this article, the coordinates of the driving path are extracted by detecting the maximum contour. Specifically, first, the original image is read and converted into a grayscale image. Then, the Canny algorithm is used for edge detection to extract the contours in the image and select the maximum contour as the target path. Next, the y coordinates of the contour points are inverted and offset (so that the image can be correctly displayed on the canvas). Finally, the coordinates are saved to a CSV file. The advantage of using the maximum contour method to extract path coordinate points is to simplify the complexity of the path and make it easy to expand.

[0191] C2: Select the first coordinate point from the sequence of route coordinate points as the first target point of the object to be driven. Then, the intelligent agent uses the traditional shepherd dog self-propelled particle model to drive the object to be driven to the first target point and increments the time step by 1.

[0192] C3: The first intelligent agent calculates the driving direction based on the first target point, the second target point, and the centroid of the object to be driven, and updates the positions of the first intelligent agent and the object to be driven.

[0193] In Embodiment 2, the work of the first intelligent agent is only to drive the object to be driven in the direction of the tangent line, thus ignoring the deviation of the object to be driven.

[0194] Therefore, in this embodiment, on the basis of using the path tangent line as the traveling direction vector, a vector between the target point and the centroid of the object to be driven is added to the first intelligent agent, and the sum vector of the two vectors is used as the driving direction vector. In this way, while the first intelligent agent controls the direction, it also automatically advances the object to be driven along the path, reducing the workload of the second intelligent agent.

[0195] In this embodiment, let the coordinates of the first target point be target_point, and the coordinates of the second target point be next_point. Then the tangent direction of travel at this moment is:

[0196]

[0197] In formula (19), tan_slope represents the traveling tangent direction; target_point[0] represents the abscissa of the first target point, and target_point[1] represents the ordinate of the first target point; next_point[0] represents the abscissa of the second target point, and next_point[1] represents the ordinate of the second target point.

[0198] Then the traveling direction is converted into the form of a traveling direction tangent vector tan_dir = [1, tan_slope];

[0199] Finally, calculate the vector between the first target point and the centroid of the object to be driven. Note the direction here, because the first agent can only exert a driving force on the object to be driven when it is behind the object to be driven. Therefore, it is necessary to subtract the coordinates of the first target point from the centroid point of the object to be driven:

[0200] d_dir = GCM - target_point (20)

[0201] In formula (20), d_dir represents the vector between the first target point and the centroid of the object to be driven; GCM represents the centroid coordinates of the object to be driven; target_point represents the coordinates of the first target point;

[0202] Combine the vector between the first target point and the centroid of the object to be driven with the tangent vector of the traveling direction, which is the driving direction of the first agent:

[0203] direction = -α·tan_dir + β·d_dir (21)

[0204] In formula (21), direction represents the driving direction of the first agent; tan_dir represents the tangent vector of the traveling direction; d_dir represents the vector between the first target point and the centroid of the object to be driven; α and β represent hyperparameters, for example, α is 0.3 and β is 0.7.

[0205] Then the target position of the first agent at the next moment is:

[0206] P d = -ε d ·direction + GCM (22)

[0207] In formula (22), P d represents the target position of the first agent at the next moment; ε d represents the driving parameter, GCM represents the center position of the object to be driven.

[0208] Because the vector between the centroid point and the first target coordinate point is introduced, direction expansion is no longer required.

[0209] C4: The second agent selects an aggregation operation or a driving operation according to the state of the object to be driven, and updates the positions of the second agent and the object to be driven.

[0210] The first agent needs to be behind the object to be driven throughout the process to ensure the traveling direction of the object to be driven. In this paper, a second agent is introduced to perform the aggregation work of the object to be driven and ensure that the object to be driven does not deviate from the established trajectory. The aggregation strategy of the object to be driven is the same as the traditional strategy, but the second agent has an additional responsibility to ensure that the object to be driven does not deviate from the trajectory.

[0211] Therefore, a behavior rule needs to be added to the second intelligent agent:

[0212] During the movement, if each object to be driven is within the range of the circle formed by the global center point with a radius of f(N), the second intelligent agent needs to make the object to be driven perform a driving operation, and the target position P of the second intelligent agent at the next moment c is:

[0213]

[0214] In formula (23), P c represents the target position of the second intelligent agent at the next moment; ε d represents the driving parameter, GCM represents the central position coordinates of the object to be driven; next_point represents the coordinates of the second target point.

[0215] The reason for choosing next-point instead of target_point here is that the extracted coordinate points are very close to each other, and it is possible to reach the next target point immediately after reaching a target point. Selecting target_point may not be able to keep up with the movement changes. At the same time, selecting next-point will also give the second intelligent agent a pushing force to the object to be driven.

[0216] Essentially, it is similar to the driving strategy in the traditional strategy, except that the target position becomes the next target point of the current target point.

[0217] If, during the driving process, there is an object to be driven outside the range of the circle formed by the global center point with a radius of f(N), the second intelligent agent needs to perform an aggregation behavior. First, it is necessary to find the object to be driven that is farthest from the central position of the object to be driven:

[0218] i farthest = arg max|A i - GCM| (24)

[0219] In formula (24), i farthest represents the position of the farthest object to be driven; GCM represents the central position of the object to be driven; A i represents the coordinates of the i-th object to be driven;

[0220] Then, the farthest object to be driven is regarded as the aggregation object for this aggregation. The actual target position is the P c direction position behind the sheep:

[0221]

[0222] In formula (25), P cIndicates the aggregation position; A farthest Indicates the coordinates of the farthest object to be driven away; ε c Indicates the aggregation parameter, which is r.

[0223] Therefore, the position S of the shepherd dog at the next time step , 2 is:

[0224]

[0225] In formula (26), S , 2 represents the actual updated position of the second agent at the next moment; S2 represents the original position of the second agent; δ s Represents the movement speed of the second agent, which can be 1.5δ.

[0226] C5: Determine whether the distance between the centroid of the object to be driven away and the second target point is less than a preset threshold. If so, enter C6; otherwise, repeat C3 - C4.

[0227] C6: Select the next coordinate point as the driving target point (i.e., there are remaining coordinate points), and execute C2; stop until all coordinate points are used up.

[0228] To verify the method described in this embodiment, compare the differences in the time step and the deviation of the trajectory from the original trajectory between Embodiment 3 and Embodiment 2. Test the time steps used to drive different numbers of objects to be driven away at different perception distances, and obtain the following data.

[0229] Table 1. Data using the method described in Embodiment 3:

[0230]

[0231] Table 2. Data using the method described in Embodiment 2:

[0232]

[0233] From the data in Table 1 and Table 2, it can be seen that under the same perception range of the object to be driven away, when using the method described in Embodiment 3 for driving, the time step to complete the task is significantly less than that using the method described in Embodiment 2. And as the number of objects to be driven away increases, the gap in the time step becomes more and more obvious. When the number of objects to be driven away is 10, the method described in Embodiment 3 is twice as fast as the method described in Embodiment 2; but when the number of objects to be driven away is 30, the method described in Embodiment 3 is three times as fast as the method described in Embodiment 2.

[0234] From Figure 11 It can be seen that under the same perception range, for different trajectories, the deviation degree of the method described in Embodiment 3 is much smaller than that of the method described in Embodiment 2, and the trajectory is more in line with the original path

[0235] For example, a straight line path is used for comparison. When the method described in Embodiment 3 is adopted, the deviation degree is only 15; while for the method described in Embodiment 2, the deviation degree is as high as 50.

[0236] Those of ordinary skill in the art can understand that the above-described embodiments are specific examples for implementing the present invention, and in actual applications, various changes can be made to them in form and details without departing from the spirit and scope of the present invention.

Claims

1. An intelligent agent path - finding and driving method based on the self - propelled particle model of a sheepdog, characterized in that, Specifically, it includes the following steps: A1: Convert the driving path of the agent into multiple consecutive coordinate points to form a sequence of route coordinate points; the agent is a single one; A2: Select coordinate points from the sequence of route coordinate points as the driving target points of the object to be driven in a preset order, and increment the time step by 1; A3: The agent determines whether to perform a driving operation or an aggregation operation based on the state of the object to be driven, and updates the positions of the object to be driven and the agent; A4: Determine whether the distance between the centroid of the object to be driven and the driving target point is less than a preset threshold. If so, enter A5; otherwise, repeat A3; A5: Select the next coordinate point as the driving target point and stop until all coordinate points are used up.

2. The intelligent agent path finding and driving method based on the shepherd dog self-propelled particle model according to claim 1, characterized in that In S1, the coordinates of the driving path are extracted by detecting the largest contour.

3. The intelligent agent path-finding and driving method based on the shepherd dog self-propelled particle model according to claim 1, characterized in that In S3, when there are objects to be driven outside the circle formed by the global center point with a radius of f(N), perform an aggregation operation; when all objects to be driven are within the circle formed by the global center point with a radius of f(N), perform a driving operation.

4. The intelligent agent path finding and driving method based on the shepherd dog self-propelled particle model according to claim 1, wherein When there are two agents, it includes the following steps: B1: Convert the driving path of the agents into multiple consecutive coordinate points to form a sequence of route coordinate points; B2: Select the first coordinate point from the sequence of route coordinate points as the first target point of the object to be driven, then drive the object to be driven to the first target point, and increment the time step by 1; B3: The first agent calculates the traveling direction based on the current first target point and the second target point, and updates the positions of the first agent and the object to be driven; B4: The second agent selects an aggregation operation or a driving operation based on the state of the object to be driven, and updates the positions of the second agent and the object to be driven; B5: Determine whether the distance between the centroid of the object to be driven and the second target point is less than a preset threshold. If so, enter B6; otherwise, repeat B3 - B4; B6: Select the next coordinate point as the driving target point and stop until all coordinate points are used up.

5. The intelligent agent path finding and driving method based on the shepherd dog self-propelled particle model according to claim 4, characterized in that, The B3 includes: Let the coordinates of the first target point be target_point and the coordinates of the second target point be next_point, then the traveling direction at this moment is the tangent direction: In formula (1), tan_slope represents the traveling tangent direction; target_point[0] represents the abscissa of the first target point, target_point[1] represents the ordinate of the first target point; next_point[0] represents the abscissa of the second target point, next_point[1] represents the ordinate of the second target point; Convert the traveling direction into the traveling direction tangent vector tan_dir = [1, tan_slope], then the target position of the first agent at the next moment is: P d = -ε d ·tan_dir + GCM(2) In formula (2), P d represents the target position of the first agent at the next moment; ε d represents the driving parameter, GCM represents the center position of the object to be driven; tan_dir represents the tangent vector of the traveling direction.

6. The intelligent agent path-finding and driving method based on the self-propelled particle model of the shepherd dog as claimed in claim 5, wherein The target position of the first agent at the next moment is updated to: Add a judgment condition to expand the driving direction to four directions: Then, combining formula (3) and formula (2), it can be known that the actual position of the first agent at the next moment is: In formula (4), S , 1 represents the actual updated position of the first agent at the next moment; S1 represents the original position of the first agent; δ s represents the movement speed of the first agent.

7. The intelligent agent path-finding and driving method based on the sheepdog self-propelled particle model according to claim 4, characterized in that The B4 includes: B4-1: During the movement, if each object to be driven is within the range of the circle formed with the global center point as the radius and f(N) as the radius, and the second intelligent agent needs to make the object to be driven perform a driving operation, then the target position P of the second intelligent agent at the next moment c is: In formula (5), P c represents the target position of the second agent at the next moment; ε d represents the driving parameter, and ε d = r√N; GCM represents the central position coordinates of the object to be driven; next_point represents the coordinates of the second target point; B4-2: When there is a target object to be driven outside the range of the circle formed with the global center point as the center and f(N) as the radius during the driving process, the second intelligent agent needs to perform an aggregation behavior; First, it is necessary to find the target object to be driven that is farthest from the center position of the target object to be driven: i farthest = argmax|A i - GCM| (6) In formula (6), i farthest represents the position of the farthest object to be driven away; GCM represents the central position of the object to be driven away; A i represents the coordinates of the i-th object to be driven away; Then, regard the farthest target object to be driven as the aggregation object for this aggregation: In formula (7), P c represents the aggregation position; A farthest represents the coordinates of the farthest object to be driven away; ε c represents the aggregation parameter; Therefore, the position S of the second agent at the next time step , 2 is: In formula (8), S , 2 represents the actual updated position of the second agent at the next moment; S2 represents the original position of the second agent; δ s represents the movement speed of the second agent.

8. The intelligent agent path finding and driving method based on the self-propelled particle model of the sheepdog, as described in claim 4, is characterized in that The B3 also includes C3: The first intelligent agent calculates the driving direction according to the first target point, the second target point, and the centroid of the target object to be driven: Let the coordinates of the first target point be target_point, and the coordinates of the second target point be next_point. Then the tangent direction of travel at this moment is: In formula (9), tan_slope represents the tangent direction of travel; target_point[0] represents the abscissa of the first target point, and target_point[1] represents the ordinate of the first target point; next_point[0] represents the abscissa of the second target point, and next_point[1] represents the ordinate of the second target point; Then convert the travel direction into the form of a travel direction tangent vector tan_dir = [1, tan_slope]; Finally, calculate the vector between the first target point and the centroid of the target object to be driven: d_dir = GCM - target_point (10) In formula (10), d_dir represents the vector between the first target point and the centroid of the target object to be driven; GCM represents the centroid coordinates of the target object to be driven; target_point represents the first target point coordinates; Synthesize the vector between the first target point and the centroid of the target object to be driven and the travel direction tangent vector, which is the driving direction of the first intelligent agent: direction = -α · tan_dir + β · d_dir (11) In formula (11), direction represents the driving direction of the first intelligent agent; tan_dir represents the travel direction tangent vector; d_dir represents the vector between the first target point and the centroid of the target object to be driven; α, β represent hyperparameters.

9. The intelligent agent path finding and driving method based on the sheepdog self-propelled particle model according to claim 8, characterized in that, The target position of the first intelligent agent at the next moment is: P d = -ε d ·direction + GCM(12) In formula (12), P d represents the target position of the first agent at the next moment; ε d represents the driving parameter; GCM represents the central position of the object to be driven away.