# Trajectory Classification and Recognition of Planar Mechanisms Based on ResNet18 Network
## 2 Sample Construction
### Construction of Samples for Hyperboloid Crank Hinge Five-Bar Mechanism  
Hinge five-bar mechanisms are two-degree-of-freedom components with complex motion patterns and flexible control characteristics, playing a crucial role in engineering and the field of mechanics. The hyperboloid crank hinge five-bar mechanism, in particular, is widely used for its advantages such as precision in motion and good control performance, making it suitable for a broad range of applications. The structure diagram is shown in Figure 4.  
Figure 4: Hinge five-bar mechanism model diagram. (**a**) Class A. (**b**) Class B.  
Hinge five-bar mechanisms are two-degree-of-freedom components with complex motion patterns and flexible control characteristics, playing a crucial role in engineering and the field of mechanics. The hyperboloid crank hinge five-bar mechanism, in particular, is widely used for its advantages such as precision in motion and good control performance, making it suitable for a broad range of applications.  
The construction of a hyperboloid crank rocker mechanism needs to satisfy the link length scale requirements of classification for Formula (3), i.e., the sum of the two shortest links must be less than or equal to the longest link's length added to the sum of the other two links.  
\[l_{min1}+l_{min2}+l_{max}\leq m+n \tag{3}\]  
Planar five-bar mechanisms that satisfy Equation (3) are referred to as Type I mechanisms. Figure 4a,b depict two common Type I mechanisms, known as Class A and Class B. In Class A mechanisms, neither of the two shortest links serves as both the frame and input components, preventing the mechanism from forming a two-crank or three-crank structure. Therefore, the two shortest links cannot function as connecting rods. In Class B mechanisms, one of the two shortest links serves as the frame, or both links can be input components.  
For both Class A and Class B five-bar mechanisms, it is necessary to solve for \(\varphi_{2}\) and \(\varphi_{3}\), and the solution process is similar to that of four-bar mechanisms.  
For Class A mechanisms, the calculation reveals that  
\[\varphi_{2}=2 tan^{-1}(\frac{B_{0}\pm\sqrt{A_{0}^{2}+B_{0}^{2}-C_{0}^{2}}}{A_{ 0}+C_{0}})\]  
\[A_{0}=2b(e+dcos\varphi_{4}-acos\varphi_{1})\]  
\[B_{0}=2b(dsin\varphi_{4}-asin\varphi_{1})\]  
\[C_{0}=b^{2}-c^{2}+(e+dcos\varphi_{4}-acos\varphi_{1})^{2}+(dsin\varphi_{4}-asin \varphi_{1})^{2}\]  
where the positive configuration is denoted by '\(+\)' and the inverted configuration is denoted by '\(-\)'. So, for Class A mechanisms, the trajectory of point P can be obtained using Equation (4).  
\[\begin{cases}x_{P}=acos\varphi_{1}+fcos(\alpha+\varphi_{2})\\ y_{P}=asin\varphi_{1}+fsin(\alpha+\varphi_{2})\end{cases} \tag{4}\]  
Similarly, for Class B mechanisms, there is  
\[\varphi_{3}=2 tan^{-1}\left(\frac{B_{0}\pm\sqrt{A_{0}^{2}+B_{0}^{2}-C_{0}^{2}} }{A_{0}+C_{0}}\right)\]  
\[A_{0}=2c(e-acos\varphi_{1}-bcos\varphi_{2})\]  
\[B_{0}=2c(-asin\varphi_{1}-bsin\varphi_{2})\]  
\[C_{0}=(e-acos\varphi_{1}-bcos\varphi_{2})^{2}+(-asin\varphi_{1}-bsin\varphi_{ 2})^{2}+c^{2}-d^{2}\]  
So, for Class B mechanisms, the trajectory of point P can be obtained using Equation (5).  
\[\begin{cases}x_{P}=acos\varphi_{1}+bcos\varphi_{2}+fcos(\alpha+\varphi_{3})\\ y_{P}=asin\varphi_{1}+bsin\varphi_{2}+fsin(\alpha+\varphi_{3})\end{cases} \tag{5}\]  
The samples of the hyperboloid crank hinge five-bar mechanism include three classes. When the transmission ratio of the two actuators is 1, the ranges of various parameters are limited to \(0<(a,b,c,d,e,f)\leq 1,\ 0\leq\alpha\leq 2\pi\). And the coordinate axis of the image is set to \((-3,3)\). When the speeds of the two actuators have different ratios, the resulting trajectory images will also be different. In this experiment, we only study the special case where the speed ratio of the two actuators is 1:1. In this case, samples are generated using both Class A and Class B mechanisms.