## 3 Implementation Plan and Theoretical Basis
### Loading and Offloading Arm Structure and Pose State  
The structure of the bottom loading and offloading arm (small crane tube) is shown in Figure 4. The pipeline of the equipment is connected to the column by connecting pieces, and the upper and lower tubes are, respectively, the gas phase tube and the liquid phase tube; that is, it has a so-called dual-phase structure [11]. The loading and offloading arm is composed of a column, an inner arm, an outer arm, an outrigger arm, a connecting flange, and other components to form the main pipeline of the equipment. The outer arm is  
Figure 3: Block diagram of the working principle of the system. equipped with a spring cylinder balance device and is organically connected by five rotary joints to realize the 3D movement of the outrigger arm. This ensures the correct horizontal butt with the tanker flange at any position within the envelope. We simplified the model for the outrigger nozzle of the small crane tube to a cylinder as shown in Figure 5. The port of the small crane tube in any state can be uniquely represented by a six-dimensional vector \((X_{c},Y_{c},Z_{c},\alpha,\beta,\gamma)\), where \(X_{c},Y_{c}\), and \(Z_{c}\) are the center point \(O_{c}\) of the nozzle end face in the calibration frame coordinate system \(Oo\) (the actual position in the measurement coordinate system), \(\beta\) and \(\gamma\) are the inclination angles of the axis of the small crane tube projected in the \(X_{0}O_{0}Y_{0}\) and \(X_{0}O_{0}Z_{0}\) planes, respectively, and \(\alpha\) is the rotation angle of the end face of the small crane tube with the central axis as the rotation axis. During manual docking, the central axis of the outrigger of the small crane tube is adjusted to be level with the ground, that is, \(\gamma\) is 0. The state angles \(\alpha,\beta,\gamma\) of the outrigger arm of the small crane are detected by the horizontal sensor and angle sensor on the loading and offloading arm, and the position coordinates \((X_{c},Y_{c},Z_{c})\) of the center point \(O_{c}\) of the nozzle end face are detected by the position sensor in the actuator. The spatial coordinates and pose information of the docking between the flange port and the loading and offloading arm were obtained from the vision sensor and the distance sensor. Based on the spatial pose of the flange central axis, the spatial coordinates of the flange end face were calculated, and the small crane tube was leveled. Then, it completed the pose adjustment of the small crane tube through translational motion [12]. The details are as follows:  
First, because the circular target appears as an ellipse after imaging, the actual position of the circle center in the image after perspective projection and the center position of the ellipse obtained by perspective projection of the circle outline often do not coincide. This error is called a perspective projection distortion error [13], so the contours to be selected in the image are screened by the least squares ellipse fitting method, and the space circle plane equation that can best represent the target is obtained;  
\[z=f(x,y)=Dx^{2}+Ey^{2}+Fx+Gy+Hxy+J \tag{1}\]  
Figure 4: Structure diagram of loading and offloading arm. Figure 5: Diagram of small crane tube port pose. Then, according to the data obtained by the sensor, take any point \(\mathrm{P}(X_{p},Y_{p})\) on the target space circle, calculate the plane equation tangent to the surface, and determine the normal vector of the plane in order to determine the space coordinates and pose of the target flange. Finally, it calculates the coordinate \(Z_{P}\) of the fitting space plane along the \(Z\)-axis direction, and the value \(Z_{P}\) is the final depth position of the loading and offloading arm. The coordinates of the center of the target flange and the values of the angles \(a^{\prime},\beta^{\prime},\gamma^{\prime}\) are calculated.