A method and system for automatically compensating for drift in a weeding scenario, and a storage medium
By installing an inertial measurement unit and an adaptive Kalman filter algorithm on the weeding machine, combined with vision and multi-sensor fusion technology, the problem of insufficient control accuracy of the vision row system on slopes was solved, and high-precision weeding operations were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 深圳市纬尔科技有限公司
- Filing Date
- 2026-03-03
- Publication Date
- 2026-06-02
AI Technical Summary
Existing vision-based row weeding systems struggle to achieve high-precision control on sloping terrain, causing the weeding blades to deviate from their intended row positions, potentially damaging seedlings and failing to adapt to the undulating terrain of actual farmland.
An inertial measurement unit (IMU) is installed on the weeding machine. The ground slope angle is measured in real time by combining an adaptive Kalman filter algorithm. The lateral offset between the top of the seedling strip and the root is calculated. The row control and multi-sensor fusion verification are combined with visual reference to realize automatic compensation of the slope.
It achieves high-precision, adaptive weeding control on slopes, reduces tool positioning deviation and the risk of damaging seedlings, and improves the system's adaptability and operational accuracy.
Smart Images

Figure CN122131766A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent control and machine vision technology for agricultural machinery, and specifically discloses a method, system and storage medium for automatic slope compensation in a weeding scenario. Background Technology
[0002] Currently, the common method of mechanical weeding is to attach weeding implements to the back of a tractor, such as... Figure 2 As shown, this implement contains multiple weeding units for different furrows or ridges. Each unit is equipped with weeding blades that are close to the crop. All units are connected by a crossbeam mechanism. During operation, the tractor pulls the weeding implement along the crop rows and weeds by turning the soil. However, this method has obvious drawbacks: during sowing operations (even mechanical sowing), the tractor is difficult to maintain a completely straight line. The sown crop appears slightly curved when viewed from a distance. During weeding, whether manual driving or automatic navigation is used, the tractor is difficult to travel completely along the sowing trajectory and will produce a certain lateral deviation. This deviation will cause the weeding blades to deviate from the predetermined row position, thereby scratching the crop.
[0003] To address this, the industry has introduced visual-assisted row weeding systems, such as... Figure 3 As shown, this system uses a visual sensor to detect the position of the seedling strip relative to the implement, and controls the implement's lateral movement accordingly, allowing the blades to accurately sweep across the rows or furrows for precise weeding. The system performs well in flat fields. The positional relationships between the sensor, blades, crops, and the ground are shown in the diagram. Figure 4 As shown. However, when the land is tilted (slope), such as Figure 5 As shown, the system performance degrades significantly because the camera is usually mounted in the middle of the blades and directly facing the top of the crop. When there is a left or right slope on the ground, the relative position of the camera and the top of the crop changes. If the blade movement is still calculated according to the flat ground control strategy, it will lead to blade positioning deviation, affecting the weeding effect and potentially damaging the seedlings. Therefore, the existing technology lacks a real-time perception and compensation mechanism for the slope of the plot, which leads to a decrease in the control accuracy of the visual row weeding system in sloping scenarios and makes it unable to adapt to the common terrain undulations in actual farmland. Summary of the Invention
[0004] The purpose of this invention is to provide an automatic slope compensation method, system, and storage medium for weeding scenarios, which realizes automatic row compensation of weeding equipment on sloping terrain and effectively solves the problem of high seedling damage rate in existing systems on sloping terrain.
[0005] The objective of this invention can be achieved through the following technical solutions:
[0006] This application provides an automatic slope compensation method for weeding scenarios, including the following steps:
[0007] S1. Equipment configuration and attitude perception: An inertial measurement unit is installed on the crossbeam of the weeding machine or at the camera mounting position parallel to the crossbeam.
[0008] The camera is installed parallel to the crossbeam, and the crossbeam remains parallel to the ground during operation.
[0009] S2. Real-time slope angle measurement: The inertial measurement unit acquires the roll angle, i.e., the slope angle, which represents the degree of left and right tilt of the ground, in real time; the slope angle data is continuously output at a preset frequency.
[0010] S3. Calculation of lateral offset: Based on the pre-determined average height of the seedling strip and the slope angle measured in real time, calculate the horizontal lateral offset on the ground between the top and root of the seedling strip caused by the slope; the horizontal lateral offset is the product of the average height of the seedling strip and the sine of the slope angle; wherein, the average height h of the seedling strip is the distance from the root to the top of the seedling measured in advance.
[0011] S4. Visual reference row control: In flat terrain, the camera captures images and identifies the position of the top of the seedling strip, calculates its first lateral visual deviation relative to the camera's central axis, and controls the weeding blade and the entire camera to move laterally by a distance equal to the first lateral visual deviation, so that the camera's central axis is aligned with the top of the seedling strip.
[0012] S5. Slope compensation control: When a slope is detected on the ground, the first lateral visual deviation is subtracted from the horizontal lateral offset to obtain the second lateral control value; the weeding blade and camera are controlled to move laterally according to the second lateral control value to achieve automatic compensation for slope operations.
[0013] Furthermore, after acquiring the roll angle, which represents the left and right tilt of the ground in real time, the method also includes: using an adaptive Kalman filter algorithm to fuse the angular velocity and acceleration information output by the inertial measurement unit, and combining the machine's forward speed to dynamically filter the high-frequency noise caused by vibration.
[0014] Furthermore, the adaptive Kalman filter algorithm specifically includes: using roll angle angular velocity and angle as system state variables, using triaxial acceleration and angular velocity measured in real time by the inertial measurement unit as the main observations, and introducing real-time forward speed information provided by the machine's walking encoder or GPS module to construct system state equations and observation equations, and adaptively adjusting filter parameters by monitoring the filter residuals.
[0015] Furthermore, before calculating the horizontal lateral offset between the top of the seedling strip and the root on the ground caused by the slope, the specific steps include: determining the validity of the slope angle; if its absolute value is less than a preset threshold, then setting the horizontal lateral offset to zero.
[0016] Furthermore, in step S3, the average height of the seedling strip is a dynamically adjustable parameter, specifically including: using a camera combined with the principle of monocular vision geometry to estimate the height of the seedling strip in real time during operation, and updating the average height of the seedling strip by sliding average.
[0017] Furthermore, after calculating the horizontal lateral offset between the top of the seedling strip and the root on the ground due to the slope, the calculation also includes: dynamic smoothing of the offset.
[0018] The dynamic smoothing of the bias includes introducing a first-order low-pass filter or a moving average window to smooth the continuously calculated horizontal bias sequence.
[0019] Furthermore, step S4 specifically includes:
[0020] S41. Adaptive optimization of image preprocessing: Automatically adjusts camera exposure parameters and gain according to ambient light intensity, and performs real-time affine transformation correction on the image based on the current slope angle θ.
[0021] S42. Visual detection and deviation calculation of the top of the seedling strip: The preprocessed image is analyzed using a deep learning model to locate the pixel coordinates of the top of the seedling strip, and the pixel deviation is calculated as the first lateral visual deviation x according to the camera calibration parameters.
[0022] S43, Execution of line control: The first lateral visual deviation x is input to the motion controller, and the controller outputs a control signal to drive the lateral actuator, thereby moving the tool and camera as a whole.
[0023] Furthermore, in step S43, the motion controller is a PID controller or a fuzzy controller.
[0024] Furthermore, after automatic compensation for slope operations, it also includes: multi-sensor fusion verification processing;
[0025] The multi-sensor fusion verification process, after completing the compensation control, re-acquires images through the camera and performs closed-loop verification by combining IMU data with the actual lateral movement of the tool. If the error exceeds the limit, the fusion estimator is triggered to recalculate the optimal compensation amount.
[0026] An automatic slope compensation system for weeding scenarios is used to implement an automatic slope compensation method for weeding scenarios, comprising: an inertial measurement unit, installed on the crossbeam of the weeding implement or at a camera installation position parallel to the crossbeam, for real-time acquisition of the attitude data of the implement, including at least the roll angle characterizing the left and right tilt of the ground;
[0027] The slope angle measurement module is communicatively connected to the inertial measurement unit and is used to continuously receive and process the raw data output by the inertial measurement unit at a preset frequency, and output the real-time slope angle.
[0028] The lateral offset calculation module is connected in communication with the slope angle measurement module and obtains the average height of the seedling strip that is pre-stored or measured in real time, which is used to calculate the horizontal lateral offset between the top of the seedling strip and the root caused by the slope.
[0029] The vision alignment control module includes a camera, an image processing unit, and a motion controller. The image processing unit is used to identify the position of the top of the seedling strip by acquiring images in a flat environment and to calculate the first lateral visual deviation. The motion controller is used to drive the lateral actuator according to the first lateral visual deviation, thereby moving the weeding blade and the camera as a whole to achieve alignment.
[0030] The slope compensation module is communicatively connected to the lateral offset calculation module and the visual alignment control module, respectively. When a slope is detected on the ground, the module subtracts the horizontal lateral offset from the first lateral visual deviation to generate a second lateral control value, which is then output to the motion controller.
[0031] The lateral actuator, electrically connected to the motion controller, is used to respond to control signals and drive the weeding blades and camera as a whole to move laterally.
[0032] A storage medium storing a computer program / instructions, which, when executed by a processor, implements the steps of the automatic slope compensation method in the weeding scenario.
[0033] The beneficial effects of this invention are as follows:
[0034] This invention solves the fundamental problem of existing vision-based row observation systems failing when operating on slopes due to a lack of high-precision, interference-resistant real-time slope perception capabilities by adding an inertial measurement unit (IMU) to the weeding machine and using an adaptive Kalman filter algorithm. It achieves stable and accurate measurement of the left and right tilt angles of the ground (slope angle θ), providing a reliable core input for the entire compensation system.
[0035] By employing a geometric model-based lateral offset calculation, combined with dynamic height correction and smoothing, and integrating robust depth visual recognition and adaptive image preprocessing, this method solves the problems of separation between the visual observation point (top of the seedling strip) and the weeding target point (root of the seedling strip) due to changes in slope and seedling height in complex farmland environments, as well as the problem of image quality being affected by environmental interference. It achieves accurate calculation of theoretical deviations and establishes a high-precision visual row reference control capability on flat ground.
[0036] By subtracting the slope offset from the visual control input to generate the final execution command, and introducing a multi-sensor fusion verification process, the core approach of this technology has solved the problems of tool positioning deviation and seedling damage caused by the unchanged control strategy in sloping terrain, as well as the problem of error accumulation that may occur in a single compensation. This enables the weeding machine to intelligently and accurately align with the root zone of the seedlings on both flat and sloping terrain, significantly improving the system's adaptability to terrain, operational accuracy, and long-term reliability. Attached Figure Description
[0037] To better understand and implement this application, the technical solution is described in detail below with reference to the accompanying drawings.
[0038] Figure 1 This is a flowchart illustrating an automatic slope compensation method for weeding scenarios provided in Embodiment 1 of this application.
[0039] Figure 2 One of the schematic diagrams illustrating the background technology in an automatic slope compensation method for weeding scenarios provided in this application;
[0040] Figure 3 The second schematic diagram of the background technology in the automatic slope compensation method for weeding scenarios provided in this application;
[0041] Figure 4 The third schematic diagram of the background technology in the automatic slope compensation method for weeding scenarios provided in this application;
[0042] Figure 5 Schematic diagram four of the background technology in the automatic slope compensation method for weeding scenarios provided in this application;
[0043] Figure 6 This is one of the schematic diagrams of Embodiment 1 of the automatic slope compensation method for weeding scenarios provided in this application;
[0044] Figure 7 This is a second schematic diagram of Embodiment 1 of the automatic slope compensation method for weeding scenarios provided in this application;
[0045] Figure 8 This is the third schematic diagram of Embodiment 1 of the automatic slope compensation method for weeding scenarios provided in this application. Detailed Implementation
[0046] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, exemplary embodiments will be described in detail below, examples of which are illustrated in the accompanying drawings. In the following description, when referring to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.
[0047] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used herein are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0048] The following detailed description of the specific implementation methods, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided in detail.
[0049] Example 1, please refer to Figure 1 This embodiment provides an automatic slope compensation method for weeding scenarios, including the following steps:
[0050] S1. Device configuration and attitude perception: such as Figure 6 As shown, an inertial measurement unit (IMU) is installed on the weeding machine at the camera mounting position on the crossbeam or parallel to the crossbeam.
[0051] The camera is usually mounted parallel to the crossbeam, which is kept parallel to the ground during operation.
[0052] S2. Real-time slope angle measurement: The inertial measurement unit acquires the roll angle, i.e., the slope angle, which represents the degree of left and right tilt of the ground, in real time; the slope angle data is continuously output at a preset frequency.
[0053] The roll angle is calculated by the components of the gravitational acceleration of the IMU device on each axis, or it can be directly obtained by installing an IMU device that outputs three-axis angles; the slope angle is denoted as θ and is output in real time at a frequency of 100Hz.
[0054] Furthermore, after acquiring the roll angle, which represents the left and right tilt of the ground in real time, the method also includes: using an adaptive Kalman filter algorithm to fuse the angular velocity and acceleration information output by the IMU, and combining the machine's forward speed (which can be obtained through an encoder or GPS) to dynamically filter the high-frequency noise caused by vibration, thereby improving the measurement stability and reliability of the slope angle θ during movement.
[0055] Furthermore, dynamic filtering is applied to the high-frequency noise caused by vibration. Specifically, this includes using roll angle, angular velocity, and angle as system state variables, and real-time triaxial acceleration and angular velocity measured by the IMU as the main observables. Simultaneously, real-time forward speed information provided by the machine's travel encoder or GPS module is introduced to construct the system state equation and observation equation. By introducing forward speed information, the interference of centripetal acceleration caused by machine turning on the lateral acceleration measurement can be estimated and subtracted, thereby effectively separating the terrain slope signal and kinematic noise in the IMU output. The algorithm monitors the filtering residue in real time. The statistical characteristics of the residual (i.e., the difference between the observed value and the predicted value) are used to adaptively adjust the Kalman filter parameters when an abnormal increase in residual is detected (indicating increased vibration of the equipment or an impact). This reduces the confidence weight of the dynamic model prediction, enabling the system to quickly track the actual slope changes. During the smooth driving phase, the smoothness of the filter is enhanced to suppress high-frequency vibration noise to the greatest extent. Through this adaptive prediction and update recursive process, a stable and accurate real-time ground slope angle θ is finally calculated and output from the original IMU data containing strong vibration noise, providing a reliable basis for the core compensation control.
[0056] Specifically, by employing an adaptive Kalman filter algorithm, fusing the angular velocity and acceleration information output by the inertial measurement unit (IMU), and combining it with the machine's forward speed to construct a state observation model, the serious interference problem caused by vibration, bumps, and turning motion during machine movement to the original IMU signal is effectively solved. This enables the real-time extraction of accurate ground slope angle θ from a high-frequency (e.g., 100Hz) environment with high stability, providing reliable and robust core sensing data for subsequent automatic slope compensation control.
[0057] S3. Calculation of lateral offset: Based on the pre-determined average height of the seedling strip and the slope angle obtained in real time, calculate the horizontal lateral offset on the ground between the top of the seedling strip and the root due to the slope; the horizontal lateral offset is the product of the average height of the seedling strip and the sine of the slope angle.
[0058] Wherein, the average height h of the seedling strip is the distance from the base of the seedling to the top, measured in advance, such as... Figure 7 As shown; when the camera is directly facing the top of the seedling strip, the lateral offset is calculated using the formula offset = h × sinθ.
[0059] Furthermore, the horizontal offset between the top and root of the seedling strip on the ground caused by the slope is calculated. Specifically, this includes: synchronously receiving the real-time slope angle θ and calling the stored average height h of the seedling strip; before calculation, the slope angle is judged for validity; if its absolute value is less than a preset threshold (e.g., 0.5°), the offset is directly set to zero to avoid meaningless adjustments in flat conditions; then, dynamic height correction is performed by using a camera combined with monocular vision geometry to estimate the height of the seedling strip in real time during operation, and updating the preset average height h by a moving average, so that the system can adapt to crop growth or changes in different fields; finally, to meet the real-time control requirements, the sinθ value is quickly calculated for common operating slope ranges (e.g., -15° to +15°) using a lookup table method or CORDIC algorithm, thereby efficiently and accurately completing the offset calculation.
[0060] Furthermore, after calculating the horizontal lateral offset between the top of the seedling strip and the root on the ground due to the slope, the calculation also includes: dynamic smoothing of the offset.
[0061] The dynamic smoothing of the offset includes introducing a first-order low-pass filter or a moving average window to smooth the continuously calculated offset sequence, avoiding jumps in the compensation amount due to instantaneous fluctuations in the slope angle θ, and ensuring the smoothness and agronomic adaptability of the lateral compensation control.
[0062] Specifically, by establishing an offset and integrating various technical means such as validity judgment, dynamic height correction, fast sine calculation, and filtering and smoothing, the core problem of how to accurately, stably, and adaptively convert real-time perceived slope angle and seedling height information into a lateral offset that can be directly used for control compensation was solved. Ultimately, this provides an accurate, stable, and adaptive basis for compensation in subsequent slope compensation control, which is a key calculation link for achieving precise row alignment.
[0063] S4. Visual reference row control: In flat terrain, the camera captures images and identifies the position of the top of the seedling strip, and calculates its first lateral visual deviation relative to the camera's central axis; the weeding blade and the entire camera are controlled to move laterally by a distance equal to the first lateral visual deviation, so that the camera's central axis is aligned with the top of the seedling strip.
[0064] Specifically, a deep learning algorithm is used to detect the pixel position of the seedling top in the image, and based on the pre-calibrated intrinsic and extrinsic parameters of the camera, the pixel deviation of the first lateral visual deviation is converted into an actual physical distance deviation x (x is positive if the seedling is deviated to the right, and negative if it is deviated to the left); the movement distance x between the cutter and the camera is controlled, such as... Figure 8As shown, if the deviation of the seedling from the camera center is x, then the blade and camera are moved by x. If x is positive, the blade moves to the right; if x is negative, the blade moves to the left. This ensures that the camera's central axis always approaches the top of the seedling strip, and the blade then slices through the seedling strip to achieve the purpose of weeding.
[0065] Furthermore, step S4 specifically includes:
[0066] S41. Image preprocessing adaptive optimization: The integrated ambient light intensity sensor monitors the light intensity in real time and inputs it into a preset exposure control model. This model first matches the baseline exposure time and gain according to the light intensity range (e.g., strong light, normal light, weak light). Then, it performs closed-loop fine-tuning by combining the histogram statistics (average brightness, contrast) of the real-time acquired images. If the image is overexposed, the exposure time and gain are automatically reduced; if the image is too dark, they are appropriately increased. At the same time, the algorithm prioritizes the local brightness stability of the seedling strip area. The entire process is completed within milliseconds, ensuring that the seedling strip image with clear details and moderate brightness can be output under any lighting conditions, providing high-quality input for subsequent recognition.
[0067] S42. Visual detection and deviation calculation of the seedling strip tip: A lightweight deep learning model (such as MobileNetV3 with channel attention mechanism combined with keypoint detection head) is used to analyze the preprocessed image in real time to accurately locate the pixel coordinates of the seedling strip tip. This model has been trained with data augmentation including different lighting, growth stages, backgrounds, and simulated slope distortion, and has strong robustness.
[0068] After obtaining the pixel coordinates, the system performs distortion correction based on the pre-calibrated camera intrinsic parameters (focal length, principal point) and distortion coefficients. Then, combined with the known camera installation height and optical axis pitch angle, the pixel deviation of the top of the seedling strip relative to the center line of the image is calculated as the lateral physical distance deviation on the actual ground plane through the perspective projection geometric inverse transformation model, which is denoted as the first lateral visual deviation x (x>0 indicates that the seedling strip is biased to the right, and x<0 indicates that it is biased to the left).
[0069] S43. For line control execution, the first lateral visual deviation x is input to the motion controller (e.g., a PID controller or a fuzzy controller). The controller dynamically calculates and outputs a control signal based on the magnitude and trend of the deviation x.
[0070] If a PID controller is used, its proportional, integral, and derivative terms act on the current deviation, historical cumulative deviation, and deviation change rate, respectively, and the weighted sum is used to generate the control signal. If a fuzzy controller is used, the deviation x and its change rate are fuzzified, reasoned based on a preset rule base, and then defuzzified to obtain the precise control quantity.
[0071] Finally, the control signal is sent to the driver of the horizontal electric actuator or hydraulic servo system via analog voltage, current or CAN bus, driving the weeding blade, which is rigidly connected to the camera, to move laterally by a distance |x|. The direction of movement is determined by the sign of x (positive right, negative left). Through this closed-loop control, the camera optical axis is kept aligned with the top of the seedling strip, thereby ensuring that the blade moves precisely between the rows of seedling strips.
[0072] Specifically, by employing a combination of technologies such as adaptive image preprocessing, deep learning-based precise detection of seedling strip tips, camera calibration and geometric calculation, and closed-loop motion control, the technical challenge of how to obtain the position of seedling strips in real time and stably and drive the cutter to accurately align between rows in complex farmland environments was solved. Ultimately, fully automatic and high-precision row alignment of the weeding machine was achieved on flat ground, establishing a stable and reliable benchmark control capability for the entire system and providing accurate visual deviation input for subsequent slope compensation.
[0073] S5. Slope compensation control: When a slope is detected on the ground, the first lateral visual deviation is subtracted from the horizontal lateral offset to obtain the second lateral control value; the weeding blade and camera are controlled to move laterally according to the second lateral control value to achieve automatic compensation for slope operations.
[0074] Specifically, when the ground slope θ is detected by the IMU, the flat ground control quantity x is subtracted from the lateral offset quantity offset to obtain the final control quantity x - offset, and this is used to control the lateral movement of the tool and the camera.
[0075] Furthermore, after automatic compensation for slope operations, it also includes: multi-sensor fusion verification processing;
[0076] The multi-sensor fusion verification process includes, after completing one slope compensation control operation, re-acquiring images through the camera to verify whether the seedling roots are near the camera's central axis; simultaneously, combining real-time slope data from the IMU with the actual lateral movement of the cutter for closed-loop verification. If the error exceeds a set threshold, a particle filter-based fusion estimator is triggered to recalculate the optimal compensation amount, achieving closed-loop correction of multi-source information from slope, vision, and execution, thereby improving the system's long-term operational stability and reliability under complex slope conditions.
[0077] Specifically, by integrating the control quantity obtained from visual detection on flat ground with the theoretical bias quantity based on slope, and introducing a multi-sensor closed-loop verification mechanism, the problem of tool positioning deviation and seedling damage caused by the lack of target correction in existing vision-based row alignment systems on slopes is solved. By fusing the perception and calculation results of the preceding steps, the control target is intelligently corrected from aligning with the top of the seedling strip to aligning with the root of the seedling strip. By verifying and re-estimating the execution results, the weeding machine is finally able to perform adaptive, high-precision, and high-reliability row alignment operations under complex slope conditions, fundamentally solving the industry problem of weeding on slopes.
[0078] An automatic slope compensation system for weeding scenarios is used to implement an automatic slope compensation method for weeding scenarios, comprising: an inertial measurement unit, installed on the crossbeam of the weeding implement or at a camera installation position parallel to the crossbeam, for real-time acquisition of the attitude data of the implement, including at least the roll angle characterizing the left and right tilt of the ground;
[0079] The slope angle measurement module is communicatively connected to the inertial measurement unit and is used to continuously receive and process the raw data output by the inertial measurement unit at a preset frequency, and output the real-time slope angle.
[0080] The lateral offset calculation module is connected in communication with the slope angle measurement module and obtains the average height of the seedling strip that is pre-stored or measured in real time, which is used to calculate the horizontal lateral offset between the top of the seedling strip and the root caused by the slope.
[0081] The vision alignment control module includes a camera, an image processing unit, and a motion controller. The image processing unit is used to identify the position of the top of the seedling strip by acquiring images in a flat environment and to calculate the first lateral visual deviation. The motion controller is used to drive the lateral actuator according to the first lateral visual deviation, thereby moving the weeding blade and the camera as a whole to achieve alignment.
[0082] The slope compensation module is communicatively connected to the lateral offset calculation module and the visual alignment control module, respectively. When a slope is detected on the ground, the module subtracts the horizontal lateral offset from the first lateral visual deviation to generate a second lateral control value, which is then output to the motion controller.
[0083] The lateral actuator, electrically connected to the motion controller, is used to respond to control signals and drive the weeding blades and camera as a whole to move laterally.
[0084] A storage medium storing a computer program / instructions, which, when executed by a processor, implements the steps of the automatic slope compensation method in the weeding scenario.
[0085] Example 2 provides another method for automatic slope compensation in a weeding scenario. It employs active 3D sensing technology to directly acquire the true 3D position of the seedling roots on the undulating terrain surface, thereby achieving direct row control in absolute spatial coordinates. Specific steps include:
[0086] T1. Multimodal sensor configuration: On the crossbeam of the weeding implement, near the traditional monocular camera, a LiDAR and / or replace the monocular camera with a set of rigorously calibrated binocular stereo vision cameras; the LiDAR is used to actively scan the terrain ahead and generate a high-density 3D point cloud; the binocular cameras are used to passively acquire the depth information of the scene through parallax calculation.
[0087] T2. Real-time Terrain Reconstruction and Slope Extraction: Using LiDAR or a binocular vision system, real-time 3D point cloud data of the ground in front of the work area is acquired. The point cloud is filtered and segmented to extract the bare ground point cloud without crops or other obstacles. Using these ground point clouds, a continuous 3D model of the ground in front of the current equipment is reconstructed in real time through plane fitting (such as the RANSAC algorithm) or triangulation. The normal vector or tilt plane equation of the ground model in the lateral direction is directly calculated, thereby obtaining accurate local slope information. This slope information comes directly from the 3D geometric reconstruction, rather than being indirectly calculated through inertial devices.
[0088] T3. Three-dimensional spatial localization of seedling roots: Using synchronous images acquired by a binocular stereo vision system, an optimized deep learning model (such as a model specifically trained for crop stem and root detection) is used in the left (or right) image to directly detect feature points or regions at the boundary between the seedling roots and the ground surface. Thanks to the stereo matching capability of the binocular system, the system can directly calculate the precise three-dimensional spatial coordinates (X_root, Y_root, Z_root) of the feature point on the three-dimensional ground model reconstructed in step T2 based on the pixel coordinates of the feature point in the left and right images and the forward intersection principle; here, Y_root is the true horizontal position of the seedling roots under the current terrain.
[0089] T4. Direct Motion Control Based on 3D Coordinates: The control system knows the installation position and attitude of the camera (or sensor cluster) in the implement coordinate system. Based on the 3D coordinates (X_root, Y_root, Z_root) of the seedling root calculated in step T3, combined with the global pose of the implement provided by a real-time positioning and attitude determination system (such as a GNSS / INS integrated navigation system), the controller can calculate the lateral absolute offset that the weeding blade needs to move to align with the root position. The controller directly uses this absolute offset as the target to drive the lateral actuator to move, so that the 3D spatial trajectory of the blade tip is aligned with the 3D spatial position of the seedling root. This process does not require distinguishing between control quantities and offset quantities; the control target is a clearly defined 3D spatial point.
[0090] T5. 3D Scene Matching and Closed-Loop Verification: After a control action, the newly scanned local terrain point cloud by the lidar and the new location of the seedlings observed by binocular vision can be matched and compared with the scene predicted before the action was executed. By comparing the differences between the expected terrain and the actual terrain, and between the expected seedling position and the actual seedling position, the control effect can be verified. If the deviation exceeds the limit, the terrain model and seedling position prediction can be corrected in real time using the real 3D data observed this time, and compensation can be made in the next control cycle to form a closed-loop control system based on real feedback from the 3D environment.
[0091] Specifically, by directly perceiving the three-dimensional world and locating key targets, it avoids the cumulative errors that may arise from two-dimensional assumptions and model derivations in principle, making it particularly suitable for scenarios with complex terrain and uneven crop heights.
[0092] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for automatic slope compensation in a weeding scenario, characterized in that, Includes the following steps: S1. Equipment configuration and attitude perception: An inertial measurement unit is installed on the crossbeam of the weeding machine or at the camera mounting position parallel to the crossbeam. The camera is installed parallel to the crossbeam, and the crossbeam remains parallel to the ground during operation. S2. Real-time slope angle measurement: The inertial measurement unit acquires the roll angle, i.e., the slope angle, which represents the degree of left and right tilt of the ground, in real time; the slope angle data is continuously output at a preset frequency. S3. Calculation of lateral offset: Based on the pre-determined average height of the seedling strip and the slope angle obtained in real time, calculate the horizontal lateral offset on the ground between the top of the seedling strip and the root due to the slope; the horizontal lateral offset is the product of the average height of the seedling strip and the sine of the slope angle. The average height of the seedling strip is the distance measured from the base of the seedling to the top. S4. Visual reference row control: In flat terrain, the camera captures images and identifies the position of the top of the seedling strip, calculates its first lateral visual deviation relative to the camera's central axis, and controls the weeding blade and the entire camera to move laterally by a distance equal to the first lateral visual deviation, so that the camera's central axis is aligned with the top of the seedling strip. S5. Slope compensation control: When a slope is detected on the ground, the first lateral visual deviation is subtracted from the horizontal lateral offset to obtain the second lateral control value; the weeding blade and camera are controlled to move laterally according to the second lateral control value to achieve automatic compensation for slope operations.
2. The method for automatic slope compensation in a weeding scenario according to claim 1, characterized in that, After acquiring the roll angle, which represents the left and right tilt of the ground in real time, the method further includes: using an adaptive Kalman filter algorithm to fuse the angular velocity and acceleration information output by the inertial measurement unit, and combining the machine's forward speed to dynamically filter the high-frequency noise caused by vibration.
3. The method for automatic slope compensation in a weeding scenario according to claim 2, characterized in that, The adaptive Kalman filter algorithm specifically includes: using roll angle angular velocity and angle as system state variables, using triaxial acceleration and angular velocity measured in real time by inertial measurement unit as the main observations, and introducing real-time forward speed information provided by machine travel encoder or GPS module to construct system state equation and observation equation, and adaptively adjusting filter parameters by monitoring filter residuals.
4. The method for automatic slope compensation in a weeding scenario according to claim 1, characterized in that, Before calculating the horizontal lateral offset between the top of the seedling strip and the root on the ground caused by the slope, the specific steps include: determining the validity of the slope angle; if its absolute value is less than a preset threshold, then setting the horizontal lateral offset to zero.
5. The method for automatic slope compensation in a weeding scenario according to claim 4, characterized in that, In step S3, the average height of the seedling strip is a dynamically adjustable parameter, specifically including: using a camera combined with the principle of monocular vision geometry to estimate the height of the seedling strip in real time during operation, and updating the average height of the seedling strip by sliding average.
6. The method for automatic slope compensation in a weeding scenario according to claim 1, characterized in that, After calculating the horizontal lateral offset between the top of the seedling strip and the root on the ground due to the slope, the following is also included: dynamic smoothing of the offset. The dynamic smoothing of the bias includes introducing a first-order low-pass filter or a moving average window to smooth the continuously calculated horizontal bias sequence.
7. The method for automatic slope compensation in a weeding scenario according to claim 1, characterized in that, Step S4 specifically includes: S41. Adaptive optimization of image preprocessing: Automatically adjusts camera exposure parameters and gain according to ambient light intensity, and performs real-time affine transformation correction on the image based on the current slope angle θ. S42. Visual detection and deviation calculation of the top of the seedling strip: The preprocessed image is analyzed using a deep learning model to locate the pixel coordinates of the top of the seedling strip, and the pixel deviation is calculated as the first lateral visual deviation x according to the camera calibration parameters. S43, Execution of line control: The first lateral visual deviation x is input to the motion controller, and the controller outputs a control signal to drive the lateral actuator, thereby moving the tool and camera as a whole.
8. The method for automatic slope compensation in a weeding scenario according to claim 7, characterized in that, In step S43, the motion controller is a PID controller or a fuzzy controller.
9. An automatic slope compensation system for weeding scenarios, used to implement the method described in any one of claims 1 to 8, characterized in that, include: An inertial measurement unit is installed on the crossbeam of the weeding implement or at a camera mounting position parallel to the crossbeam, for real-time acquisition of the implement's attitude data, including at least the roll angle, which characterizes the degree of left and right tilt of the ground. The slope angle measurement module is communicatively connected to the inertial measurement unit and is used to continuously receive and process the raw data output by the inertial measurement unit at a preset frequency, and output the real-time slope angle. The lateral offset calculation module is connected in communication with the slope angle measurement module and obtains the average height of the seedling strip that is pre-stored or measured in real time, which is used to calculate the horizontal lateral offset between the top of the seedling strip and the root caused by the slope. The vision alignment control module includes a camera, an image processing unit, and a motion controller. The image processing unit is used to identify the position of the top of the seedling strip by acquiring images in a flat environment and to calculate the first lateral visual deviation. The motion controller is used to drive the lateral actuator according to the first lateral visual deviation, thereby moving the weeding blade and the camera as a whole to achieve alignment. The slope compensation module is communicatively connected to the lateral offset calculation module and the visual alignment control module, respectively. When a slope is detected on the ground, the module subtracts the horizontal lateral offset from the first lateral visual deviation to generate a second lateral control value, which is then output to the motion controller. The lateral actuator, electrically connected to the motion controller, is used to respond to control signals and drive the weeding blades and camera as a whole to move laterally.
10. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the automatic slope compensation method for weeding scenarios as described in any one of claims 1 to 8.