1. Introduction
Garlic (
Allium sativum L.) is a widely grown vegetable seasoning with both edible and medicinal values [
1,
2,
3,
4]. Studies have shown that garlic consumption can effectively reduce the risk of diseases such as hypertension and diabetes [
5,
6]. In addition to its disease-preventive properties, garlic has antibacterial, anti-inflammatory and insecticidal properties [
7,
8,
9,
10]. The organosulfur compounds and polyphenols contained in garlic give it a unique flavor [
11]. Garlic is one of the most important flavoring vegetables in the world [
12], and China is the number one producer of garlic in the world [
13]. At present, garlic harvesting in China is dominated by manual harvesting, and the technological level of mechanized harvesting equipment is low, which hinders the development of the Chinese garlic industry.
Root cutting is an essential process in garlic harvesting. Since the roots of freshly emerged garlic are entrapped within moist soil, failure to remove the roots will result in moldy or even rotting bulbs. Garlic that has been rooted will also look better, which will increase its selling price. Usually, garlic heads vary in size, there are differences in the location of the roots, garlic heads have different postures in the soil, and garlic heads can be watery and have thin skins. Due to their biological characteristics, garlic and garlic roots are easy to dehydrate, which reduces their toughness, meaning that the technical difficulty involved in mechanized root-cutting operations is high. Moreover, cutting the bulb can easily lead to pathogen invasion, causing food safety problems [
14,
15,
16], and garlic root cutting is mainly carried out manually with a low production efficiency. To improve production efficiency and control food safety, there is an urgent need for garlic harvesters that can realize high-quality root-cutting functions.
At present, garlic harvesters are mainly digging and spreading types or the combined-harvesting type. The combined-harvesting-type garlic harvester can carry out the functions of vibration digging, clamping and conveying, cutting stems, throwing seedlings, and garlic collection and storage at the same time [
17,
18,
19,
20,
21]. The HZ1 garlic harvester from the YANMAR company in Japan includes a root-cutting function in the process of combined harvesting. It uses a double-disk cutter to cut the garlic root continuously, but the height of the double-disk cutter cannot be adjusted, which has led to the emergence of the problem that the garlic roots cannot be cut cleanly [
17,
22]. In the mechanized garlic harvesting process, the height of the root knife in the root-cutting device can be adjusted according to differences in the size of the garlic heads; the height of the root-cutting knife in the root-cutting device can be adjusted to improve the rate of cutting the garlic roots cleanly, which is referred to as an adaptive root-cutting technology. The research on adaptive root cutting in garlic harvesters is still in the exploratory and experimental stages [
23,
24]. Z. Yu et al. [
25] developed a floating garlic root-cutting mechanism with a spiral guard fence and a return plate spring, which improved the rate of clean garlic root cutting by increasing the number of root-cutting channels. J. Hou et al. [
26] designed a press-type root cutting device to cut the garlic root under the action of a clamping conveyor mechanism and a disk knife, which realized garlic root disk alignment and garlic root cutting through the rotation of a paddle wheel and the deformation of a press. K. Yang et al. [
27,
28,
29] utilized machine vision and deep learning technology to detect the demarcation line between the garlic bulb and root, move the disk root-cutting knife to the corresponding position according to the detection result, and realize adaptive garlic root cutting based on image recognition technology on a test bench. However, due to the harvester’s high functional integration, complexity, efficiency, and compactness [
30,
31,
32,
33,
34,
35,
36], arranging the adaptive garlic root-cutting system on the harvester and performing the harvesting operation pose significant challenges.
Machine vision and deep learning technologies have been heavily applied to study the information perception aspect of improving the intelligence of harvesters. Q. Zhang et al. [
37] acquired image information through the camera installed on a wheat harvester and used the YOLO algorithm and an onboard deep learning system to predict the harvester’s feeding volume and realize the closed-loop control of intelligent harvesting operations. Z. Guan et al. [
36] used a rice harvester’s camera on the seed sampling device to achieve continuous image acquisition, proposed an impurity recognition algorithm based on Mask R-CNN, and evaluated the impurity detection system through bench and field tests. A. Nasirahmadi et al. [
38] positioned a camera above the cleaning turbine of the beet harvester to acquire images in real time when the harvester was cleaning the beets and through a deep learning system developed based on CNN to detect beet damage in the harvester automatically. W. Yang et al. [
39] installed a camera, edge computing equipment, and related supporting equipment on a dig-and-pull cassava harvester, utilized the improved YOLO algorithm to detect cassava stalks in the field in real time, and adjusted the position of the harvester’s clamping and pulling mechanism to align the stalks according to the results of the detection, thus reducing harvesting losses.
Aimed at the problem that existing garlic harvesters do not have an adaptive root-cutting function and the root-cutting quality is low, this study developed a garlic harvester with an adaptive root-cutting function. Combining theoretical analysis, bench tests, field tests, and other methods, we study the adaptive root-cutting process of the garlic harvester conveyor assembly on the role of garlic plants, garlic plant attitude adjustment, root force, and other dynamic characteristics; explore the adaptive root-cutting system matching, quality-influencing factors, and mechanism optimization scheme; provide a reference for the garlic harvester’s function and technology improvement.
2. Materials and Methods
2.1. 4DSL-7 Garlic Harvester
Relying on the National Natural Science Foundation of China (NSFC) project, the National Key R&D Program and the Jiangsu Modern Agricultural Machinery Equipment and Technology Demonstration and Promotion Project, Nanjing Agricultural Mechanization Research Institute of the Ministry of Agriculture and Rural Affairs of China (NAMRI) has developed the 4DLB-2 garlic harvester (Nanjing Institute of Agricultural Mechanization, Ministry of Agriculture and Rural Affairs, Nanjing, China), which can harvest two rows at a time, and the 4DSL-7 garlic harvester (Nanjing Institute of Agricultural Mechanization, Ministry of Agriculture and Rural Affairs, Nanjing, China), which can harvest seven rows at a time. The 4DSL-7 garlic harvester (shown in
Figure 1) mainly consists of the following components: profiling depth-limiting wheel, splitter, vibrating digging shovel, clamping and conveying device, aligning and cutting seedling mechanism, seedling and fruit collecting and transmitting device, scraper lifting and conveying device, fruit box (which can be unloaded backward), chassis walking mechanism, and so on. Among them, garlic plant sorting alignment, fruit and seedling separation, and seedling and fruit collection and delivery are a vital operation link and key technology. Alignment of seedling cutting mechanism and seedling and fruit collection and delivery device of the structure and operation parameter setting directly determine the operational performance of the machine.
The core component of the 4DSL-7 garlic harvester, the structure of the conveyor alignment assembly, is shown in
Figure 2, which mainly consists of a hydraulic motor, clamping conveyor chain, harvesting table welding frame, sorting-alignment device, transmission system, etc. Usually, each conveyor alignment assembly completes one row of garlic harvesting, which can be installed in 3 to 7 groups. Usually, each conveyor alignment assembly completes harvesting one row of garlic, and the prototype of a 4DSL-7 garlic harvester can be installed with 3–7 sets of assemblies to harvest 3–7 rows of garlic at one time. During operation, after the garlic plants are dug out of the soil, they are clamped by the clamping conveyor chain and transported backward (the direction of transport is shown by the blue arrow in
Figure 2). The garlic plants are aligned along the upper surface of the bulb (as indicated by the yellow arrow in
Figure 2). The garlic plants’ position is adjusted by the joint action of the clamping conveyor chain and the toggle finger chain of the sorting-aligning device. Based on bulb alignment, the final separation of the fruit and seedling is realized with the help of a stem-cutting device.
The conveyor alignment assembly realizes bulb alignment along the upper surface by forced expansion using an inclined configuration between the gripping conveyor chain and the toggle finger chain of the sorting-aligning device. By changing the speed ratio of the gripping conveyor chain and the toggle finger chain, the position of the garlic plant can be adjusted when the bulbs are aligned along the upper surface so that the adjustment of the position of the garlic plant and the alignment of the bulbs along the upper surface can be accomplished in the front or middle section of the sorting-aligning device. At the same time, when the bulb is aligned along the upper surface, the clamping conveyor chain applies a lifting force in the direction of the garlic bulb, which will cause the upper surface of the bulb to rest on the lower part of the two adjacent fingers of the toggle finger chain, similar to the state of holding the bulb in the hand when cutting the root manually. The force of the bulb is shown by the red arrows in
Figure 2. The realization of the above functions allows for adaptive root cutting in garlic.
When a garlic harvester is in operation, the elongation of the traveling wheels determines the initial clamping height of the clamping conveyor chain on the garlic plant, and the initial clamping height of the garlic plant influences the initial position on the sorting-alignment device at the which alignment of the bulbs along the upper surface is accomplished. The initial clamping height of the garlic plant needed to satisfy the bulb alignment along the upper surface was determined by harvesting tests in the pre-tests of the field trials to obtain a suitable amount of traveler wheel elongation, which will not be repeated in this text. Thus, the garlic plant position adjustment and bulb alignment along the upper surface are only related to the speed ratio of the clamping conveyor chain and the finger-toggle finger chain.
2.2. Speed Relationship Between Clamp Conveyor Chain and Toggle Finger Chain
To study the change rule of garlic plant position in the conveyor alignment assembly, to ensure that the garlic plant is perpendicular to the plane of the toggle finger chain, and to realize the alignment of the upper surface of the bulb during the subsequent root-cutting operation, it is necessary to analyze the speed of the clamping conveyor chain VJC and the speed of the toggle finger chain VBZ. Let the ratio of clamping conveyor chain speed VJC and toggle finger chain speed VBZ be KX.
In
Figure 3,
αE is the angle between the garlic plant and the clamping conveyor chain (°);
βA is the angle between the garlic plant and AD (°);
γBC is the angle between the clamping conveyor chain and the toggle finger chain (°); point A is the front rotating center of the toggle finger chain; and point B is the initial position of completing the bulb alignment along the upper surface. The distance between points A and B is
lAB, mm. Points D and C are the projection points on the clamping conveyor chain in the vertical direction of points A and B along the sorting-alignment device. The projection point on the clamping conveyor chain, the distance between points D and C is
lCD, mm; when the garlic plant enters the sorting-aligning device at an angle of
αE with the clamping conveyor chain, the initial clamping point of the garlic plant on the clamping conveyor chain is point E. The distance between points D and E is
lDE, mm; between points A and D is
lAD, mm; and between points BC is
lBC, mm.
The distance
lCD between the projection points of points A and B along the plane normal to the plane in which the toggle finger chain is located on the clamping conveyor chain is:
The angle
γBC between the clamping conveyor chain and the toggle finger chain is:
In Equations (1) and (2), lAB is the action distance of the sorting-alignment device when the garlic plant is perpendicular to the plane in which the toggle finger chain is located, mm; lAD is the projection distance along the plane of the toggle finger chain where point A is located in the expected direction on the clamping conveyor chain, mm; lBC is the projection distance along the plane of the toggle finger chain where point B is located in the expected direction on the clamping conveyor chain, mm.
When the garlic harvester is in operation, the angle of inclination of the conveyor alignment assembly is different, and the angle
αE between the garlic plant and the clamping conveyor chain after shoveling and pulling out the soil will be different. To realize that the cutting surface of the cut root is perpendicular to the garlic plant, it is required that the garlic plant is perpendicular to the plane where the toggle finger chain is located when the root is cut. Effective matching of the speed ratio between the clamping conveyor chain and the toggle finger chain of the sorting-alignment device ensures that the garlic plant is perpendicular to the plane of the toggle finger chain, so it is necessary to study the ratio of the speed of the clamping conveyor chain,
VJC, and the speed of the toggle finger chain,
VBZ, to be
KX. To facilitate this study, it is assumed that the digging depth of the excavation shovel is unchanged, the tilt angle of the conveyor alignment assembly is unchanged, and the corresponding angle
αE between the garlic plant and the clamping conveyor chain is also a definite value. Point A is the initial point of action of the toggle finger chain, and the BC line is the target conveying position. Then, the ratio of the speed of the clamping conveyor chain
VJC and the speed of the toggle finger chain
VBZ is
KXIn the above formula, VJC is the speed of the clamping conveyor chain, m/s; VBZ is the speed of the toggle finger chain, m/s; lCD is the distance between the projection points on the clamping conveyor chain along the plane of the toggle finger chain where points A and B are located in the expected direction, mm; lDE is the amount of adjustment of the sorting-alignment device on the clamping conveyor chain on the clamping point of the garlic plant, mm; lAB is the role of the sorting-alignment device when the garlic plant is perpendicular to the plane of the toggle finger chain, mm. distance, mm.
In the above equation, lAD is the projection distance of point A along the normal direction of the plane where the finger-pulling chain is located on the clamping conveyor chain, mm; βA is the angle between the garlic plant and AD (°); αE is the angle between the garlic plant and the clamping conveyor chain (°).
From the triangular relationship
In the above formula, γBC is the clamping conveyor chain and toggle finger chain angle (°).
Equations (3)–(5) can be obtained by the association of
From the above equation, when
KX satisfies Equation (6), it can be ensured that the garlic plant is perpendicular to the plane where the toggle finger chain is located when cutting the roots [
40,
41]. Equation (6) also shows that the distance
lCD between the projection points, the projection distance
lAD, the distance
lAB, the angle
αE between the garlic plant and the clamping conveyor chain, and the angle
γBC between the clamping conveyor chain and the toggle finger chain are the common influencing factors. The ratio
KX of the speed
VJC of the clamping conveyor chain and the speed
VBZ of the finger-pulling chain is determined; i.e., it affects the adjustment of the position of the garlic plant by the sorting-alignment device.
It is the ability of the conveyor alignment assembly to realize the positional adjustment of the garlic plant and the alignment of the upper surface of the bulb that makes it possible to realize adaptive root cutting for a garlic harvester. However, the conveyor alignment assembly is compact. It has no extra installation space, and its structure needs to be modified to arrange a machine vision-based adaptive root-cutting system for garlic harvesters.
2.3. Cutting Device Design and Research
To meet the need for adaptive root cutting, a cutting device containing a camera, a cutting device, and a stepper motor for position adjustment is designed. As shown in
Figure 4, the cutting device mainly includes a cutter with a connecting piece, a lifting arm, a micro switch, a stationary seat, a dual-out shaft stepper motor, a clearing servo, a clearing rocker arm, a camera, a damping tension spring, etc. Among them, four lifting arms of equal length, a fixed seat, and a cutter with a connector form a parallel four-bar mechanism. The line between the rotation centers of the upper lifting arm and the lower lifting arm mounted on the fixed seat is perpendicular to the lower bottom surface of the fixed seat. A damping spring increases the lifting force of the parallel four-bar mechanism, and a dual-out shaft stepper motor (KEMING Motor, 57MM44A100, Wenzhou, China) provides the driving force for the two lower lifting arms. A microswitch (Omron, SS-5GL2, Kyoto, Japan) is used to reset the lifting arm; the camera (KINGCENT, KS1A14, Shenzhen, Guangdong, China) has a high-definition 1.0 megapixel and a 60° lens. To address the problem of dust that can cover the camera lens during harvesting, a dirt-clearing rocker arm with a brush was designed to erase the dirt from the transparent lens guard. A servo powers the clearing arm.
When the lower lifting arm triggers the microswitch, the angle of rotation of the dual-out shaft stepper motor is recorded as 0°, at which time all four lifting arms are parallel to the lower bottom surface of the stationary base; when the cutting device completes the reset, and the optical axis of the camera passes through the plane where the circular knife disk of the cutting device is located, the angle of rotation of the dual-out shaft stepper motor is recorded as
αDJ (°), as shown in
Figure 5. When the dual-out shaft stepper motor makes the first root-cutting rotation to adjust the cutting device’s height, the rotation angle is Δ
α1 (°). Then, the angle turned by the dual-out shaft stepper motor is:
where
θ1 is the angle, in °, that the dual-out shaft stepper motor turns relative to the position of the lower lifting arm, triggering the microswitch.
The distance between the two rotation centers of the upper and lower lifting arms is equal, expressed in lJS, mm.
When
θ1 >
αDJ, the height of movement of the cutting device relative to the lower bottom surface of the stationary base is:
When
αDJ >
θ1, the cutting device moves a height relative to the lower bottom surface of the stationary base:
In Equations (8) and (9), Δh’1 is the height of the cutting device relative to the lower bottom surface of the stationary base after the first rotation of the dual-out shaft stepper motor for the cutting root, mm; lJS is the distance between the two rotating centers of the lifting arm, mm. Moreover, the cutting device raises Δh’1 when θ1 > αDJ, and the cutting device decreases Δh’1 when αDJ > θ1.
For the n′ + 1st rotation (n′∈N+) of a dual-out shaft stepper motor as a tangent root, there is:
where
θn′+1 is the angle of rotation of the dual-out shaft stepper motor concerning the bottom surface of the stationary base after the n′ + 1st rotation of the dual-out shaft stepper motor cut the root (°);
θn′ is the angle of rotation of the dual-out shaft stepper motor concerning the bottom surface of the stationary base after the n′th rotation of the dual-out shaft stepper motor to cut the root (°);
Δθn′+1 is the n′ + 1st rotation angle of the dual-out shaft stepper motor to cut the root (°).
When
θn′+1 ˃
θn′, the height of movement of the cutting device concerning the lower bottom surface of the stationary base after the n′ + 1st rotation of the dual-out shaft stepper motor to cut the root is:
When
θn′ ˃
θn′+1, the height of movement of the cutting device concerning the lower bottom surface of the stationary base after the n′ + 1st rotation of the dual-out shaft stepper motor to cut the root is:
In Equations (11) and (12), Δh′n′+1 is the moving height of the cutting device relative to the lower bottom surface of the stationary base after the n′ + 1th rotation of the dual-out shaft stepper motor it cut the root, mm; lJS is the distance between the two rotating centers of the lifting arm, mm. In particular, the cutting device raises Δh′n’+1; when θn′ ˃ θn′+1, the cutting device decreases Δh′n′+1.
So far, the equations of the motion relationship between the angle of the stepper motor of the double outgoing axis in the cutting device and the change in the height of the cutting device are deduced, which lays the foundation for the design of the adaptive root-cutting control algorithm for garlic based on machine vision.
2.4. Adaptive Root-Cutting Conveyor Alignment Assembly Study
The analysis in
Section 2.2 shows that the conveyor alignment assembly can realize the positional adjustment of the garlic plant and the alignment of the upper surface of the bulb, which is a prerequisite for realizing adaptive root cutting on the garlic harvester. Due to the limited space, it is necessary to improve the existing conveyor alignment assembly to arrange the adaptive garlic root-cutting device based on machine vision. The adaptive root-cutting system for the garlic harvester proposed in this study relies on the clamping conveyor chain of the conveyor alignment assembly, the sorting-alignment device, and the harvesting table weld, and it is suggested to remove the garlic roots after completing the adjustment of the position of the garlic plant and the alignment of the upper surface of the bulb.
To carry out adaptive root cutting, the harvesting table weld of the original conveyor alignment assembly was improved, and the space under the lower part of the sorting-alignment device was enlarged without changing the overall structure of the original conveyor alignment assembly, so that the cutting device could be arranged on top of the lower beam of the harvesting table weld and ensure that its disk cutter was parallel to the plane in which the toggle finger chain was located. A laser alignment sensor was mounted on the middle beam of the harvesting table weld (LUOSHIDA, LQD-31NO, Dongguan, China); the adaptive root-cutting conveyor alignment assembly is shown in
Figure 6. For adaptive cutting root delivery alignment assembly, in the working state of the laser alignment sensor, with real-time detection of the garlic plant to arrive at the image acquisition position, the garlic plant passes through the laser alignment sensor, triggering the laser alignment sensor to send a signal to the adaptive cutting root control system, allowing the cutting device to work.
2.5. Study on the Speed Relationship Between Clamped Conveyor Chain and Toggle Finger Chain
Before cutting the roots, the sorting-alignment device of the adaptive root-cutting conveyor alignment assembly adjusts the garlic plant, as shown in
Figure 7. The red arrows in
Figure 7 indicate the conveying direction of the clamping conveyor chain and the conveying direction of the toggle finger chain, respectively. When the inclined garlic plant starts to enter the sorting-aligning device, point Z
1 is the clamping point of the clamping conveyor chain on the garlic plant, and point B
1 is the point of the toggle finger chain’s action on the garlic plant. Next, due to the difference in speeds between the speed of the clamping conveyor chain and the speed of the toggle finger chain, the garlic plant’s position is altered during the conveying process. The upper surface of the bulb is aligned. In terms of surface alignment, the upper surface of the bulb is against the lower surface of the two adjacent toggle fingers by adjusting the clamping conveyor chain speed and the speed of the toggle finger chain speed ratio, to ensure that the upper surface of the bulb is aligned perpendicular to the toggle finger chain located in the plane of the garlic plant, which triggers the laser alignment sensor. At this time, Z
2 is the clamping conveyor chain on the garlic plant of the clamping point, and the B
2 point is the toggle finger chain on the bulb of the equivalent role of the point; with the continuation of the conveying, clamping begins. As the conveying continues, the angle between the clamping conveyor chain and the toggle finger chain makes the garlic plant always subject to the tension along the stalk direction, the upper surface of the bulb is always tightly pressed against the lower surface of the two neighboring toggle fingers, and the anisotropic stalk will undergo bending and deformation, so that the centerline of the bulb can be kept perpendicular to the plane where the toggle finger chain is located under the joint action of the two neighboring toggle fingers. When the root cutting starts, the Z
3 point and the B
3 point are the clamping points of the clamping conveyor chain and the toggle finger chain, respectively, and the equivalent action point of the toggle finger chain on the bulb. Points Z
3 and B
3 are the equivalent action points of the clamping conveyor chain on the garlic plant and the toggle finger chain on the bulb, respectively, when root cutting starts.
According to the clamping conveyor chain and the toggle finger chain uniform speed, movement can be seen.
In the above equation, lZ12 is the projection in the horizontal direction of the movement distance between the garlic plant at the clamping points Z1 and Z2, mm; lZ23 is the projection in the horizontal direction of the movement distance between the garlic plant at the clamping points Z2 and Z3, mm; lB12 is the projection in the horizontal direction of the distance between the point of action of the finger-toggle finger chain on the garlic plant, B1, and the point of action of the finger-toggle finger chain on the bulb equivalent action point, B2, mm; and lB23 is the projection in the horizontal direction of the distance between the finger-toggle finger chain is the projection in the horizontal direction of the distance between the equivalent action point B2 of the toggle finger chain on the bulb and the equivalent action point B3 of the toggle finger chain on the bulb, mm.
After the sorting-alignment device process to adjust the position of the garlic plant, it is necessary to study the speed ratio between the speed of the clamping conveyor chain and the speed of the toggle finger chain to realize the completion of the alignment of the upper surface of the bulb perpendicular to the plane of the toggle finger chain of the garlic plant, triggering the laser alignment sensor.
From Equation (6) and
Figure 7b, the ratio
KG between the speed of the gripping conveyor chain and the speed of the toggle finger chain required to achieve the triggering of the laser alignment sensor by the garlic plant perpendicular to the plane in which the toggle finger chain is located to accomplish the alignment of the upper surface of the bulb is:
where
αE is the angle between the garlic plant and the clamping conveyor chain when it enters the sequencing-alignment device (°);
γBC is the angle between the clamping conveyor chain and the finger-dialing chain (°);
lDKZ2 is the distance moved from the clamping point of the clamping conveyor chain of the garlic plant when the garlic plant is kept perpendicular to the plane where the finger-dialing chain is located to the point of action of the clamping conveyor chain of the triggering laser alignment sensor, mm;
lB1DK is the distance between the clamping point of the distance between the gripping point of the clamping conveyor chain and the point of action of the toggle finger chain when the garlic plant enters the sorting-aligning device when the garlic plant remains perpendicular to the plane in which the toggle finger chain is located, mm;
lB1B2 is the distance between the point of action of the toggle finger chain on the garlic plant and the equivalent point of action of the toggle finger chain on the bulb from the time when the garlic plant enters the sorting-aligning device to the triggering of the laser alignment sensor, mm.
Substituting the value of each distance, the angle between the clamping conveyor chain and the toggle finger chain into Equation (14), we have
where
αE is the angle between the garlic plant and the clamping conveyor chain when entering the sorting-alignment device (°).
When the harvester operates after the digging depth is fixed by adjusting the travel wheels, it can be considered that the angle
αE between the plucked garlic plant and the clamping conveyor chain is fixed. The angle
αE can be deduced from the inclination angle of the conveying alignment assembly, thus determining the ratio of the speed of the clamping conveyor chain and the speed of the toggle finger chain,
KG [
40,
41]. During harvesting operation, the inclination angle of the conveyor alignment assembly is usually 11°~34° [
13,
19,
42]. The garlic plants in the farmland are approximately perpendicular to the ground, so the deduction shows that the angle αE is 56°~79°, and the value of KG is 0.836~1.114 by substituting into Equation (15). Then,
KG takes the intermediate value of 0.975 during the combined garlic harvesting.
2.6. Garlic Adaptive Root-Cutting System Working Principle
According to the need to establish the relationship between the pixel coordinate system and the image coordinate system, the adaptive root-cutting system of the garlic harvester resets the cutting device first when it starts to work. The adaptive root-cutting conveying and aligning assembly pulls the garlic plant dug by the digging shovel out of the soil using the clamping conveyor chain. The garlic plant enters the sorting-aligning device along the clamping conveyor chain. It continues to be conveyed under the joint action of the clamping conveyor and finger-pulling chains. The clamping point moves along the direction of the garlic plant’s stem due to the structure of the clamping chain, the long bristle brush, and the garlic plant’s position being adjusted. The bulb’s upper surface is aligned under the finger-pulling chain action, and the stem is aligned with the laser alignment sensor, triggering the laser alignment sensor, and the cutting device camera takes a bulb image. The Matlab-based IRM-YOLO bulb detector [
27,
28] was converted to NVIDIA CUDA code by GPU Coder (NVIDIA, Santa Clara, CA, USA) and deployed in the edge computing device Jetson Nano. The Jetson Nano (NVIDIA, Jetson Nano(4GB), Santa Clara, CA, USA) deployed with the bulb detector detects the bulb by convolutional neural network to obtain the classification and pixel position information of the target, i.e., to obtain the pixel position information of the cutting line. Based on the cutting device’s control algorithm and the cutting line’s pixel position information, we obtain the digital command code to control the rotation angle of the dual-out shaft stepper motor. The Jetson Nano processor sends the digital command code to the STM32F103 development board (ALENTEK, Guangzhou, China) through serial communication, and the dual-out shaft stepper motor will be rotated to the corresponding angle to complete the adjustment of the cutting height under the control of the STM32F103 development board. After that, the cutting height will be adjusted, and the garlic root is removed by rotating the circular knife disk.
The IRM-YOLO bulb detection convolutional neural network model, shown in
Figure 8 [
27,
28], accurately, quickly, and reliably detects bulb targets in images with variable light and soil by learning bulb features.
Five hundred randomly selected pairs of captured bulb images constitute the test set [
27], and the confidence score of the bulb detector trained using the IRM-YOLO algorithm model is 0.98228, with an AP of 99.2%; the detection time is 0.0356 s. The detection results are shown in
Figure 9. The space the detector occupies is 24.2 MB. The detection results of IRM-YOLO are shown in
Figure 10. The results show that the proposed IRM-YOLO has excellent detection performance. Firstly, IRM-YOLO can work generally under different environmental brightness conditions without supplemental light treatment, which reduces the detection cost. Secondly, the soil adhering to the bottom of the bulb does not affect the detection performance of IRM-YOLO, which can still make correct and fast detection. Finally, IRM-YOLO is an intelligent means of detection, with the ability to predict the cutting position of bulbs of different shapes.
The detection results of the bulb target provide a basis for the cutting device to adjust the cutting height. Adaptive root cutting based on machine vision can avoid cutting bulbs and improve the clean-cutting rate of garlic roots.
2.7. System Design and Software Synergy
The adaptive root-cutting control system’s hardware consists of the edge computing device Jetson Nano, power module, camera, STM32F103 development board, laser alignment sensors, dual-out shaft stepper motor, soil clearing servo, and stepper motor driver, as shown in
Figure 11.
Edge computing device Jetson Nano is a high-performance processor developed by NVIDIA with powerful performance, compact size, and suitable for mobile equipment, with specific specifications and parameters shown in
Table 1, capable of running a variety of algorithms and AI frameworks, such as TensorFlow, Keras, PyTorch, Caffe, and other applications in the fields of image categorization, target detection, face recognition, speech processing, object recognition tracking, etc. Jetson Nano includes a rich set of peripheral interfaces, including SPI, UART, USB, etc., which are suitable for controlling many different types of peripherals, as well as a comprehensive NVIDIA JetPack SDK containing acceleration libraries for computer vision, deep learning, graphics, multimedia, and more.
Using GPU Coder, it is possible to transcode Matlab code to CUDA code, automatically cross-compile and deploy the resulting code to the Jetson Nano, and accelerate deep learning networks and other computationally intensive parts of the algorithm.
UART communication is used between the Jetson Nano and the STM32F103 development board. The baud rate is set to 115,200 b/s, and the control commands are transmitted using decimal numeric command codes, with values ranging from 0 to 199. The meanings of the numeric command codes are shown in
Table 2.
The STM32F103 development board receives the digital command code, as shown in
Table 2, to control the rotation of the dual-out shaft stepper motor. Adjusting the subdivision and setting the stepper motor drive to 5000 pulse/rev give the pulse-width-modulated signal a single pulse turn angle of 0.072°. Using STM32CubeMX and Keil5 development software, set the clock of the STM32F103ZET6 chip as 72 MHz; obtain the pulse width modulation signal period
Tmin as 0.08 ms by configuring timer, counter, and interrupt controller; and stipulate that five consecutive single pulses corresponding to 1 minimum rotational angle
αmin so that the rotation accuracy of dual-out shaft stepper motor is 0.36°, and the time consumed for one minimum rotation angle
αmin is 0.4 ms. The maximum angle range of each rotation of the dual-out shaft stepper motor is [−35.64, 35.64] (unit: °), but the actual cutting of the root is to avoid the collision of the cutting device with other parts, which restricts the range of the rotation angle of the dual-out shaft stepper motor.
2.8. Adaptive Root-Cutting Control Algorithm Design
The adaptive root-cutting control algorithm is more complex than the trial bench root-cutting control algorithm because the rotation of the dual-out shaft stepper motor of the cutting device regulates the cutting height. However, the logic of the adaptive root-cutting control algorithm is the same as that of the test bench root-cutting control algorithm. After the relationship between the pixel coordinate system and the image coordinate system is established, the rotation angle of the dual-out shaft stepper motor is calculated based on the pixel position information of the cutting line. Then, the cutting device is moved to the appropriate cutting height to cut the root.
After completing the previous root cutting, the upper computer system converts the pixel coordinates of the cutting line according to the pixel coordinates of the cutting line predicted to obtain the image coordinates of the cutting line. It feeds back to the motor control system to adjust the movement of the cutting device along the height direction. Before and after the two cuts, the movement of the cutting device along the height direction is:
where
Δhn+1 is the coordinate difference between the n + 1st cut root and the projection point of the nth cut root cutting line along the height direction in the image coordinate system, and its value is positive when the cutting device moves upward along the height direction and harmful when the cutting device moves downward along the height direction, mm:
kn is the nth predicted cut line pixel vertical coordinate;
kn+1 is the n + 1th predicted pixel vertical coordinate of the cut line;
ρh″ is the height of each pixel point in the detected image, mm/pixel.
In addition, a relationship exists when the roots are cut for the first time:
where
k0 is the pixel vertical coordinate of the cutting surface of the cutting device after completing the reset.
Based on Equations (7)–(12), (16), and (17), and pixel coordinate information of the predicted cut line position, the following equations can be obtained.
When adjusting the cutting height, the angle Δα1 of the first rotation of the dual-out shaft stepper motor is:
When
k0 >
k1, the cutting height of the cutting device should rise after the rotation of the dual-out shaft stepper motor
When
k1 >
k0, the cutting height of the cutting device should decrease after the rotation of the dual-out shaft stepper motor
When adjusting the cutting height, the angle Δαn′+1 of the n′ + 1st rotation of the dual-out shaft stepper motor is (n′∈N+):
When
kn′ >
kn′+1, the cutting height of the cutting device should rise after the dual-out shaft stepper motor is rotated.
When k
n′+1 > k
n′, the cutting height of the cutting device should decrease after the rotation of the dual-out shaft stepper motor
In Equations (18)–(21)
k0 is the pixel longitudinal coordinate of the cutting surface of the cutting device after completing the reset, 300 pixels in this paper (the camera resolution is 800 × 600 pixels);
kn′ is the n′th predicted pixel vertical coordinate of the cutting line, pixels;
kn′+1 is the n′th + 1th predicted pixel vertical coordinate of the cutting line, pixels;
αDJ is the angle of rotation of the dual-out shaft stepper motor for the completion of the rest of the cutting device (°);
Δα1 is the angle of the first rotation of the stepper motor for cutting root (°);
Δαn′+1 is the angle of the n′ + 1th rotation of the dual-out shaft stepper motor for root cutting (°);
θn’ is the angle of rotation of the dual-out shaft stepper motor relative to the lower bottom surface of the stationary base after the n′th rotation of the dual-out shaft stepper motor to cut the root (°);
lJS is the distance between the two rotation centers of the lifting arm, mm in mm.
So far, the parameter equation system between the change in the longitudinal coordinates of the pixels of the cutting line predicted by the target detection and the rotation angle of the dual-out shaft stepper motor has been established, and the adaptive root-cutting control algorithm was designed according to this parameter equation system.
It is to be noted that the number of pulse width modulation signal pulses
Nn′ is related to the rotation angle
Δαn′ of the dual-out shaft stepper motor when controlling the dual-out shaft stepper motor for the n′th root-cutting rotation as follows
The time taken for the n′th root-cutting rotation of the dual-out shaft stepper motor is
tn′In Equations (22) and (23), Δαn′ is the rotation angle of the n′th root-cutting rotation of the dual-out shaft stepper motor (°); Nn′ is the number of pulse width modulation signal pulses Nn′controlling the dual-out shaft stepper motor to perform the n′th root-cutting rotation; αmin is the minimum rotation angle of the dual-out shaft stepper motor (°); μn′ is the error in the n′th root-cutting (°); tn′ is the time consumed for the n′th tangential rotation of the dual-out shaft stepper motor, s; Tmin is the pulse width modulation signal period, s. The pulse width modulation signal period is the time required for the n′th tangential rotation of the dual-out shaft stepper motor.
The error μn′ will be small enough to eliminate the cumulative error by resetting the cutting device again since the rotation accuracy of the dual-out shaft stepper motor is 0.36°. The calibration coefficient of the adaptive root-cutting system ρh″ = 30 mm/113 pixels = 0.2655 mm/pixel was measured.
2.9. Validation of the Execution Speed of an Adaptive Root-Cutting System
The machine vision-based root-cutting function is the core of the adaptive root-cutting system. The machine vision-based adaptive root-cutting process includes the adaptive root-cutting conveyor alignment assembly for garlic plant position adjustment and bulb upper-surface alignment, the cutting line position predicted by the target detection model, the cutting height adjustment by the cutting device, and the cutting device for removing the garlic root, which requires precise coordination of multiple systems. Among them, whether the cutting height can be quickly adjusted according to the predicted cutting line position is the key to the success of adaptive root cutting. Hence, the execution speed of the adaptive root-cutting system needs to be verified.
The harvester clamping conveyor chain speed VJC is 0.75 m/s; according to
Section 2.5, it can be seen that the ratio of clamping conveyor chain speed and toggle finger chain speed
KG is 0.975, and the toggle finger chain speed
VBZ is 0.77 m/s. Generally, garlic plant spacing
lZJ is more than 110 mm [
19,
26,
42,
43,
44]. After measurement, when the adaptive root-cutting system works, the distance
lLJ from image capture to the beginning of cutting the root bulb moving along the toggle finger chain is more significant than 100 mm. Taking the minimum value of the plant distance
lZJ and the distance
lLJ of the bulb moving along the toggle finger chain
lLJ = 100 mm, the target detection model predicts that the allowable time for the position of the cutting line and the cutting device to adjust the height of the cut,
tYX, is 0.129 s.
Section 2.7 shows that the maximum value of time consumed by each dual-out shaft stepper motor rotation,
tMDJ, is 0.016 s. After testing the IRM-YOLO detection model deployed on the Jetson Nano, the detection time,
tMJC, is within 0.1 s, and by taking
tMJC = 0.1 s, the following relationship is observed:
In the formula, tMDJ is the maximum value of time consumed for each rotation of the dual-out shaft stepper motor during the operation of the adaptive root-cutting system, s; tMJC is the maximum detection time of the IRM-YOLO detection model deployed on the Jetson Nano, s; tYX is the permissible time for the target detection model to predict the position of the cutting line and for the cutting device to adjust the height of the cut, s.
Through the above analysis, it can be seen that the cutting device adopts a parallel four-bar mechanism to effectively shorten the time for executing the cutting height adjustment so that the time consumed by the target detection model for predicting the position of the cutting line and the cutting device for adjusting the cutting height is less than the allowable time. The adaptive root-cutting system can complete the root-cutting process based on the target detection of the convolutional neural network.