Volume Estimation of an Indoor Space with LiDAR Scanner

. Three-dimensional scanning is a task of great importance for our modern society and has brought significant advances in the precision of material inventory. These sensors map the material surface continuously, allowing real-time inventory monitoring. Most technologies are expensive because this process is complex, and even inexpensive ones are considerate smart investments for the average user. Therefore, this work presents the simulation of a low-cost time-of-flight based 3D scanning system that performs the volume estimation of an object-filled indoor space after a voxelization process. The system consists of a 2D LIDAR scanner that performs an azimuthal scan of 180 ◦ through its rotating platform and a motor that rotates the platform in angle inclination.


Introduction
Accurate 3D shape reconstruction and volume estimation are essential in many applications, for example, the estimation of stockpiles and raw materials. LiDAR (Light Detection And Ranging) is a laser scanner, also known as laser rangefinder (LRF), which is an attractive and efficient tool because the sensor remotely delimits the volume of interest by providing relative distance measurements from its point of origin.
For LiDAR scanners, the triangulation, phase shift method, and time-of-flight (ToF) methods are the three common approaches. Triangulation systems have a restricted range and depth variation but offer higher precision. On the other, ToF systems have a wide range and depth variation, but lower precision [16,10]. In the phase shift method case, a signal is sent with a specific frequency. Next, the phase time difference between the sent and received beams is detected and computed at the receiver [1]. The accuracy of ToF-based systems is mainly determined by the sensor's ability to accurately measure the interval between the laser emission and reception of the reflected signal, which makes it possible to estimate the object's position in space, as such is the case developed in this work.
This accuracy during acquisition can be affected by interference from light, noise, and the angle of incidence of the beam projected on the object being too oblique. Therefore, a controlled environment and a high-quality circuit must be used to perform scans in more complex environments, which generally results in expensive 3D scanning systems [10]. For this reason, a low-cost 3D scanning system that uses a 2D laser scanner with a ToF approach was developed in this work. The objective and scope of this research work are at small environments, such as a deposit, where high performance was not required since there were no windows and it did not need a long reach.
In this work, the scanning is done in two dimensions (2D) with a scan range of 180°and a drive motor that results in several possible combinations between the scan plane and the axis of rotation to obtain a 3D map.
The present work is divided into nine chapters, where in Section 2, a bibliographic review is carried out on works developed for volume estimation through a laser scanner. Section 3 describes the hardware parameters used in the software and the LiDAR used. The SimTwo software is presented in Section 4, covering the structure created for the simulation and a description of the system architecture. Section 5, 6, and 7 detail data acquisition used in software, data processing, and volume estimation. Section 8 presents the validation of the approach in the software, and finally, Section 9 draws conclusion about the results obtained in the tests performed and discusses proposals for future works.

State of the art
Devices integrated for 3D scanning by 2D sensors have been widely used at the low cost of the system because of its inexpensive nature. In environmental modelling, Li et. al [19] uses a high-precision lifting platform and a small laser range sensor. Chou [12], and Surmann [23] developed a 3D mapping system consisting of a mobile platform and a rotating platform consisting of a laser rangefinder. In [18] the viability of the low-cost LiDAR sensor in extracting traces from tree leaves was evaluated.
Level sensors based on the 3D mapping are revolutionizing inventory management, adding the ability to accurately estimate volume without leaving the safety of an office. This technology has been proven in many challenging materials, including food and in the energy and mining industries [2].
Nowadays, there are many devices on the market to detect the level of solids in silos. However, ToF sensors are an advanced non-contact technology that overcomes one of the biggest challenges present in silos, which is the presence of much dust. Another benefit of using a laser is that when inventory monitoring is fully automated, there is no need to climb silos to take measurements, avoiding possible work accidents [13].
The volume of a surface can be quickly calculated using representations such as height grids, voxels, or polygons. The authors in [8], from a laser scanner, created a point cloud that is used to create the 3D surface and, from this, derive the height grid that is used to measure the volume of the payload. However, the related work about voxel-based is mainly used to estimate the volume of trees. For instance, papers [17] and [9] estimated tree's volume by 3D voxel-based modeling using portable scanning LiDAR data.
Laser scanners have also been used successfully to measure the volume of solids. Point clouds are produced in [24] from laser measurements, and then two approaches for 3D surface construction and volume estimation are evaluated. The first method, Meshed Surface, divides the collected points into evenly spaced cells to generate a grid, although separate data requires interpolation. The second approach, called Isolated Points, calculates the volume by dividing the total area scanned by the number of points collected. Due to sampling in obscure locations or when reflectivity is low, the second technique produces erroneous estimates.
The research work of GeoSLAM ZEB-Horizon 3D was used in [2], a mobile scanner within a project to speed up the inventory work significantly. This scanner offers a high surface coverage due to the dense point cloud. The analyzed material in question was minerals that were deposited in storage boxes. This equipment offers software that can be accessed from a single location or throughout the company, facilitating real-time inventory information, generating operational and financial efficiency.
In the mining context, an essential part of the industry's daily operations needs volume estimation as most companies try to take advantage of the latest technology to improve their productivity and maximize profit. With the help of modern point cloud technology, it is possible to estimate volume more scientifically and accurately. In his research, Amaglo [6] searched to use the point cloud and 3D surface model of mass transport to estimate the volume of a stock in the mining field. A volumetric computational method based on point cloud coordinates was formulated in MATLAB software to estimate the volume of inventories using LiDAR data. The point density and filtering algorithm plays a critical role in the volume calculation, which helps to provide a reasonable estimate of the stock.

Acquisition System
This section describes the system hardware used to parameterize the SimTwo software, consisting of the LiDAR sensor and drive motor responsible for measuring and collecting data. The motor configured in SimTwo was a direct current motor with a resolution of 1 • step. The hardware is designed to control the field of view of the scan.
The Neato XV-11 laser scanner, Fig. 1, is a low-cost LRF, small and has low energy consumption. A full rotation provides a measurement range of 360 • , with an angular resolution of 1 • and a distance range from 0.2 m to 6 m with an error of less than 0.03 m.

Simulation Environment
This section presents the "SimTwo" simulation environment, describing an introduction to its characteristics, the functions of each of the features available found and the elements used to create the scenes.

Simulation Structure
Developed in Object Pascal, SimTwo is a free, open-source software where several types of robots can be modelled: differential, omnidirectional, industrial, and humanoid, among others. It was developed in 2008 and constantly received updates available in [14].
This simulator has the functionality of using specified models of characterized components and the decomposition of a robot in rigid bodies and electric motors, allowing a dynamic realism to the project. SimTwo can develop robots in different programming languages and commercial software such as Matlab and LabVIEW [15].
All the available tools allow the development of a broad diversification of works. Some of the works developed to include the simulation of a quadrotor model and the evaluation of it's dynamics [7], game simulation [22], the validation of a control system of an autonomous vehicle [5] and humanoid robots [20].
SimTwo is a multi-document interface (MDI) application where the windows "code editor ", "spreadsheet", "configuration", "scene editor " and "chart" are under the control of the window "worldview ", as shown in the Fig. 2. The "configuration" window offers control over various parameters of the scene, including the camera position and lighting. External communication via the Serial Port and UDP is possible through the "I/O" tab.
The "code editor " offers an integrated development environment (IDE) for programming in Pascal language.
In the "chart" window, it is possible to plot all the states available of each defined robot in the XML, such as its position and speed. "Spreadsheet" is a table that allows you to show the value of any variable in real time and interact with the code editor.
In "Scene Editor ", it is possible to create robots, tracks, walls and other entities in the scene. It consists of the main file "scene.xml " and other XML files.

System Architecture
The focus of this work is to simulate a scanning system composed by modelling a real low-cost 2D laser scanner and estimate the volume occupied by objects in a deposit. The work can be defined in three steps for volume estimation: 1) Data collection: the system is going to be simulated in Simtwo simulator, where the data acquisition will be made.
2) Data processing: the collected data's coordinate system is converted from the modified spherical coordinates of the scanning system to cartesian coordinates with the origin being the centre of the LiDAR scanner which is subsequently filtered to remove the walls.
3) Volume estimation: the cloud goes through the voxelization process, allowing the calculation of the volume occupied by the object.
The constructed architecture can be visualized by the diagram in Fig. 3.

Data Collection
The proposed system consist of a two-dimensional laser scanning subsystem that is actuacted by a motor to achieve 3D acquisition capacity. This system, in real time, distance measurements alongside the orientation of each light beam in the two degrees of freedom of rotation. When the process starts, the platform, Fig. 4, begins to rotate at a known constant speed. At the same time, the LiDAR device scans the environment, and with each revolution of the 360º platform, the motor increases the inclination angle in a chosen step. In this way, the device will scan new information with each rotation until it reaches 180°in inclination angle. One can note that the step in the inclination angle is a way of regulating the scanning resolution. In the end, a text file (.txt) contains information on distance, azimuth and inclination angle.

Scene Construction
The physical description of each entity is done through XML files. Before starting the construction of the scene, it is essential to remember which entities will be present in the simulation and how they will interact, so it is possible to define what the virtual environment will be like.
It was intended that the scanning system detected the walls and objects located in the centre, creating a text file with the point cloud, to afterwards, the volume estimation algorithm compute the volume.
To characterize the LiDAR sensor in the simulated scene, it was necessary to configure it in the ".xml" file in the scene editor. In this section, it is possible to describe the configuration, such as the beam length, six meters in this case, and the width, five milimeters. The Neato XV-11 laser mathematical model were already modelled in Simtwo, where its parameters were extracted in [11]. Thus, it was used as a basis for this work.
The sensor was configured to have a scan time of 25 ms and a 180 • field of view. Moreover, the simulation records 1 sample per degree, totalling 180 samples during a full scan.

Data Processing
First, a text file is imported into the MATLAB environment. This file contains the distance from the sensor to the reflecting surface, the azimuth angle, and the inclination angle of each measurement. In other words, the system performs the scans in spherical coordinates for convenience since the architecture of the 3D scanner works in spherical coordinates. However, to perform the calculations and visualization the cartesian coordinate system is better. Thus, this conversion is performed in the point cloud data. Once converted to the cartesian coordinates system, xyz represents the corresponding coordinates in meters of the real system. Soon after, it passes through the wall filtration process, obtaining the point cloud from the interior of the deposit.

Coordinate Transformation
The system operation is demonstrated in the xyz plane. Two points are observed for the structure characteristic: The sensor position (X L , Y L , Z L ) and the point acquired by the scan (X 1 , Y 1 , Z 1 ). The system origin is considered at the sensor position S L (red circle) for the calculation.
The information received in each scan is illustrated in the image with blue colour, as described below: φ is the inclination from the plane of the sensor parallel to the xy plane with a range of [0, π]. α is the azimuthal angle measured from the y axis to the projection of R in the xy plane and has a range [0, π]. -R is the parameter that represents the distance from the sensor to the object found.
Then, these three variables are used to calculate the transformation of the spherical coordinates to the cartesian coordinates. The position P (black circle) in Cartesian coordinates (X 1 , Y 1 , Z 1 ) can be defined in terms of the parameters (R, φ, α) with the sensor as the origin, as: This relation can be proved through the variable change theorem in triple integrals available in [21].
The point cloud image is constructed and displayed when the coordinate value calculation is completed. Finally, to emphasize, after the conversion, X, Y, and Z represent the corresponding coordinates in meters of the real-world system.

Voxelization
Partitioning squares of equal size primarily characterize this approach in the xy plane to unify all points in that region. Then, the height value of each grid is determined the average height of all points inside each grid, thus obtaining a cube. Thus, with an average height, and standardized width and length, the volume estimation for that specific region is performed.
The resolution of the grid is necessary due to the variation of the density of points of the system. The voxel size must be adequately determined to be large enough to have no unfilled grids and to represent the data properly. Thus, the relation between the points density and the inclination angle, that directly depends on the variation of the motor step, was analyzed. This relation is found by the distance between two beams distanced by the chosen degree of inclination. For a better understanding, Fig. 6 presents the chosen proposal with a cube in the middle of the scene.
The letter a characterizes the height of the sensor from the ground, b is the difference between the height of the sensor and the cube, and c corresponds to the minimum value that the grid must have.
The value of c can be calculated by the relation found in equation 2 below.

Volume Calculation
In the end, the total volume deducted in equation 3 will be the sum of the individual volume of all the voxels in the xyz plane.
Where M and N is the position of each voxel grid: x ′ i,j represents the width of the grid. y ′ i,j represents the length of the grid. z i,j represents the height and is calculated by averaging all points.

Sensor position
This section contains the results obtained in tests to analyze the best position for the sensor within the scene. For this, two tests were performed in different positions (A, B), as shown in Fig. 7.  When analyzing the three figures, one can notice that the system in the centre obtains a better uniformity in the distribution of the point cloud. In contrast, for the position on the wall, the density of points near the sensor is much higher, and as the measurement becomes farther from the sensor, the density decreases, this is due to the scanning format, which generates a pattern, whereas the distance of the sensor increases the group of points is distorted and lose resolution. The difference in the number of points is also noticeable since the cloud formed at position A has 32400 points and at position B 16200 points, which can be justified because when the sensor is on the wall, its inclined range is limited to 90 • while the sensor in the centre it up to 180 • .
As the position of sensor A presented the best result, the simulations that followed it considered that the sensor would be positioned in A.

Volume Estimation
The results obtained in three simulations with the sensor located in the centre was analyzed to test the approach illustrated in Fig. 6. The simulation specifications are found in Table 1.    The sensor's characteristics implemented in the software were taken from LiDAR Neato XV11, [3] in a review, and modelling was done in SimTwo. A full rotation provides a measurement range of 360°with an angular resolution of 1°. In the simulations, each laser sweep was limited to 180°in angle α. The chosen motor step was 1°in angle φ per scan.
For each simulation, it was necessary to choose a grid that adapts to the density of points in the system. Table 2 displays the computed grid resolution, the estimated volume calculated by the algorithm, the real volume of the ambient, and the percentage error for each simulation. Fig. 9 shows the simulated system for the first simulation and Fig. 10 its respective point cloud. By comparing both, it is possible to note that the point cloud represents the simulated system.

Conclusion and Future Work
This work proposed a different approach for volume estimation using a low-cost LiDAR sensor, where first, it is verified that the best position for the sensor is in the centre of the environment. Then, the validation of the system from the adaptive grid shows a consistent result because there was a low error with the cube in dimensions closer to the real, and the highest error comes from the cube of simulation two because it has half the size of the cube of simulation 1.
As the work is under development, some improvements will be made in this project, in which the validation of the system for simulations with different objects and positions stands out.
As future work, this procedure will be implemented in a real environment where the 3D scanning system is already being implemented aiming at the application for monitoring the volume of a wharehouse.