## 4 Location Estimation of Truck Cargo Box
### Cargo Box Rear Detection Using a LiDAR Sensor  
Due to the vertical placement of the two LiDAR sensors, data from the cargo box door and the ground are merged, and the point cloud for the cargo door is separated. In theory, a 3D point cloud on a plane can be described by an identical normal vector. Furthermore, when a sensing device is constructed, the index, \(i\), of the point cloud obtained from the two LiDAR sensors may be considered identical if both identical LiDAR sensors are located on the same plane. Therefore, a simple method was used to detect the point cloud on the cargo box door using two LiDAR sensors.  
Figure 8 illustrates the process of obtaining the point cloud on the cargo box door. Three-dimensional point clouds acquired from the left and right LiDAR sensors are denoted as \(P_{i}^{L}\) and \(P_{i}^{R}\) And their normal vectors are \(\hat{P}_{i}^{L}\) and \(\hat{P}_{i}^{R}\), respectively. The normal vector, \(\hat{P}_{i}^{L}\) is determined by the cross product of the two vectors after obtaining the direction vector, \(B\)\(P_{i}^{R}\) of \(P_{i}^{L}\) and \(P_{i+k}^{L}\) (\(k\) is 3-5), after the direction vector, \(A\) of \(P_{i}^{R}\), is ascertained from, \(P_{i}^{L}\). The normal vector, \(P_{i}^{R}\), of the right-side LiDAR data, \(P_{i}^{R}\), is obtained using the same method. When the normal vector of all point clouds is determined, the dot product and the z-axis (0, 0, 1) of the stereo camera coordinate system are obtained.  
Figure 8: A method to detect the door of a dump truck cargo box using two LIDAR sensors. The points on the plane have the same normal vector, and the dot product with the camera z-axis is close to \(-1\). The normal vector is computed with two LIDAR point clouds.  
As the sensor mounted on the excavator is placed on the rear side of the cargo box, an inner product value closer to \(-1\) is considered to be the point cloud on the cargo box door. The point cloud is filtered using the magnitude of the direction vector, A. Points with significant differences in the distance cannot be considered part of the point cloud and are therefore removed, as they are considered noise. Because the points are discriminated using only the normal vector and the distance between the point clouds, there may be outliers that are not removed from the filtering.  
Lastly, outliers are eliminated by line modeling the 3D point cloud sorted using the random sample consensus algorithm, and the final 3D point cloud existing on the cargo box door is sorted. Figure 9 shows a LiDAR point cloud with outliers removed from a three-dimensional point cloud of a stereo camera. Point clouds that are not line-fitted are considered noise.  
This point cloud is used to define the plane of the rear of the cargo box, \(\pi_{L}\), as in Equation (3), and the plane equation is obtained using the least-square method shown in Equation (4):  
\[ax+by+cz+1=0. \tag{3}\]  
\[\left[\begin{array}{cccc}x_{1}&y_{1}&z_{1}&1\\ x_{2}&y_{2}&z_{2}&1\\ x_{3}&y_{3}&z_{3}&1\\ \vdots&\vdots&\vdots\\ x_{i}&y_{i}&z_{i}&1\end{array}\right]\left[\begin{array}{c}a\\ b\\ c\\ 1\end{array}\right]=\left[\begin{array}{c}0\\ 0\\ 0\\ \vdots\\ 0\end{array}\right]. \tag{4}\]  
The matrix form is a linear equation, \(AX=0\). Therefore, the general solution, \(X\), is computed using SVD, as in Equation (5). Finally, the back plate plane is computed with Equation (6):  
\[A=U\sum V^{T}, \tag{5}\]  
\[\left[\begin{array}{c}a\\ b\\ c\end{array}\right]=V^{T}.\left[\begin{array}{c}0\\ 0\\ 1\end{array}\right],\ \ \ \pi_{L}=\left[\begin{array}{cc}a&b&c&1\\ \end{array}\right]^{T}. \tag{6}\]