*4.2. Design of Algorithm for Undamaged Harvesting*

The two-stage "Holding-Rotating" picking strategy was used to achieve fast and undamaged picking. During the holding stage, when the gripper clamps the fruit with the minimum gripping force, the constrain part stops. *α* was set to the value of the sensor output corresponding to the minimum holding force. During the rotation stage, the gripper is rotated to separate the fruit from the stalk. In case of a slip, the constraint part advances, the fingers are closed, and the clamping force is increased to prevent sliding. The rotation of the gripper is realized by the DC motor. The running time of the DC motor was set to *tM*. The rising increment was set to *γ*, which was used as the direct judgment indicator of slip. It is shown in Equation (20). *ρ* was set to the number of incremental successive occurrences.

$$
\gamma = VMR(i+1) - VMR(i) \tag{20}
$$

When *γ* occurs *ρ* times, it is judged to have produced slip. Let the forward distance of the constraint part be *l* when slip occurs. Based on multi-group clamping test, when *α* = 30, *γ* = 0.1, *ρ* = 3, *tM* = 0.5 s, and *l* = 0.5 mm, it had a better judging and gripping effect. Therefore, according to the two-index judgment, the grabbing index *α* and the slide index *γ*, the control algorithm of the two-stage and two-index was designed for fast, stable, and undamaged harvesting of small fruits. The flow chart of control algorithm is shown in Figure 14.

**Figure 14.** Flow chart of control algorithm.
