## 3 Our Approach to Estimation of Robot Pose and Pipe Diameter (EPD)
### Framework of Robot Pose and Pipe Diameter Estimation  
The in-pipe robot is equipped with a 3D ToF sensor to capture depth measurements in its front area, as illustrated in Figure 1. The sensor collects \(N\) measurement points per frame in the sensor coordinate system (SCS), where the origin \(x_{0}\) is located at the center of the sensor, and the X-, Y-, and Z-axes are aligned along its front, right, and upward directions, respectively. Due to deformations caused by manufacturing imperfections or external pressure, the pipe inner surface is modeled as a cylinder with its cross-section represented by an ellipse. In this model, the pipe diameter is characterized by the major-axis length (\(D_{\text{max}}\)) and minor-axis length (\(D_{\text{min}}\)). This paper addresses the problem of accurately estimating robot pose and pipe diameter based on measurements collected by a 3D ToF sensor. The sensor provides real-time measurements of the pipe inner surface in the SCS. Each measurement point represents the depth from the sensor origin to the pipe inner surface along a sensing line (red line). The measured point in the SCS is denoted by \(\hat{x}_{i,S}=[\hat{x}_{i,S},\hat{y}_{i,S},\hat{z}_{i,S}]^{T}\) (\(1\leq i\leq N\)). We assume that the sensor is well calibrated, effectively eliminating depth biases. Due to random depth errors, \(\hat{x}_{i,S}\) deviates irregularly from the ground-truth point \(x_{i,S}\) which represents the exact intersection between the sensing line and the pipe inner surface. Since the dispersion of the ToF camera light is extremely low, three points--\(\mathbf{x}_{i,S}\), and \(\hat{x}_{i,S}\)--lie along the same sensing line. Then, the random depth error \(\epsilon_{i,S}=[\epsilon_{x,i,S},\epsilon_{y,i,S},\epsilon_{z,i,S}]^{T}\) can be modeled as  
\[\epsilon_{i,S}=\hat{x}_{i,S}-\hat{x}_{i,S}. \tag{1}\]  
Figure 1: Illustration of measurement points collected by 3D ToF sensor. (**a**) Side view showing sensing line, measurement point \(\hat{x}_{i,S}\), and ground-truth point \(\mathbf{x}_{i,S}\). (**b**) Cross-sectional view highlighting elliptical shape of pipe. If the measured point \(\hat{\pi}_{i,S}\) lies closer to the sensor origin than the ground-truth point \(x_{i,S}\), it is classified as a negative-error point (\(|\hat{x}_{i,S}|-|x_{i,S}|<0\)). Conversely, if it lies farther away, it is classified as a positive-error point (\(|\hat{x}_{i,S}|-|x_{i,S}|>0\)). For mathematical simplicity, we also assume that the signed depth error \(\mathbf{e}_{i,S}\) follows a zero-mean Gaussian distribution \(\mathcal{N}(0,\sigma_{e}^{2})\), where each component of \(\mathbf{e}_{i,S}\) is an independent and identically distributed (i.i.d.) Gaussian component with the standard deviation \(1/\sqrt{3}\sigma_{e}\). While the SCS effectively captures the cylinder-shaped structure of the pipe inner surface, it suffers from a key limitation: the axes in the SCS are defined based on the orientation of the robot, which varies dynamically with its pose. As a result, the pipe model represented by measurement points is pose-dependent, making it challenging to evaluate deviations of measurement points from the pipe model. To address this challenge, we propose a stable reference coordinate system, called the pipe coordinate system (PCS), in which the X-axis aligns with the axial center of the pipe along the direction of robot movement, while the Y-axis and Z-axis correspond to the major and minor axes of the elliptical cross-section, respectively. This fixed orientation allows the decoupling of the pose from the pipe model and enables a geometrically meaningful representation of the pipe structure. The fundamental challenge is to transform the measurement points collected in the SCS into the PCS using a rigid transformation that accounts for the robot pose. This transformation involves rotations and translations that align the sensor measurements with the PCS axes.