## 4 PCS State Analysis Module  
Once the features in the image can be effectively located, a real-time analysis of the PCS contact status can be performed, generally during train operation contact states that are mainly used for consideration include arc detection, pantograph detachment detection, center line offset detection, and pantograph pose detection. The first two are used for timely detection of existing faults, while the latter two can be used to evaluate the real-time PCS status and provide an early warning of a possible fault occurrence. Here, solutions to the analysis will be presented. Pantograph pose: According to the contact points and pantograph horn corner points, and based on the rigid structure of the slide, the pose parameters of the pantograph can be solved. First, three image points \(p^{c},p^{lh},p^{rh}\) were used to reconstruct their spatial position \(p_{3d}\) based on stereo vision, where \(p^{c}\) is the center point of the contact points and \(p^{lh},p^{rh}\) are the two horn points, as follows:  
\[p_{3d}=\Theta\left(p^{l},p^{r},K_{l},K_{r},R_{lr},T_{lr},R_{\text{train}},T_{ \text{train}}\right), \tag{14}\]  
where \(p^{l},p^{r}\) are the corresponding points in the left and right images, respectively, and \(K_{l},K_{r},R_{lr},T_{lr}\) are the internal parameters of the left and right cameras and the extrinsic parameters between the two cameras after calibration through high-precision targets. To obtain a clearer association between the reconstructed 3D result and the real position, a conversion matrix \(R_{\text{train}},T_{\text{train}}\) between the roof-based coordinate and camera coordinatewas solved through an electronic total station, whose function is similar to that of an optical theodolite. The cross section plane of the pantograph slide in space was then determined. In this plane, according to the standard pantograph 3D data, the whole pantograph point cloud can be registered, and the 3D structure of the pantograph slide is simulated. Based on the reconstructed pantograph, two main attitude parameters were obtained: the tangential tilt angle and the lift relative to the train body. As shown in Figure 5, under the coordinate system of y-axis for train direction, z-axis for ground, and x-axis for tangential direction, the pantograph usually only lifts and descends on the z-axis to ensure constant contact pressure between the pantograph and catenary. However, due to the influence of trains running in curves and crosswinds, there will be a slight suspension in the X-O-Z plane relative to a geodetic coordinate system, so the above two parameters can be used and can effectively represent the track change of a sliding plate in train operation. Center line offset: Compared with the usual pull-out value detection in railways, the center line offset detection is defined as the offset of the contact line relative to the center position of the pantograph slide, which not only needs to accurately locate the contact line, but also needs to be synchronized to measure the pantograph pose. The center line offset has a strong early warning effect for phenomena such as hanging lines in actual train operation. In the aforementioned attitude solution, the pantograph pose and position of the contact point are known. Thus, according to the pantograph slide vector and the spatial position of the contact point (Figure 1), the offset values can be directly obtained. Note that the premise of the above two detection methods is that PCS detachment does not occur, that is, the contact points in the image will be mismatched when detachment occurs. Correspondingly, the measurement results of the pose and center line offset will be affected. PCS detachment: As a slight PCS detachment will produce obvious sparks, our method mainly focuses on complete detachment, rather than an unsmooth contact. In this case, because of the mismatch of contact points illustrated in Figure 1, the distance between the spatial contact point and line constructed by the horns will be abnormal.