# Integrating a LiDAR Sensor in a UAV Platform to Obtain a Georeferenced Point Cloud
## 2 Materials and Methods
### Data Collection and Processing Procedure Development
#### 2.2.4 Generation of Georeferenced Point Cloud  
The generation of the georeferenced Point Cloud is the transformation of the local coordinates from the LiDAR sensor (_s_-frame) to global coordinates (_g_-frame) [33]. The local coordinates of the point acquired at a given t moment are georeferenced according to the model proposed in Equation (1) below [21]. \[p_{(t)}^{g}=P_{(t)}^{g}+R_{b}^{g}(t)\cdot\left(R_{s}^{b}\cdot p_{(t)}^{s}+l^{ b}\right) \tag{1}\]  
Equation (1) represents the Georeferencing Equation. This equation is used to make an indirect measurement. With this type of measurement, the center of the UAV cannot be accessed. Therefore the resulting measurements would not be correct, since they are not relative to its center (0, 0, 0). The errors presented by the first equation are corrected by comparing two point clouds: a real cloud, which uses the points provided by the total station, and an artificial cloud, constructed using the measurements from the UAV. \[p_{(t)}^{g}=P_{(t)}^{g}+R_{b}^{g}(t)\cdot\left(R_{cal}\cdot R_{s}^{b}\cdot p_{ (t)}^{s}+a_{cal}+l^{b}\right) \tag{2}\]  
The initial proposed model is modified by adding two variables that correct measurement errors. Equation (2) denotes the proposed georeferencing equation based on Equation (1) but adds two additional variables to correct measurement errors: _R_cal and _a_cal. Where  
1. \(p_{(t)}^{g}\): Three-dimensional vector in the g-frame. This position information is delivered by the UAV's GNSS/INS system in latitude, longitude and altitude on the reference WGS 84 ellipsoid published at 50 Hz. 2. \(R_{b}^{g}(t)\): Rotation matrix that transforms a vector from the UAV's frame of reference, the b-frame, to the g-frame. This information is obtained from the IMU of the UAV that delivers the vehicle attitude represented as a quaternion for the FLU (Forward, Left, Up) body frame rotation to the global ENU (East, North, Up) frame published at 100 Hz. Figure 7: LiDAR communications scheme for collecting data. \(R_{s}^{b}\): Rotation matrix from the s frame, LiDAR sensor, to the b-frame, UAV, which depends on the mounting base. 4. \(p_{(t)}^{\mathcal{S}}\): Points provided by the LiDAR sensor. 5. \(R_{cal}\) and \(a_{cal}\): Matrix and calibration vector that corrects errors caused by assembly and shaft misalignment issues. 6. \(l^{b}\): Lever arm displacement between the LiDAR sensor and the body frame origins defined within the b body frame. These variables are divided between static and dynamic (Table 3). Static variables do not change during application of the Equation, while dynamic variables change according to the point used within the point cloud. Figure 8 includes a diagram that denotes the location of the reference frames used. For example, in this Figure, the b-frame (related to GNSS/INS), the s-frame (related to LiDAR), and the g-frame (ENU) may be observed. The data obtained from the LiDAR sensor are expressed in the s reference system. However, the rotation matrix is applied since these data must be expressed in the b reference system [31]. To obtain the \(R_{s}^{b}\) rotation matrix, basic sequential rotations around the ZXZ axes are used as per Equation (3). \[R_{s}^{b}=R_{z}\Big{(}-\frac{\pi}{2}\Big{)}*R_{x}\Big{(}-\frac{\pi}{2}\Big{)}*R _{z}\Big{(}-\frac{\pi}{3}+0.135\Big{)} \tag{3}\]  
The 0.135, 2, and 2 values added and divided by the 180\({}^{\circ}\) represented by \(\pi\) are mathematically obtained by the theory of rotations and the 3D printed adapter. For the z_angle, the 0.135 value was adjusted manually by overlapping with a reference plane RP located below the UAV. Mathematically, three successive rotations are again performed around the \(Z\), \(X\), and \(Z\) axes. Figure 8: Reference frames used for the georeferenced point cloud generation.