Sheep farm robot path planning method and system based on ant colony algorithm

By using real-time image segmentation and ant colony optimization, an environmental interference distribution map is generated, and the path of the sheep farm robot is dynamically adjusted. This solves the navigation adaptability problem of the sheep farm robot in dynamic environments and achieves safe and efficient navigation optimization.

CN121540184APending Publication Date: 2026-02-17SHIHEZI UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511810919.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-03
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

In existing technologies, sheep farm robots have poor navigation adaptability in dynamic environments and are unable to cope with environmental changes caused by sheep movement and temporary obstacles, resulting in navigation interruption or path failure.

Method used

Dynamic obstacle outlines are obtained through real-time image segmentation and sheep location distribution, generating an environmental interference distribution map. Global path search is performed by combining ant colony algorithm, obstacles are dynamically identified and the path is adjusted to generate a safe travel strategy, and environmental changes are continuously monitored and navigation paths are optimized.

Benefits of technology

It improves the robot's path planning adaptability in complex environments, enhances its response to sudden changes, improves the safety and stability of motion control, and maintains long-term environmental adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121540184A_ABST
    Figure CN121540184A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of intelligent animal husbandry, and discloses a sheep farm robot path planning method and system based on an ant colony algorithm, and the method comprises the steps: collecting sheep farm environment data and sheep flock position distribution in real time through a sensor array, and recognizing a dynamic obstacle contour through an image segmentation technology; generating an environment interference distribution diagram based on the sheep flock moving speed and obstacle distribution, and determining an interference area boundary through gridding processing; performing global path search by adopting an ant colony algorithm to generate an initial navigation path, and predicting a potential conflict area in combination with laser radar data; a path turning point is corrected in real time through dynamic obstacle recognition, and the advancing speed is adjusted in a self-adaptive mode according to the environment interference intensity; in the execution process, path deviation is continuously detected, a local path is adjusted, and meanwhile environment change is recorded to dynamically update a navigation scheme. The method can solve the problem of poor robot navigation adaptability in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent animal husbandry technology, and in particular to a method and system for robot path planning in sheep farms based on ant colony algorithm. Background Technology

[0002] Currently, in the field of intelligent animal husbandry, the autonomous navigation capability of sheep farm robots is the core technological support for achieving automated inspection, feeding, and other operational tasks. Because the sheep farm environment has typical dynamic characteristics, factors such as sheep movement and the appearance of temporary obstacles cause continuous changes in the environmental state, which places high demands on the robot's real-time perception and path planning capabilities. How to achieve safe and efficient navigation for robots in such complex and dynamic scenarios has become a key technical problem that urgently needs to be solved in this field.

[0003] In one existing technology, path planning methods based on static maps perform global path planning using a pre-built environmental map and combine it with simple obstacle avoidance rules to achieve local navigation. For example, after generating the optimal path through offline path search using an ant colony algorithm, the robot performs tasks along a fixed trajectory. When sensors detect obstacles, it only performs local detours according to preset obstacle avoidance rules. However, such methods are not adaptable to dynamic environmental changes, especially in areas with dense flocks of sheep. Static paths often fail to detect the movement trends of the flock in time, leading to navigation interruptions or path failures. While ant colony algorithms have advantages in global path optimization, their inherent offline computational characteristics make them difficult to cope with real-time environmental changes. Existing technologies lack the ability to predict dynamic obstacles and a real-time collaborative mechanism between environmental perception and path planning. This results in the system's inability to reconstruct the navigation path in time when flocks move or temporary obstacles appear, creating new interference areas, causing robot response delays.

[0004] Therefore, existing technologies suffer from poor adaptability in robot navigation. Summary of the Invention

[0005] This invention provides a path planning method and system for sheep farm robots based on ant colony algorithm, in order to solve the problem of poor robot navigation adaptability in existing technologies.

[0006] Firstly, to address the aforementioned technical problems, this invention provides a path planning method for a sheep farm robot based on ant colony optimization, comprising:

[0007] Acquire real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock; perform image segmentation on the real-time images and extract the contours of dynamic obstacles.

[0008] Based on the location distribution of the sheep flock, the sheep flock movement speed is calculated, and an environmental interference distribution map is generated based on the sheep flock movement speed and the outline of the dynamic obstacle. The environmental interference distribution map is then divided into grids, and the boundaries of the interference area are extracted.

[0009] Based on the boundary of the interference area, an ant colony algorithm is used to perform a global path search, generate an initial navigation path, predict the distribution range of potential collision areas, adjust the path according to the distribution range, and determine the turning point of the initial path.

[0010] For the initial path turning point, dynamic obstacle identification is performed. If an obstacle is detected entering the monitoring range, the local map update frequency is increased and the path is adjusted to obtain the corrected turning point.

[0011] An interference assessment is performed around the correction inflection point to obtain the environmental interference intensity. Based on the environmental interference intensity, a speed control command is generated to dynamically adjust the robot's movement speed, thereby obtaining a safe travel strategy.

[0012] The safe travel strategy is executed while the path deviation is detected. If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory.

[0013] The optimized execution trajectory guides the robot's navigation. During the journey, environmental changes are recorded and the boundaries of the interference area are continuously updated. If a change in the boundary of the interference area is detected, the local map update frequency is adjusted and the navigation path is optimized again to generate an adaptive navigation scheme.

[0014] According to the optimized navigation scheme, the dynamic environment within the sheep farm is continuously monitored. If a new boundary of the interference area is detected, the path adjustment is re-triggered to obtain a continuously adaptable navigation path.

[0015] Preferably, the process involves acquiring real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock, performing image segmentation on the real-time images, and extracting the contours of dynamic obstacles, including:

[0016] Collect real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock;

[0017] The real-time image is preprocessed with denoising and enhancement to obtain a clear image;

[0018] The clear image is segmented, and the outlines of the sheep flock and dynamic obstacles are extracted.

[0019] Preferably, based on the sheep flock's location distribution, the sheep flock's movement speed is calculated, and an environmental disturbance distribution map is generated based on the sheep flock's movement speed and the outline of the dynamic obstacle. The environmental disturbance distribution map is then divided into grids, and the boundaries of the disturbance areas are extracted, including:

[0020] Based on the time series data of the sheep flock's location distribution, a time series analysis was performed to obtain the sheep flock's movement speed in multiple areas;

[0021] Based on the moving speed and the outline of the dynamic obstacle, environmental interference is calculated, and an environmental interference distribution map is generated.

[0022] The environmental interference distribution map is processed into a grid to obtain an interference distribution grid map. The interference intensity within the grid in the interference distribution grid map is optimized and adjusted before the boundary of the interference area is extracted.

[0023] Preferably, based on the boundary of the interference area, an ant colony algorithm is used to perform a global path search to generate an initial navigation path, and the distribution range of potential collision areas is predicted. The path is then adjusted based on the distribution range to determine the initial path turning points, including:

[0024] Acquire surrounding environmental data;

[0025] Based on the boundary of the interference area and the surrounding environment data, a map mapping operation is performed to construct a unified environmental map containing the interference area and obstacles.

[0026] Based on the unified environment map, a global path search is performed to generate an initial navigation path;

[0027] Based on the initial navigation path and the sheep's movement speed data, the distribution range of potential collision areas is predicted.

[0028] Based on the distribution range of the potential collision areas, the initial navigation path is adjusted to determine the initial path turning points.

[0029] Preferably, for the initial path turning point, dynamic obstacle identification is performed. If an obstacle is detected entering the monitoring range, the local map update frequency is increased and the path is adjusted to obtain a corrected turning point, including:

[0030] The area surrounding the initial path turning point is continuously scanned. If an obstacle is detected entering the scanning range, the update frequency of the local map is increased, and the location of the obstacle is obtained.

[0031] Based on the location of the obstacle, the initial path turning point is adjusted to obtain the corrected turning point.

[0032] Preferably, an interference assessment is performed around the correction inflection point to obtain the environmental interference intensity, and based on the environmental interference intensity, a speed control command is generated to dynamically adjust the robot's movement speed, thereby obtaining a safe travel strategy, including:

[0033] The local sheep movement speed and local obstacle distribution density in the area surrounding the corrected turning point are obtained. Based on the local sheep movement speed and local obstacle distribution density, the environmental disturbance intensity in the area surrounding the corrected turning point is calculated.

[0034] Based on the intensity of the environmental interference, calculate the speed control command;

[0035] Based on the speed control command, the robot's movement speed is smoothly and dynamically adjusted to obtain a safe travel strategy.

[0036] Preferably, the safe travel strategy is executed while path deviation is detected. If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory, including:

[0037] The safe travel strategy is executed while real-time positioning is performed to obtain the robot's actual position, and the path deviation between the robot's actual position and the expected path in the safe travel strategy is calculated.

[0038] If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory.

[0039] Preferably, the robot navigation is guided by the optimized execution trajectory, recording environmental changes and continuously updating the boundary of the interference area during movement. If a change in the boundary of the interference area is detected, the local map update frequency is adjusted and the navigation path is optimized again to generate an adaptive navigation scheme, including:

[0040] The robot navigation is guided by the optimized execution trajectory. During the journey, environmental changes are recorded and the boundary of the interference area is continuously updated to obtain the updated boundary of the interference area.

[0041] If a change in the boundary of the updated interference area is detected, the local map update frequency is adjusted, the adjusted update frequency is determined, the local map is updated, and the route is replanned to obtain an adaptive navigation scheme.

[0042] Secondly, the present invention provides a path planning system for a sheep farm robot based on an ant colony algorithm, comprising:

[0043] The image acquisition and preprocessing module is used to acquire real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock, perform image segmentation on the real-time images, and extract the contours of dynamic obstacles.

[0044] The interference region division module is used to calculate the sheep's movement speed based on the sheep's location distribution, generate an environmental interference distribution map based on the sheep's movement speed and the outline of the dynamic obstacle, divide the environmental interference distribution map into a grid, and extract the boundaries of the interference region.

[0045] The turning point generation module is used to perform a global path search using an ant colony algorithm based on the boundary of the interference area, generate an initial navigation path, predict the distribution range of potential collision areas, adjust the path according to the distribution range, and determine the turning point of the initial path.

[0046] The turning point correction module is used to dynamically identify obstacles at the initial path turning points. If an obstacle is detected entering the monitoring range, the local map update frequency is increased and the path is adjusted to obtain the corrected turning point.

[0047] The travel strategy generation module is used to evaluate the interference around the correction turning point, obtain the environmental interference intensity, and generate speed control commands to dynamically adjust the robot's moving speed based on the environmental interference intensity, thereby obtaining a safe travel strategy.

[0048] The trajectory optimization module is used to execute the safe travel strategy and detect path deviation. If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory.

[0049] The adaptive navigation module is used to guide the robot's navigation through the optimized execution trajectory. It records environmental changes and continuously updates the boundary of the interference area during movement. If a change in the boundary of the interference area is detected, the local map update frequency is adjusted and the navigation path is optimized again to generate an adaptive navigation scheme.

[0050] Compared with the prior art, the present invention has the following beneficial effects:

[0051] (1) This invention obtains the outline of dynamic obstacles by performing image segmentation on real-time images, and calculates the moving speed by combining the sheep flock's location distribution to generate an environmental interference distribution map, which helps to improve the recognition accuracy of dynamic environmental features and provide more accurate environmental status information for path planning.

[0052] (2) The present invention uses the ant colony algorithm to perform global path search based on the boundary of the interference area and combines lidar data to predict potential conflict areas, which can optimize the rationality and safety of the initial path and improve the adaptability of path planning to complex environments.

[0053] (3) By dynamically identifying obstacles around the turning points of the path and adjusting the local map update frequency and path direction, this invention helps to enhance the system's ability to respond to sudden environmental changes and improve the real-time adaptability of the local path.

[0054] (4) The present invention evaluates the intensity of environmental interference based on the modified path turning point, generates speed control commands and dynamically adjusts the robot's moving speed, which can achieve the matching of the moving speed with the environmental risk and improve the safety of robot motion control.

[0055] (5) When executing the safe travel strategy, the present invention will also detect the path deviation between the actual path and the expected path in the safe travel strategy, and dynamically correct the local path within the control cycle based on the deviation data, effectively avoiding path instability or oscillation, and improving the safety and stability of robot motion control.

[0056] (6) By continuously monitoring environmental changes and re-triggering path adjustments, the present invention forms a navigation scheme with a feedback optimization mechanism, which helps to maintain the environmental adaptability of the system in long-term operation and improve the continuous optimization capability of the navigation system. Attached Figure Description

[0057] Figure 1 This is a schematic diagram of a path planning method for a sheep farm robot based on ant colony algorithm provided in the first embodiment of the present invention;

[0058] Figure 2 This is a schematic diagram of a sheep farm robot path planning system based on ant colony algorithm provided in the second embodiment of the present invention. Detailed Implementation

[0059] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0060] Reference Figure 1 The first embodiment of the present invention provides a path planning method for a sheep farm robot based on ant colony algorithm, including the following steps:

[0061] S11, acquire real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock, perform image segmentation on the real-time images, and extract the outlines of dynamic obstacles;

[0062] S12, calculate the sheep flock's movement speed based on the sheep flock's location distribution, generate an environmental interference distribution map based on the sheep flock's movement speed and the outline of the dynamic obstacle, divide the environmental interference distribution map into a grid, and extract the boundaries of the interference area.

[0063] S13. Based on the boundary of the interference area, the ant colony algorithm is used to perform a global path search, generate an initial navigation path, predict the distribution range of potential collision areas, adjust the path according to the distribution range, and determine the turning point of the initial path.

[0064] S14. For the initial path turning point, perform dynamic obstacle identification. If an obstacle is detected entering the monitoring range, increase the local map update frequency and adjust the path to obtain the corrected turning point.

[0065] S15, perform interference assessment around the correction inflection point to obtain the environmental interference intensity, and generate speed control commands based on the environmental interference intensity to dynamically adjust the robot's moving speed and obtain a safe travel strategy.

[0066] S16, execute the safe travel strategy and detect path deviation. If the path deviation exceeds a preset deviation threshold, update the local route to obtain an optimized execution trajectory.

[0067] S17, guide robot navigation through the optimized execution trajectory, record environmental changes during movement and continuously update the boundary of the interference area. If a change in the boundary of the interference area is detected, adjust the local map update frequency and optimize the navigation path again to generate an adaptive navigation scheme.

[0068] In step S11, real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock are acquired. Image segmentation is performed on the real-time images to extract the contours of dynamic obstacles, including:

[0069] Collect real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock;

[0070] The real-time image is preprocessed with denoising and enhancement to obtain a clear image;

[0071] The clear image is segmented, and the outlines of the sheep flock and dynamic obstacles are extracted.

[0072] First, data acquisition is accomplished through a multi-sensor network deployed in key areas of the sheep farm. This sensor network includes high-definition visible spectrum cameras deployed at the main passageways, watering areas, feeding areas, and boundary fences, installed at a height of 6 meters and with a tilt angle of 30 degrees, achieving effective monitoring coverage within a 100-meter radius. All image data is transmitted to edge computing nodes via gigabit industrial Ethernet and compressed using an encoding protocol.

[0073] Secondly, in the image preprocessing stage, noise suppression uses a bilateral filtering algorithm, with spatial domain parameters... Set to 1.5, range parameter Set to 0.8. Illumination enhancement employs a multi-scale Retinex algorithm. The strong light threshold of 80,000 lux is based on actual measurements of light intensity at noon in pastoral areas, while the weak light threshold of 10 lux references the average illuminance level under nighttime conditions without auxiliary lighting. When the ambient light intensity exceeds the strong light threshold, adaptive gamma correction is enabled. The gamma value is dynamically adjusted based on the light intensity using a linear interpolation method; the specific calculation formula is as follows:

[0074]

[0075] in To calculate the gamma value, Given the current light intensity, and These are the maximum and minimum light intensities, set based on historical light intensity data. For example, the minimum light intensity can be set to 80,000 lux, and the maximum light intensity can be set to 120,000 lux. When the light intensity is below the low light threshold, adaptive histogram equalization with limited contrast is performed. The ClipLimit parameter is set to 2.0, and the grid size is set to 8×8.

[0076] Then, the preprocessed images were segmented using a U-Net-based deep learning architecture, with the input image size adjusted to 512×512 pixels. During model training, a dataset containing 5000 finely annotated images was used, with the training, validation, and test sets divided in a 7:2:1 ratio. The Adam optimizer was used for training, with an initial learning rate of 0.001. The learning rate was halved every 50 training epochs, for a total of 200 epochs. The loss function was a weighted combination of cross-entropy loss and Dice loss, which effectively balanced class imbalance and optimized segmentation boundary quality. During segmentation inference, the moving target region is first extracted using inter-frame difference, with a difference threshold set to 15. This value is based on the image's grayscale dynamic range [0, 255] and determined through background noise statistics. Extensive data validation has shown that this threshold best distinguishes between noise and valid signals, hence the threshold of 15 is set. Next, the trained network is used for pixel-level classification, and a confidence threshold is determined. This value is selected based on the balance point of the precision-recall curve on the validation set. The segmentation results undergo morphological closing operations, and an iterative process is performed using a 3×3 circular structure. This parameter is determined through experiments balancing contour integrity and noise suppression at different sizes.

[0077] Next, a three-stage contour extraction process is executed. The first stage uses the Freeman chain code algorithm to extract complete contours from the segmented binary image, with the chain code direction number set to 8 and the minimum contour area threshold set to 1000 pixels. This threshold is determined based on actual scene analysis; contours with areas smaller than this value are mostly noise. The second stage uses the Douglas-Peucker algorithm for polygon approximation, with the epsilon parameter dynamically adjusted according to the contour perimeter and set to 1% of the perimeter. The third stage performs multi-dimensional verification on the simplified contours: spatial consistency verification based on UWB positioning data, with a position deviation threshold set to 0.5m, a value referencing the positioning accuracy of the UWB system in real-world environments while allowing for appropriate margins; motion trajectory analysis based on five consecutive frames, with a motion consistency threshold set, determined by analyzing the difference in motion continuity between real obstacles and noise; and shape similarity threshold based on Hu invariant moments. Through these operations, objects whose contours change position more than 0.1m between consecutive frames are identified as dynamic obstacles.

[0078] Finally, the output dynamic obstacle contour data is stored in a standardized GeoJSON format. The data structure includes Cartesian coordinates of the contour point sequence; contour type identifiers, including categories such as sheep, vehicles, and facilities; confidence scores, represented by floating-point numbers from 0 to 1; and timestamps in the ISO 8601 standard format. The data update frequency is 5Hz, and transmission latency is controlled.

[0079] In step S12, the sheep's movement speed is calculated based on the sheep's location distribution, and an environmental disturbance distribution map is generated based on the sheep's movement speed and the outline of the dynamic obstacle. The environmental disturbance distribution map is then divided into grids, and the boundaries of the disturbance areas are extracted, including:

[0080] Based on the time series data of the sheep flock location distribution, a time series analysis was performed to obtain the sheep flock movement speed in multiple regions.

[0081] Based on the sheep's movement speed and the outline of the dynamic obstacle, environmental interference is calculated, and an environmental interference distribution map is generated.

[0082] The environmental interference distribution map is processed into a grid to obtain an interference distribution grid map. The interference intensity within the grid in the interference distribution grid map is optimized and adjusted before the boundary of the interference area is extracted.

[0083] First, time-series analysis was performed based on the location distribution data of the sheep flock. Coordinate data was collected using a UWB positioning system at a frequency of 1 Hz. Moving speed was calculated using a sliding window method, with the location sequence within the window smoothed by Savitzky-Golay filtering. The polynomial order of the Savitzky-Golay filter was set to 3. Then, speed calculation and subgrouping were performed. Based on the smoothed location data, the instantaneous moving speed of each sheep was calculated using the central difference method, with a difference step size of 1 second. Subsequently, the DBSCAN clustering algorithm was used to divide the sheep into moving subgroups based on their spatial location distribution. The algorithm parameters were set as follows: neighborhood radius 2 m, minimum sample size 5. This parameter combination is based on typical sheep aggregation behavior and can effectively distinguish independent subgroups. Finally, to characterize the overall movement state of each subgroup, the average moving speed of the centroid of each subgroup was calculated. To avoid interference from abnormal running by individual sheep (such as fleeing in fright) on the overall assessment, a speed threshold of 2 m / s was set. This threshold was determined based on the 95th percentile of speed statistics from historical abnormal events. Use the velocities of all subgroups below this threshold as key inputs for generating the environmental disturbance distribution map.

[0084] Secondly, an environmental disturbance assessment model was constructed and an environmental disturbance distribution map was generated. The model was first established and trained by collecting six months of sheep farm operation data to create a training set containing 1000 labeled samples. The samples were independently labeled by three experienced herders, and the consistency of their labeling results was tested by the Kappa coefficient (κ>0.8), indicating good consistency. A multiple linear regression method was used to build the model, with normalized sheep movement speed and obstacle density as input features, and an environmental disturbance intensity score as output. All input features were normalized before modeling. Specifically, sheep movement speed was based on the 99th percentile of historical data, with a safety factor of 1.2, and a normalization upper limit of 3.5 m / s was used for maximum and minimum value processing. This normalization upper limit was determined by rounding down the maximum value after excluding outliers from historical data. Obstacle density was obtained by statistically analyzing the proportion of grid cells marked as obstacles per unit area; its value is in the [0,1] interval and requires no additional normalization. The weight coefficients were determined based on the Pearson correlation coefficient between each input factor and navigation safety. The specific process is as follows: First, the absolute values ​​of the correlation coefficients of each factor are calculated (in this example, the velocity factor is 0.72 and the obstacle density factor is 0.58). Then, the factors are allocated according to their proportion in the total, and finally, the weight of the velocity factor is set to 0.55 and the weight of the obstacle density factor is set to 0.45. The regression coefficients in the model are optimized using the least squares method, and the model performance is evaluated by 10-fold cross-validation. The obtained coefficient of determination R² is 0.87, indicating that the model can effectively explain most of the data variance and has good predictive ability. Finally, the normalized velocity and obstacle density data of each point to be evaluated in the monitoring area are input into the trained model to calculate the estimated value of the environmental disturbance intensity at that point. By traversing the entire area and using spatial interpolation methods such as inverse distance weighting to process the estimated values ​​of all points, a complete and continuous environmental disturbance distribution map is finally generated.

[0085] Then, the environmental interference distribution map was gridded, dividing the monitoring area into a regular 10m × 10m grid. The grid size was chosen based on a balance between spatial resolution requirements and computational resources. Experiments verified that this size ensured accuracy while keeping computational complexity within an acceptable range. The interference intensity value of each grid was calculated using the inverse distance weighted average method. The complete calculation formula is as follows:

[0086]

[0087] in This represents the estimated interference intensity of the grid. This represents the measured interference intensity at the i-th sampling point. The distance from the sampling point to the center of the grid is represented by the Euclidean distance (in meters). p=2 is the distance attenuation coefficient, which is determined through cross-validation. n is the number of sampling points that affect the grid.

[0088] Subsequently, optimization and boundary extraction processes were performed on the mesh image. First, field optimization and smoothing were performed using an anisotropic diffusion algorithm to optimize the interference intensity field within the mesh, smoothing noise while preserving significant boundaries. The diffusion coefficient was adaptively adjusted according to the interference intensity gradient, with a diffusion time step of 0.1 seconds and at least 50 iterations. Numerical stability analysis of this parameter set showed that it could achieve effective smoothing while ensuring convergence. Next, preliminary boundary extraction was performed. Based on the optimized interference intensity field, the Canny edge detection algorithm was used to extract candidate boundaries. The algorithm parameters were set to a Gaussian filter standard deviation of 1.0 and a high-low threshold ratio of 1:3 to balance sensitivity and false detections; the minimum boundary length was set to 5 mesh cells to filter out small contours caused by noise. Then, morphological closure operations were performed on the initially extracted boundaries, using 3×3 circular structuring elements to connect broken boundaries with a spacing of less than 3 pixels. The Douglas-Peucker algorithm was used to simplify the boundary polygons, with a distance threshold set to 0.5m (5% of a 10m mesh size), reducing data volume while preserving shape features. The final boundary of the interference region is composed of pixels with gradient values ​​exceeding a threshold of 0.15. This threshold is set based on the gradient distribution statistics of historical interference region boundaries, using the 95th percentile, which can effectively distinguish significant interference regions.

[0089] Finally, the boundary of the interference area is output and stored in a two-dimensional matrix data structure. The matrix elements are 32-bit floating-point numbers, and the row and column indices correspond to geographic coordinates. The update frequency is set to 2Hz. It includes boundary point sequence coordinates, boundary type identifiers, and confidence scores, providing environmental awareness input for subsequent path planning.

[0090] In step S13, based on the boundary of the interference area, an ant colony algorithm is used to perform a global path search to generate an initial navigation path, and the distribution range of potential collision areas is predicted. The path is then adjusted based on the distribution range to determine the initial path turning points, including:

[0091] Acquire surrounding environmental data;

[0092] Based on the boundary of the interference area and the surrounding environment data, a map mapping operation is performed to construct a unified environmental map containing the interference area and obstacles.

[0093] Based on the unified environment map, a global path search is performed to generate an initial navigation path;

[0094] Based on the initial navigation path and the sheep's movement speed data, the distribution range of potential collision areas is predicted.

[0095] Based on the distribution range of the potential collision areas, the initial navigation path is adjusted to determine the initial path turning points.

[0096] First, environmental data is collected using a 2D LiDAR mounted on top of the robot. The scanning frequency is set to 10Hz, which balances the real-time nature of environmental perception with the data processing load. The point cloud data undergoes a polar coordinate to Cartesian coordinate conversion using the following formula:

[0097]

[0098] in, Indicates the measured distance (unit: m). Indicates the scanning angle (unit: rad). , The coordinates are the transformed coordinates. The transformed point cloud data is then rasterized to construct a two-dimensional raster map. During the rasterization process, the number of points falling into each raster cell is counted. When the number of points exceeds a threshold of 5, the raster is marked as occupied. This threshold is determined through sensor noise characteristic analysis.

[0099] Simultaneously, the coordinates of the pre-labeled interference area boundaries are read and mapped to the grid map coordinate system through affine transformation to establish a unified environmental map containing obstacle information and interference areas.

[0100] Secondly, on this unified environmental map, an ant colony algorithm was used for global path search. The algorithm parameters were optimized through orthogonal experiments, with the number of ants set to 50, the pheromone evaporation coefficient set to 0.5, and the pheromone enhancement coefficient set to 2.0. During the algorithm initialization phase, all elements of the pheromone matrix were set to a uniform value of 1.0. The path selection probability was calculated using the state transition probability formula:

[0101]

[0102] in Ants From node Transfer to node The probability, Representing a path The concentration of pheromones on the surface Represents the heuristic function value. Ants The set of next nodes that can be selected from the current node. Heuristic function. The design takes into account both path length and safety. Paths passing through interference areas are assigned lower heuristic values, calculated using the following formula:

[0103]

[0104] in To calculate the heuristic function value, Indicates the path length. The cost of a path traversing interference areas is extracted from a unified environment map, and the weighting coefficients are used. The weight is set to 5, determined based on multi-objective optimization considering path safety and operational efficiency metrics. The convergence condition for the ant colony algorithm is that the optimal path remains unchanged for at least 10 consecutive iterations or a preset maximum number of iterations, such as 200, is reached. After each iteration, the pheromone is updated according to the following rules:

[0105]

[0106] in, Indicates the pheromone evaporation coefficient. Indicates the number of ants. , These are the pheromones before and after the update. Indicates the first Only ants on the path The increase in pheromone left behind by the ant is directly proportional to the quality of the path taken, specifically calculated as follows:

[0107]

[0108] in Represents the pheromone intensity constant. Indicates the first The total length of the path traveled by each ant (in meters). Finally, the shortest path found by all ants in the iterations is output as the initial navigation path.

[0109] Then, based on the initial navigation path and sheep movement speed data, potential collision zones are predicted, and a collision prediction model based on the velocity obstacle method is established. Potential conflicts are identified by analyzing the relative relationship between the sheep movement vector (composed of sheep position and velocity information, collected by a UWB positioning system and calculated through time-series analysis) and the robot's trajectory. Using the robot as a reference frame, the angle between the sheep's relative velocity vector and the robot's direction of motion is calculated. When the angle is less than 90 degrees and the expected minimum distance is less than the safety interval of 2 meters, the area is marked as a potential collision zone. The prediction time window is set to 5 seconds, determined based on the analysis of the longest time required for the robot to perceive and execute a complete obstacle avoidance maneuver.

[0110] Finally, based on the distribution range of potential collision zones, the initial navigation path is adjusted to determine the initial path turning points. Local path optimization is performed using an artificial potential field method, establishing a repulsive potential field around the potential collision zones. The magnitude of the repulsive force is inversely proportional to the square of the distance, with a scaling factor set to 10 N·m. 2An attractive potential field is established at the target point, with the attractive force proportional to the distance and a proportionality coefficient set to 1 N / m. The initial path is corrected by calculating the direction of the resultant force, and the corrected path maintains a safe distance of no less than 2 m from the potential collision zone. If the path curvature changes by more than 0.2 m... -1 The path turning points are set at their locations, and this threshold is determined based on the robot's maximum turning angular velocity of 1.0 rad / s and motion stability requirements; the minimum distance between adjacent turning points is set to 1 m; the specific coordinates of the turning points are calculated using a cubic spline interpolation algorithm.

[0111] In step S14, dynamic obstacle identification is performed on the initial path turning point. If an obstacle is detected entering the monitoring range, the local map update frequency is increased and the path is adjusted to obtain a corrected turning point, including:

[0112] The area surrounding the initial path turning point is continuously scanned. If an obstacle is detected entering the scanning range, the update frequency of the local map is increased, and the location of the obstacle is obtained.

[0113] Based on the location of the obstacle, the initial path turning point is adjusted to obtain the corrected turning point.

[0114] First, a continuous scan is performed on the area surrounding the initial path turning point, with a monitoring radius set to 3m. This distance is determined based on the robot's braking distance (2m) and safety margin (1m). Real-time point cloud data within the area is acquired using a 10Hz LiDAR scanner, and the processing latency for dynamic obstacle recognition is controlled within 100 milliseconds. The DBSCAN clustering algorithm is used to group the point cloud data, with a neighborhood radius of 0.3m and a minimum sample size of 5. During obstacle recognition, the geometric features of each point cloud cluster are calculated, including the cluster's centroid position, circumscribed rectangle size, and point cloud density. When the Euclidean distance between the centroid of a point cloud cluster and the turning point is less than the monitoring threshold of 3m, an obstacle is considered to have entered the monitoring range. This threshold comprehensively considers the robot's dimensions and motion uncertainties.

[0115] Secondly, upon detecting an obstacle entering the monitoring range, a frequency adjustment mechanism is activated, increasing the local map update frequency from the usual 1Hz to 5Hz. Obstacle position coordinates are represented using a Cartesian coordinate system. A Kalman filter algorithm is used to perform short-term predictions of moving obstacles to obtain their positions. The prediction time span is set to 2 seconds. The state transition matrix is ​​established based on a uniform motion model. The process noise covariance matrix Q is set to 0.1 times the identity matrix, and the observation noise covariance matrix R is set to 0.01 times the identity matrix.

[0116] Finally, the initial path turning points are adjusted based on the obstacle positions to obtain safe corrected turning points. This local path adjustment process employs a strategy combining artificial potential fields and numerical optimization. First, a multi-obstacle cooperative obstacle avoidance strategy is adopted, using a potential field superposition method to handle the combined influence of multiple obstacles and provide an initial direction for path adjustment. A virtual repulsive force field is constructed, and a point within this field... The magnitude of the total repulsive force at the location Calculated using the exponential decay method:

[0117]

[0118] in Point The repulsive force at the location, Indicates the repulsive force coefficient. This represents the potential field attenuation coefficient. Point To the One obstacle Euclidean distance, This represents the number of obstacles. The inflection point adjustment problem is then modeled as a constrained optimization problem to precisely find the optimal coordinates of the corrected inflection point. This optimization model aims to make the corrected point both close to the original path and maintain a safe distance from all obstacles. The objective function is defined as:

[0119]

[0120] in, This represents the coordinates of the corrected inflection point to be determined. Represents the original inflection point coordinates. Indicates the position of the i-th obstacle. This represents the Euclidean distance from point P to the obstacle. Setting it to 1m indicates the safe distance threshold. Setting it to 10 indicates a weighting coefficient. The value is set to 0.01 as the numerical stability constant. The new inflection point location must maintain a safe distance of at least 1m from all obstacles; this distance is determined based on the robot's outer radius and braking error. This optimization problem is solved iteratively using the gradient descent method, with a learning rate of 0.1, a maximum number of iterations of 100, and a convergence condition where the change in solution between adjacent iterations is less than 0.001m. The final solution obtained is... This refers to the turning point of the corrected path.

[0121] In step S15, an interference assessment is performed around the corrected turning point to obtain the environmental interference intensity. Based on the environmental interference intensity, a speed control command is generated to dynamically adjust the robot's movement speed, resulting in a safe travel strategy, including:

[0122] The local sheep movement speed and local obstacle distribution density in the area surrounding the corrected turning point are obtained. Based on the local sheep movement speed and local obstacle distribution density, the environmental disturbance intensity in the area surrounding the corrected turning point is calculated.

[0123] Based on the intensity of the environmental interference, calculate the speed control command;

[0124] Based on the speed control command, the robot's movement speed is smoothly and dynamically adjusted to obtain a safe travel strategy.

[0125] First, an interference assessment is conducted on the area surrounding the correction inflection point. A circular monitoring area with a radius of 3 meters is established, based on the robot's braking distance and the effective range of the sensors. Spatial sampling is then performed. Within this circular monitoring area, several virtual sampling points are set at 1-meter intervals. Through multi-sensor fusion, data on the sheep's movement speed and obstacle distribution density near each sampling point are acquired. The speed and density data of each sampling point are input into the environmental interference assessment model constructed and validated in step S12 to calculate the local environmental interference intensity at each sampling point. Finally, the maximum local interference intensity of all sampling points within this circular monitoring area is taken as the final environmental interference intensity at the correction inflection point.

[0126] Secondly, speed control commands are generated based on the intensity of environmental interference, which is divided into three levels: low interference (…). ), medium interference ( ) and high interference ( These thresholds were determined based on quantile analysis of at least 200 sets of actual operational data. The base speed settings for each disturbance level are: 1.0 m / s for low disturbance, 0.6 m / s for medium disturbance, and 0.3 m / s for high disturbance. These speed values ​​are determined based on robot motion performance and safety requirements. The specific calculation formula for the speed control command is as follows:

[0127]

[0128] in This indicates the final speed control command. Indicates the base speed. This represents the change in the current interference intensity relative to the previous moment. This represents the adjustment coefficient.

[0129] Finally, the robot's movement speed is dynamically adjusted to obtain a safe travel strategy, using a PID controller to achieve smooth speed regulation. During speed execution, the acceleration limit is set to ±0.5 m / s², a value determined based on the performance and comfort requirements of the robot's drive system. The generation of the safe travel strategy also considers the robot's dynamic constraints, with parameters determined based on the robot's mechanical structure and kinematic model.

[0130] The environmental disturbance intensity assessment frequency is set to 2Hz, determined based on environmental change characteristics and computational load. The speed control command update frequency is set to 5Hz to ensure timely response to dynamic environments. When a sudden change in environmental disturbance intensity is detected, i.e., the change between two consecutive samples exceeds 0.3, the speed control command is immediately recalculated. This sudden change threshold is determined based on the statistical standard deviation of the disturbance intensity.

[0131] In step S16, the safe travel strategy is executed, and path deviation is detected. If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory, including:

[0132] The safe travel strategy is executed while real-time positioning is performed to obtain the robot's actual position, and the path deviation between the robot's actual position and the expected path in the safe travel strategy is calculated.

[0133] If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory.

[0134] First, the robot's actual position is acquired using a multi-sensor fusion localization method. The UWB localization system provides an absolute position reference with a positioning accuracy of ±0.1m; the encoder and IMU provide relative displacement with a heading angle accuracy of ±0.5°. The localization data update frequency is set to 20Hz, determined based on the robot's maximum speed of 2m / s and a control cycle of 50ms. Based on the acquired robot's actual position, the path deviation between the robot and the desired path in the safe travel strategy is calculated. This deviation includes two components: lateral deviation and heading deviation. The lateral deviation is obtained by calculating the vertical distance from the actual position to the nearest point on the desired path using a point-to-line segment shortest distance algorithm; the heading deviation is obtained by calculating the angle between the robot's current orientation and the tangent direction of the path using a quaternion difference calculation method.

[0135] Secondly, the path deviation value is continuously monitored. When either the lateral deviation exceeds 0.3m or the heading deviation exceeds 15°, the current tracking command will be immediately interrupted, and local path replanning will be initiated. The lateral deviation threshold of 0.3m is mainly based on the robot's body width of 1.2m. To ensure safety, 50% of its half-width is set as a tolerance boundary to prevent the robot from scraping against the environment due to deviation from the path. The heading deviation threshold of 15° is based on the robot's kinematic constraints to ensure that when the heading deviation reaches this value, the resulting lateral offset growth rate can still be effectively corrected by the steering mechanism within the control cycle at typical motion speeds, thereby avoiding path instability or oscillation caused by untimely correction.

[0136] Finally, the local path is updated through path recalculation logic. A local path planning method based on cubic uniform B-spline curves is adopted, using the robot's current position as the new path starting point and the nearest forward path point on the original global path as the temporary target point. The target point is selected at a distance of 3m, determined based on the robot's braking distance of 2m and a safety margin of 1m. During path recalculation, the current environmental perception data, robot kinematic constraints, and safe travel strategy requirements are comprehensively considered to generate a smooth optimized execution trajectory. A new local path is constructed using cubic uniform B-spline curves, with 8 control points and uniformly distributed node vectors. The path continuity and smooth curvature changes are ensured by adjusting the control point positions. The new local path satisfies the following constraints: maintaining a safe distance of not less than 1m from obstacles, and the path curvature not exceeding 0.5m of the robot's maximum turning capability. -1 The curvature is continuous at the junction with the global path.

[0137] The optimized execution trajectory is output as a discrete point sequence, and the spacing between adjacent path points is adaptively adjusted according to the robot's current speed: when the speed is below 0.5 m / s, the point spacing is set to 0.2 m; when the speed is between 0.5 and 1.0 m / s, the point spacing is set to 0.3 m; and when the speed is above 1.0 m / s, the point spacing is set to 0.5 m. The adaptive spacing setting is determined based on the stability of the path tracking controller and computational resource constraints.

[0138] In step S17, the robot navigation is guided by the optimized execution trajectory. Environmental changes are recorded during movement, and the boundary of the interference area is continuously updated. If a change in the boundary of the interference area is detected, the local map update frequency is adjusted, and the navigation path is optimized again to generate an adaptive navigation scheme, including:

[0139] The robot navigation is guided by the optimized execution trajectory. During the journey, environmental changes are recorded and the boundary of the interference area is continuously updated to obtain the updated boundary of the interference area.

[0140] If a change in the boundary of the updated interference area is detected, the local map update frequency is adjusted, the adjusted update frequency is determined, the local map is updated, and the route is replanned to obtain an adaptive navigation scheme.

[0141] First, the optimized execution trajectory is converted into robot motion control commands, and environmental data is recorded simultaneously. The optimized execution trajectory is represented as a discrete pathpoint sequence containing coordinate and velocity information. A pure tracking algorithm is used to convert the pathpoints into steering and velocity control commands for the robot. (Look-forward distance) Based on the current speed Dynamic adjustment, the calculation formula is:

[0142]

[0143] The proportionality coefficient and basic forward sight distance The parameter combinations were determined based on path tracking stability simulation experiments. Control commands were sent to the actuators via the CAN bus. Simultaneously, the robot used its onboard sensor array (including LiDAR, a vision camera, and an infrared sensor) to continuously record environmental data at a fundamental frequency of 2Hz, focusing on a forward-facing fan-shaped area.

[0144] Secondly, based on the fusion of multi-source sensor data, the boundaries of the interference area are detected and updated. Environmental data processing employs a hierarchical fusion architecture. LiDAR point clouds are analyzed using Euclidean clustering to determine changes in obstacle distribution, with a clustering distance threshold of 0.5m. Visual data is used to detect changes in sheep density via the YOLO model. Infrared data is used to monitor temperature distribution changes through thermal imaging differential analysis. A comprehensive environmental change level value is calculated for the processed multi-source data using a weighted evaluation method. The calculation formula is as follows:

[0145]

[0146] in, , , These represent the changes in obstacle distribution, sheep density, and temperature distribution, respectively; weighting coefficients. =0.5, =0.3, =0.2, which is allocated based on the degree of impact and risk level of each environmental factor on navigation safety. Specifically, it reflects the risk of direct physical collision ( The risk of dynamic uncertainty is greater than that of dynamic uncertainty. Greater than indirect early warning risk ( ); , , The maximum range of variation for each factor is determined based on historical data statistics. This is relevant when considering the degree of environmental change. When the boundary update threshold of 0.4 is exceeded, the system determines that the boundary of the interference area has changed significantly and triggers the boundary update process. This process calls the environmental interference distribution map generation and gridding method described in step S12, but uses the previous boundary and the latest sensor data as input, and the output is the updated boundary of the interference area. The boundary update threshold is determined based on statistical analysis of historical operating data. A database containing over a thousand labeled samples is constructed, and receiver operating characteristic curves are plotted for performance evaluation. Finally, an inflection point value that achieves the best balance between detection sensitivity and system stability is selected. Specifically, the threshold effectively distinguishes between significant environmental changes and transient noise interference, ensuring a high success rate for triggering updates while suppressing unnecessary replanning frequency to an acceptable level, thus achieving an optimal trade-off between responsiveness and computational efficiency.

[0147] Next, the update frequency of the local map is dynamically adjusted based on boundary changes, and the system adjusts the update frequency based on the calculated degree of environmental change. Adaptively adjust the update frequency of the local map to form feedback control: when When the value is less than 0.2, the environment is considered stable, and the local map update frequency remains at 0.5Hz. When 0.2 <= When the value is less than 0.6, a moderate environmental change is determined, and the update frequency is increased to 2Hz. When the value is >=0.6, a drastic environmental change is detected, and the update frequency is further increased to 5Hz. This adjustment mechanism ensures that the sensing system resources can be allocated efficiently, saving computing power when the environment is stable and providing high-frequency environmental information when changes are drastic.

[0148] Finally, based on the new boundary and map frequency, local path replanning is triggered to generate an adaptive navigation scheme. Once the local map is updated according to the new frequency, and the updated map shows that the boundary of the interference area has changed compared to the previous planning cycle, the system immediately starts local path replanning. This process inherits the core algorithms of steps S13 and S14, using the optimized execution trajectory of the previous moment as a reference, and the latest unified environment map containing the new interference boundary as a constraint. It employs an ant colony algorithm with safety potential field guidance to perform local path search, generate an execution trajectory that bypasses the new interference area, and calculate the corresponding speed control commands. Finally, a complete data package integrating the latest path, speed curve, and environmental features is encapsulated into an adaptive navigation scheme to continuously and safely guide the robot in a dynamic environment.

[0149] In summary, this invention discloses a path planning method for a sheep farm robot based on ant colony optimization. It uses a sensor array to collect real-time environmental data and sheep location distribution in the sheep farm, and employs image segmentation technology to identify dynamic obstacle outlines. An environmental interference distribution map is generated based on the sheep's movement speed and obstacle distribution, and the boundaries of interference areas are determined through gridding. An initial navigation path is generated through global path search using ant colony optimization, and potential conflict areas are predicted using LiDAR data. Path turning points are corrected in real-time through dynamic obstacle identification, and the travel speed is adaptively adjusted according to the intensity of environmental interference. During execution, path deviations are continuously detected and local routes are adjusted, while environmental changes are recorded to dynamically update the navigation scheme, thus solving the problem of poor robot navigation adaptability in existing technologies.

[0150] Reference Figure 2 The second embodiment of the present invention provides a path planning system for a sheep farm robot based on ant colony algorithm, comprising:

[0151] The image acquisition and preprocessing module is used to acquire real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock, perform image segmentation on the real-time images, and extract the contours of dynamic obstacles.

[0152] The interference region division module is used to calculate the sheep's movement speed based on the sheep's location distribution, generate an environmental interference distribution map based on the sheep's movement speed and the outline of the dynamic obstacle, divide the environmental interference distribution map into a grid, and extract the boundaries of the interference region.

[0153] The turning point generation module is used to perform a global path search using an ant colony algorithm based on the boundary of the interference area, generate an initial navigation path, predict the distribution range of potential collision areas, adjust the path according to the distribution range, and determine the turning point of the initial path.

[0154] The turning point correction module is used to dynamically identify obstacles at the initial path turning points. If an obstacle is detected entering the monitoring range, the local map update frequency is increased and the path is adjusted to obtain the corrected turning point.

[0155] The travel strategy generation module is used to evaluate the interference around the correction turning point, obtain the environmental interference intensity, and generate speed control commands to dynamically adjust the robot's moving speed based on the environmental interference intensity, thereby obtaining a safe travel strategy.

[0156] The trajectory optimization module is used to execute the safe travel strategy and detect path deviation. If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory.

[0157] The adaptive navigation module is used to guide the robot's navigation through the optimized execution trajectory. It records environmental changes and continuously updates the boundary of the interference area during movement. If a change in the boundary of the interference area is detected, the local map update frequency is adjusted and the navigation path is optimized again to generate an adaptive navigation scheme.

[0158] It should be noted that the ant colony algorithm-based sheep farm robot path planning system provided in this embodiment of the invention is used to execute all the process steps of the ant colony algorithm-based sheep farm robot path planning method in the above embodiment. The working principles and beneficial effects of the two are one-to-one, so they will not be described again.

[0159] This invention also provides an electronic device. The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a sheep farm robot path planning program based on ant colony optimization. When the processor executes the computer program, it implements the steps described in the various embodiments of the sheep farm robot path planning method based on ant colony optimization, for example... Figure 1 The step S11 shown. Alternatively, when the processor executes the computer program, it implements the functions of each module in the above-described device embodiments, such as the data acquisition module.

[0160] For example, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.

[0161] The electronic device may be a desktop computer, laptop, handheld computer, or smart tablet, etc. The electronic device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. It may include more or fewer components than described above, or combine certain components, or different components. For example, the electronic device may also include input / output devices, network access devices, buses, etc.

[0162] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the electronic device, connecting all parts of the electronic device via various interfaces and lines.

[0163] The memory can be used to store the computer program or module. The processor implements various functions of the electronic device by running or executing the computer program or module stored in the memory and calling the data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0164] If the modules integrated into the electronic device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or system capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0165] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the system embodiment drawings provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0166] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. In particular, it should be noted that any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention for those skilled in the art.

Claims

1. A path planning method for a sheep farm robot based on ant colony optimization, characterized in that, include: Acquire real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock; perform image segmentation on the real-time images and extract the contours of dynamic obstacles. Based on the location distribution of the sheep flock, the sheep flock movement speed is calculated, and an environmental interference distribution map is generated based on the sheep flock movement speed and the outline of the dynamic obstacle. The environmental interference distribution map is then divided into grids, and the boundaries of the interference area are extracted. Based on the boundary of the interference area, an ant colony algorithm is used to perform a global path search, generate an initial navigation path, predict the distribution range of potential collision areas, adjust the path according to the distribution range, and determine the turning point of the initial path. For the initial path turning point, dynamic obstacle identification is performed. If an obstacle is detected entering the monitoring range, the local map update frequency is increased and the path is adjusted to obtain the corrected turning point. An interference assessment is performed around the correction inflection point to obtain the environmental interference intensity. Based on the environmental interference intensity, a speed control command is generated to dynamically adjust the robot's movement speed, thereby obtaining a safe travel strategy. The safe travel strategy is executed while the path deviation is detected. If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory. The optimized execution trajectory guides the robot's navigation. During the journey, environmental changes are recorded and the boundaries of the interference area are continuously updated. If a change in the boundary of the interference area is detected, the local map update frequency is adjusted and the navigation path is optimized again to generate an adaptive navigation scheme.

2. The path planning method for sheep farm robots based on ant colony algorithm according to claim 1, characterized in that, The process of acquiring real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock, performing image segmentation on the real-time images, and extracting the contours of dynamic obstacles includes: Collect real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock; The real-time image is preprocessed with denoising and enhancement to obtain a clear image; The clear image is segmented, and the outlines of the sheep flock and dynamic obstacles are extracted.

3. The path planning method for sheep farm robots based on ant colony algorithm according to claim 1, characterized in that, The process involves calculating the sheep's movement speed based on their location distribution, generating an environmental disturbance distribution map based on the sheep's movement speed and the outline of the dynamic obstacles, dividing the environmental disturbance distribution map into a grid, and extracting the boundaries of the disturbance areas, including: Based on the time series data of the sheep flock location distribution, a time series analysis was performed to obtain the sheep flock movement speed in multiple regions. Based on the sheep's movement speed and the outline of the dynamic obstacle, environmental interference is calculated, and an environmental interference distribution map is generated. The environmental interference distribution map is processed into a grid to obtain an interference distribution grid map. The interference intensity within the grid in the interference distribution grid map is optimized and adjusted before the boundary of the interference area is extracted.

4. The path planning method for sheep farm robots based on ant colony algorithm according to claim 1, characterized in that, The step of performing a global path search using an ant colony algorithm based on the boundary of the interference area to generate an initial navigation path, predicting the distribution range of potential collision areas, adjusting the path based on the distribution range, and determining the turning points of the initial path includes: Acquire surrounding environmental data; Based on the boundary of the interference area and the surrounding environment data, a map mapping operation is performed to construct a unified environmental map containing the interference area and obstacles. Based on the unified environment map, a global path search is performed to generate an initial navigation path; Based on the initial navigation path and the sheep's movement speed data, the distribution range of potential collision areas is predicted. Based on the distribution range of the potential collision areas, the initial navigation path is adjusted to determine the initial path turning points.

5. The path planning method for sheep farm robots based on ant colony algorithm according to claim 1, characterized in that, For the initial path turning point, dynamic obstacle identification is performed. If an obstacle enters the monitoring range, the local map update frequency is increased and the path is adjusted to obtain a corrected turning point, including: The area surrounding the initial path turning point is continuously scanned. If an obstacle is detected entering the scanning range, the update frequency of the local map is increased, and the location of the obstacle is obtained. Based on the location of the obstacle, the initial path turning point is adjusted to obtain the corrected turning point.

6. The path planning method for sheep farm robots based on ant colony algorithm according to claim 1, characterized in that, The process of evaluating the interference around the correction inflection point to obtain the environmental interference intensity, and generating speed control commands to dynamically adjust the robot's movement speed based on the environmental interference intensity, thereby obtaining a safe travel strategy, includes: The local sheep movement speed and local obstacle distribution density in the area surrounding the corrected turning point are obtained. Based on the local sheep movement speed and local obstacle distribution density, the environmental disturbance intensity in the area surrounding the corrected turning point is calculated. Based on the intensity of the environmental interference, calculate the speed control command; Based on the speed control command, the robot's movement speed is smoothly and dynamically adjusted to obtain a safe travel strategy.

7. The path planning method for sheep farm robots based on ant colony algorithm according to claim 1, characterized in that, The safe travel strategy is executed while path deviation is detected. If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory, including: The safe travel strategy is executed while real-time positioning is performed to obtain the robot's actual position, and the path deviation between the robot's actual position and the expected path in the safe travel strategy is calculated. If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory.

8. The path planning method for sheep farm robots based on ant colony algorithm according to claim 1, characterized in that, The process of guiding robot navigation through the optimized execution trajectory involves recording environmental changes and continuously updating the boundary of the interference area during movement. If a change in the boundary of the interference area is detected, the local map update frequency is adjusted and the navigation path is further optimized to generate an adaptive navigation scheme, including: The robot navigation is guided by the optimized execution trajectory. During the journey, environmental changes are recorded and the boundary of the interference area is continuously updated to obtain the updated boundary of the interference area. If a change in the boundary of the updated interference area is detected, the local map update frequency is adjusted, the adjusted update frequency is determined, the local map is updated, and the route is replanned to obtain an adaptive navigation scheme.

9. A path planning system for a sheep farm robot based on ant colony optimization, characterized in that, include: The image acquisition and preprocessing module is used to acquire real-time images of the target area of ​​the sheep farm and the location distribution of the sheep flock, perform image segmentation on the real-time images, and extract the contours of dynamic obstacles. The interference region division module is used to calculate the sheep's movement speed based on the sheep's location distribution, generate an environmental interference distribution map based on the sheep's movement speed and the outline of the dynamic obstacle, divide the environmental interference distribution map into a grid, and extract the boundaries of the interference region. The turning point generation module is used to perform a global path search using an ant colony algorithm based on the boundary of the interference area, generate an initial navigation path, predict the distribution range of potential collision areas, adjust the path according to the distribution range, and determine the turning point of the initial path. The turning point correction module is used to dynamically identify obstacles at the initial path turning points. If an obstacle is detected entering the monitoring range, the local map update frequency is increased and the path is adjusted to obtain the corrected turning point. The travel strategy generation module is used to evaluate the interference around the correction turning point, obtain the environmental interference intensity, and generate speed control commands to dynamically adjust the robot's moving speed based on the environmental interference intensity, thereby obtaining a safe travel strategy. The trajectory optimization module is used to execute the safe travel strategy and detect path deviation. If the path deviation exceeds a preset deviation threshold, the local route is updated to obtain an optimized execution trajectory. The adaptive navigation module is used to guide the robot's navigation through the optimized execution trajectory. It records environmental changes and continuously updates the boundary of the interference area during movement. If a change in the boundary of the interference area is detected, the local map update frequency is adjusted and the navigation path is optimized again to generate an adaptive navigation scheme.