### 2.1 Structure of Height Control System

Figure 1 shows the schematic of the proposed height control system, which consists of signal acquisition device, control system, hydraulic system and lifting mechanism. The signal of height is obtained via the angle sensor installed on the signal acquisition device. Then the signal of height is used to govern the electro-hydraulic servo valve. The hydraulic cylinder controlled by electro-hydraulic servo valve is used as the power sector of lifting mechanism. With cylinder controlled by valve to lift the spindles of the cotton picker, it can avoid spindles colliding with stones on the cotton field.

### 2.2 Modeling of the Lifting Mechanism

The diagram of lifting mechanism of the height control system is shown in Figure 2. Line *AB* represents the hydraulic cylinder. Point *B* and point *C* are articulated on the frame of the spindle cotton picker corresponding to the installation position. *L*_{1} represents the total length of the hydraulic cylinder, *L*_{2} is the length of articulated rod *AC*, *L*_{3} is the installation position on the frame, and *L*_{4} is the distance of picking head centroid from articulated point *A*. *L*_{1} can be further expressed as follows:

$$L_{1} = L_{0} + L,$$

(1)

where *L*_{0} and *L* represent cylinder length and piston displacement of the hydraulic cylinder, respectively.

For convenience of analyzing the dynamics of the lifting mechanism, it is simplified to an equivalent diagram as shown in Figure 3. Then, the dynamic model of the equivalent lifting mechanism is formulated as follows:

$$A_{1} P_{1} - A_{2} P_{2} = M\frac{{{\text{d}}^{2} L}}{{{\text{d}}t^{2} }} + B\frac{{{\text{d}}L}}{{{\text{d}}t}} + F_{L} ,$$

(2)

where \(A_{1}\) is the area of the end face of piston, \(A_{2}\) is the effective area of the piston in cylinder chamber with piston, *P*_{1} is the input oil pressure of the chamber without piston, *P*_{2} is the pressure of chamber with piston, *M* is the equivalent mass of the lifting mechanism, *t* is the elapsed time of the lifting mechanism from starting to move to the end of lifting, *B* is viscous damping coefficient of the piston, \(F_{L}\) is the external load of the lifting mechanism.

Equivalent mass *M* is calculated based on the theory that kinetic energy of the equivalent lifting mechanism is equal to the original lifting mechanism. Mass of hydraulic cylinder, piston and articulated rod *AC* is negligible compared to the mass of picking unit. Besides, velocity of hydraulic cylinder, piston and articulated rod *AC* is same order of magnitude with velocity of picking unit. So kinetic energy of hydraulic cylinder, piston and articulated rod *AC* is ignored. Equivalent mass *M* is calculated based on the following Eq. (3):

$$\frac{1}{2}M\dot{L}^{2} = \frac{1}{2}m\left( {\dot{x}^{2} + \dot{y}^{2} } \right),$$

(3)

where *m* is the mass of picking unit, \(m = {G \mathord{\left/ {\vphantom {G g}} \right. \kern-\nulldelimiterspace} g}\), *G* is gravitational force of picking unit, *g* is gravitational acceleration, \(\dot{x}\) and \(\dot{y}\) are two components of barycenter velocity of picking unit. \(x\) and \(y\) are calculated as follows:

$$\left\{ \begin{aligned} x & = \left( {L_{2} + L_{4} } \right)\sin \alpha , \\ y & = L_{3} - \left( {L_{2} + L_{4} } \right)\cos \alpha , \\ \end{aligned} \right.$$

(4)

$$\alpha = \arccos \left( {\frac{{L_{2}^{2} + L_{3}^{2} - L_{1}^{2} }}{{2L_{2} L_{3} }}} \right).$$

(5)

External load \(F_{L}\) is calculated as shown in Eq. (6):

$$F_{L} = G\frac{{{\text{d}}y}}{{{\text{d}}L}}.$$

(6)

Based on Eqs. (1)‒(6), the dynamic model of the equivalent lifting mechanism is expressed as follows:

$$\begin{aligned} \frac{{\uppi }}{4}D^{2} P_{1} - \frac{{\uppi }}{4}\left( {D^{2} - d^{2} } \right)P_{2} & { = }\frac{{4L_{1}^{2} \left( {L_{2} + L_{4} } \right)^{2} }}{{4L_{2}^{2} L_{3}^{2} - \left( {L_{2}^{2} + L_{3}^{2} - L_{1}^{2} } \right)^{2} }}\frac{G}{g}\frac{{{\text{d}}^{2} L}}{{{\text{d}}t^{2} }} \\ & \quad + B\frac{{{\text{d}}L}}{{{\text{d}}t}}{\kern 1pt} {\kern 1pt} {\kern 1pt} + \frac{{G\left( {L_{2} + L_{4} } \right)\left( {L_{0} + L} \right)}}{{L_{2} L_{3} }}. \\ \end{aligned}$$

(7)

The lifting mechanism of the height control system realizes the lifting function of the picking unit by extending the piston of the hydraulic cylinder. Thus, it can prevent the spindle from being bended in the collision with stones and metals. In Figure 4, point *A* is the articulation of the hydraulic cylinder and the picking unit. When the articulation is in the state of point *A*, the picking unit works in the normal position. The piston of the hydraulic cylinder does not extend and its stroke is zero. When the piston of the hydraulic cylinder moves to point *A*_{1}, the picking unit is lifted. In this process, the profile height *h* can be calculated as:

$$h = \frac{{L^{2} + 2L_{0} L}}{{2L{}_{3}}}.$$

(8)

When the surface of cotton field changes, the angle variation of profiling slider is detected by the angle sensor. The angle sensor transmits the angle variation into the controller. The controller will output signal to make the piston rod of the hydraulic cylinder to extend out. The profile height *h* of the lifting mechanism is determined by the angle change of the angle sensor, which can be modelled as shown in Eq. (9):

$$h = l\Delta \theta ,$$

(9)

where *l* is the distance between angle sensor and touchpoint of the profiling slide, Δ*θ* is the angle change of angle sensor.

### 2.3 Modeling of the Hydraulic Control System

When the hydraulic fluid is pumped into the cylinder of the height control system, the hydraulic pressure will force the piston to move back and forth. The displacement and speed of the hydraulic cylinder is determined by the opening size of the electro-hydraulic servo valve. Therefore, the height and rising speed of the picking unit are adjusted by the electro-hydraulic servo valve. In order to achieve precise position tracking control, a PID controller, which is widely used in various industries due to its high reliability and robustness [28,29,30,31], is adopted to control the electro-hydraulic servo valve.

As shown in Figure 5, the input of the PID controller is Δ*U*, whose value is the difference between the actual displacement signal *U*_{2} and the input displacement signal *U*_{1}. After a proportional, integral and differential processing of the PID controller, the new displacement signal *U* is the output. Then the displacement signal *U* is converted into control current *I* of the electro-hydraulic servo valve by the servo amplifier. The transfer function of the servo amplifier is expressed in Eq. (10):

$$\frac{I}{U} = \frac{{K_{A} \omega_{A} }}{{s + \omega_{A} }},$$

(10)

where *K*_{A} is the amplification factor of servo amplifier, *ω*_{A} is the natural frequency of the amplifier.

The control current *I* of the electro-hydraulic servo valve controls the displacement of the valve core, thus resulting in the change of valve opening, and finally realizing the control of the flow *q*_{v} of the electro-hydraulic servo valve. The transfer function of the electro-hydraulic servo valve is [32]:

$$\frac{{q_{v} }}{I} = \frac{{K_{sv} \omega_{sv}^{2} }}{{s^{2} + 2\xi_{sv} \omega_{sv} s + \omega_{sv}^{2} }},$$

(11)

where *K*_{sv} is the gain of the electro-hydraulic servo valve, *ω*_{sv} is the natural frequency of the amplifier, *ξ*_{sv} is the damping ratio of the electro-hydraulic servo valve.

When the output fluid of the electro-hydraulic servo valve flows into the hydraulic cylinder, the piston of the hydraulic cylinder will extend out of the cylinder block. So that the picking unit will be lifted to the position of the height required by the system. The transfer function of the hydraulic cylinder is:

$$\frac{L}{{q_{v} }} = \frac{{K_{h} \omega_{h}^{2} }}{{s\left( {s^{2} + 2\xi_{h} \omega_{h} s + \omega_{h}^{2} } \right)}},$$

(12)

where *K*_{h} is the gain of hydraulic cylinder, *ω*_{h} is the natural frequency of hydraulic cylinder, *ξ*_{h} is the damping ratio of hydraulic cylinder.

When the displacement *L* of the piston rod is detected by the sensor installed on the hydraulic cylinder, it will be converted into actual displacement signal. The difference between the actual displacement signal and the input displacement signal are sent into the PID controller to adjust the displacement of the piston of the hydraulic cylinder. The transfer function of the displacement sensor is:

$$\frac{{U_{2} }}{L} = \frac{{K_{se} \omega_{se} }}{{s + \omega_{se} }},$$

(13)

where *K*_{se} is the gain of displacement sensor, *ω*_{se} is the natural frequency of displacement sensor.