# Path Optimization of Two-Posture Manipulator of Apple Packing Robots
## 3 Materials and Methods
### Path Optimization Method for the Manipulator of Apple Packing Robots
#### 3.2.2 Kinematic Analysis of the Manipulator  
The manipulator is a self-made two-link manipulator, as shown in Figure 2.  
As shown in Figure 2, Joint 1 of the manipulator is fixed at the center of the pedestal, enabling Link 1 of the manipulator to rotate horizontally with the central axis of the pedestal, which is regarded as the datum line within the rotation range. Links 1 and 2 are connected by Joint 2. Link 2 can also rotate horizontally with the axis of rotating Joint 2, regarded as the datum line, which is similar to Link 1. The sliding of the end effector of the manipulator is accomplished with the reciprocating movement of the cylinder. The manipulator has two rotatory joints in the horizontal direction and one sliding joint in the vertical direction. The combination of the three joints enables the manipulator to move freely in the 3D coordinate system \((x,y,z)\). This study focuses on the optimization of the motion trajectory of the manipulator, and it does not involve the motion of the gripper device. The design of the gripper device, and the calculation and analysis of the gripping force, will be carried out in future work.  
The kinematics of the manipulator are analyzed to clearly describe the position relationship between the end effector and each link [31; 32]. Kinematic analysis is the premise and basis of the joint motion and path optimization of the manipulator. The kinematics of the manipulator are analyzed using a geometric method because the number of links of the manipulator is small, and the rotatory joints are all in the horizontal direction. A rectangular coordinate system is established, with the central point of the pedestal as the origin, and the geometric analysis model is shown in Figure 3.  
Figure 3: Geometric analysis model.  
Figure 2: Manipulator of the apple packing robot.  
As shown in Figure 3, the equation for acquiring the coordinates (\(x\), \(y\)) of the end effector of the manipulator is shown in Equation (1).  
\[\begin{cases}x=\textit{link2-cos}(\theta_{1}+\theta_{2})+\textit{link1-cos} \theta_{1}\\ y=\textit{link2-sin}(\theta_{1}+\theta_{2})+\textit{link1-sin}\theta_{1} \end{cases}, \tag{1}\]  
where \(\theta_{1}\) and \(\theta_{2}\) are the joint rotation angles of Links 1 and 2, respectively, and _link1_ and _link2_ are the lengths of Links 1 and 2. For the convenience of calculation, joint rotation angles \(\theta_{1}\) and \(\theta_{2}\) are positive when the arm rotates counterclockwise and are negative when the arm rotates clockwise. Every rotatory joint has two different postures when the end effector of the manipulator reaches any point within the rotation range because the manipulator is a horizontal rotating structure, as shown in Figure 4. The shape of the apple is approximately spherical, and it is approximately circular in all directions in the horizontal plane. The resulting change in end effector orientation does not affect the grasp of the apple when the manipulator is in different postures. Therefore, two values of \(\theta_{1}\) and \(\theta_{2}\) are found for the coordinates of any points in the rotation range, as shown in Equation (2).  
\[\begin{cases}\theta_{1}=\textit{across}\left[\frac{x\cdot\textit{link1+x- link2-cos}\theta_{2}+y\cdot\textit{link2-sin}\theta_{2}}{x^{2}+y^{2}}\right]\\ \theta_{2}=\pm\textit{arccos}\left[\frac{x^{2}+y^{2}-\textit{link1+2-link2} ^{2}}{2\cdot\textit{link1-link2}}\right]\end{cases}, \tag{2}\]  
where (\(x,y\)) are the coordinates of the end effector within the rotation range of the manipulator. Based on the actual working range, the range of \(\theta_{1}\) is [30\({}^{\circ}\), 150\({}^{\circ}\)] and that of \(\theta_{2}\) is [\(-\)120\({}^{\circ}\), 120\({}^{\circ}\)]. The length of the two-link horizontal manipulator is 750 mm. The lengths of _link1_ and _link2_ are 400 and 350 mm, respectively.