## 3 Preliminaries  
### System Model  
The PIG is equipped with a 3D ToF camera and other inspection sensors, such as magnetic, acoustic, optical, etc. In this paper, we only focus on the 3D ToF camera for ETDE. The 3D ToF camera is placed in front of the PIG. The 3D ToF camera has a resolution of \(N_{H}\times N_{W}\) and covers a view \(F_{H}\times F_{W}\). The 3D ToF camera coordinate system is illustrated in Figure 1 where the origin \(O_{C}\) is defined in the center of the lens and \(X_{C}\), \(Y_{C}\), and \(Z_{C}\) axes point to the forward, leftward, and downward directions of the 3D ToF camera, respectively. At each time step, it creates a point cloud with \(N_{H}\times N_{W}\) points representing the inner surface of the pipeline ahead of the PIG. Each point in the point cloud has the form of \((x_{C},y_{C},z_{C},I)\) where \((x_{C},y_{C},z_{C})\) is the coordinate in the camera coordinate system and \(I\) is the intensity value.  
We consider the PIG that operates in the gas pipelines consisting of straight pipes, elbows, and T-junctions. The straight pipe is assumed to have an elliptic cylinder shape. The straight pipe coordinate system (SCS) is defined as follows: the origin \(O_{S}\) is the intersection pipe central axis and the start cross-section, \(X_{S}\) axis is along the central axis and pointstoward the moving direction of PIG, \(Z_{S}\) axis follows the direction of gravity, and \(Y_{S}\) axis is defined according to the right-hand rule, as shown in Figure 1.  
The elbow is designed as a section of the torus shape [16] with radius \(R_{E}\) and pipe radius \(r_{E}\), as shown in Figure 2. The elbow coordinate system is defined as follows. The origin \(O_{E}\) is the center of the torus shape. \(X_{E}\) axis is assumed to be parallel and same direction as \(X_{S}\) of SCS. \(X_{E}\) and \(Y_{E}\) axes define the elbow plane and \(Y_{E}\) axis points to the direction of the elbow. Note that \(X_{S}\) is also on the elbow plane. \(Z_{E}\) axis is defined according to the right-hand rule. \(S_{E}\) is the starting point of the elbow from the straight pipe and \(E_{E}\) is the ending point of the elbow, which is also the starting point of the subsequent straight pipe. The length \(l_{E}\) of the arc between \(S_{E}\) and \(E_{E}\) represents the elbow length.  
The T-junction's design is shown in Figure 3a with the main pipe radius \(r_{T}\) and branch radius \(r_{B}\). It can be a smooth T-junction or shaft T-junction, as shown in Figure 3b,c. While the smooth T-junction is a distinct part of the pipeline, the shaft T-junction is created by hot-tapping the branch to the existing straight pipe. In both types, the T-junction coordinate system is defined as follows. \(X_{T}\) axis is also aligned with the straight pipe \(X_{S}\) while the \(Y_{T}\) axis points to the direction of the branch. \(Z_{T}\) axis is derived using the right-hand rule. Note that, in reality, the PIG only moves in the main pipe of the T-junction, as shown in Figure 3a. To make a consistent definition among two types of T-junction, we define the start point \(O_{T}\) and end point \(E_{T}\) of the T-junction as the point on the central axis and aligning with the branch's inner wall, as shown in Figure 3b,c. The starting point \(O_{T}\) is also defined as the origin. The distance from \(O_{T}\) and \(E_{T}\) defines the T-junction length \(l_{T}\).  
Figure 1: Camera and straight pipe coordinate system.  
Figure 2: Elbow model.