1 Alexander Kennedy, z3218891 The objective of this experiment was to analyse laser data based on an object located at different orientations and ranges and determine whether noise across a range of scans was random or independent of measurement. This was achieved by tilting a board at 10°, 20° and 30° degrees and turning it at 60°, 70°, 80° and 90°. 500 samples were taken each time using ‘Matlab’. This was repeated at ranges of 1m, 3m and 5m and it was found that noise in the data was random and independent of tilting and turning measurement. The laser was found to be accurate to 2.38cm. The laser was then used to measure the attributes of a sphere and a board. The sphere’s radius was found to be 0.2219m and its centre located at ( -0.1319, 0.7187). This was based on an interpolated model fitting the raw data to within 1.2cm. The centre was found via the intersection of normals taken at 2 arbitrary points along the circumference of the cross-section. A least squares linear regression was used to find the equation of the board and length as 0.3377m, based on 200 data scans. It was concluded that the laser is an accurate device to successfully measure the attributes of a variety of shapes. 2 Alexander Kennedy, z3218891 INTRODUCTION Despite the high resolution of the SICK laser it suffers from random errors. As the laser is an active device the laser beam is prone to atmospheric distortions caused by temperature gradients, wind and particulate matter in the air. This can cause the beam to scatter or refract changing the angle of reflection received by the laser. Indoors these effects are less of an issue and factors such as vibrations in the laser unit can cause inaccuracies in the projection and detection of the light beam. Also it must be noted that the laser beam is not an infinitely small point, but rather a sector. Therefore higher ranges should exacerbate this error. Furthermore reflectivity of different objects being measured could possibly impact on the repeatability or accuracy of results. It is possible to estimate the magnitude of this random error by taking a range of scans of an object at a variety of ranges and orientations. This data can then be statistically analysed to determine random error, presuming it is independent of measurement. Once the laser accuracy is known, the laser can be used to measure objects such as a flat board. One powerful method of obtaining this the position of the board is by using a least squares linear regression across a range of repeated scans. The advantages of this method are, “It is simple to compute and for the case of normally distributed uncorrelated random errors it is provably optimal.”[1] This process can be enhanced with the use of the Matlab ‘pseudoinverse’ function. The purpose of this function is two –fold. Firstly it solves the inverse matrix- a step needed in the linear regression process and has the effect of reducing the impact of outlying data. It must be noted that only the points correlating to the surface being measured are present in the data set otherwise significant error will result. A limitation of the regression is that range measurements are inherently erroneous whereas the angles the laser scans at are far more reliable. In the process of solving for regression constants ‘a’ and ‘b (Eqn 1.1)’ the reciprocal of the range is taken (equation 1.2 ) which according to theory of errors in increases the magnitude of its error. However as the range change in range between readings is small compared to the value of the range due to the angular resolution of the error, this issue should not be problematic. 𝑅. sin(𝜃) + 𝑎. 𝑅. cos(𝜃) + 𝑏 = 0 1 𝑅 = 𝐴. sin(𝜃) + 𝐵. cos(𝜃) Eqn 1.1 Eqn 1.2 The measurement of spherical surfaces poses more of a challenge. Since the laser only detects the front hemispherical cross-section of the sphere a circular model needs to be created based on the cross- 3 Alexander Kennedy, z3218891 section. A polynomial fit (such as ‘polyfit’ in Matlab) can be used to interpolate the cross-section and its gradient equation obtained by differentiating. The point gradient formula (equation 1.3) can be used with the negative inverse of the tangents gradient at an arbitrary point on the sphere. If this process is repeated at another point, the intersection of the normal curves can be used to obtain the centre of the sphere. The radius can easily be obtained using the distance formula (equation 1.4) by measuring the distance between the centre and an arbitrary point on the curve. AIM This experiment seeks to analyse laser data based on an object located at different orientations and ranges and determine whether noise across a range of scans is random or independent of measurement. Once the repeatability of laser results has been quantified the laser can be used to measure the attributes of a board and a sphere to a known degree of accuracy. METHOD Part I 4 Alexander Kennedy, z3218891 A computer was logged onto the network and ensured to have the correct TCP/IP settings. Possum and Matlab were then loaded, respectively ensuring all support files were in the current directory. Protractor graduations were penciled on the floor for 60°, 70°, 80° and 90°. A wooden board was carefully secured perpendicular to the laser at a distance of 1m. Realtime laser data was used to approximate this distance. Matlab was run and a sequence of 500 scans were taken from 0° to 360°. Only data for the 180° scan was saved. Matlab was then similarly used to acquire scans for the board being turned at orientations of 60°, 70° and 80°. The board was then positioned perpendicular to the laser but tilted backwards at an angle of 10° by leaning the board on a heavy object. The angle was measured by hand with a protractor. Matlab was again used to acquire 500 scans for tilts of 10°,20° and 30°. The above method was repeated at distances of 3m and 5m. The code for this part is outlined in Appendix III. Part II A variety of objects were placed arbitrarily in the field of the laser and secured so they could not move. This included a long wooden plank and a sphere. A computer was logged onto the network and ensured to have the correct TCP/IP settings. Possum and Matlab were then loaded, respectively ensuring all support files were in the current directory. Matlab was run and a sequence of 200 scans were taken from 0° to 360°. Data was then converted from polar to Cartesian co-ordinates, the board and the sphere isolated and processed with a linear regression as outlined in the introduction and pseudo code in Appendix II. RESULTS I: 5 Alexander Kennedy, z3218891 Turn Tilt Range= ~1 metre(i=180°) Figure 1 Figure 2 90 Degree Comparison Range =~1 metre(i=180°) RESULTS II: Figure 3 Table1 Turn Range(m) Mean Variance Std Dev Mean Variance Std Dev Mean Var iance Std Dev 1 0.9818 0.0001 0.0039 0.9972 0.0001 0.0086 0.9836 0.0001 0.0076 3 2.9303 0.0013 0.0362 3.0243 0.0005 0.0219 3.0001 0.0001 0.0331 5 5.0036 0.0027 0.0316 5.0325 0.0010 0.0316 4.9878 0.0011 0.0441 Tilt Perpendicular 6 Alexander Kennedy, z3218891 Figure 5 – Sphere Model (X vs Y) X coordinate (metres) Y coordinate(metres) Y coordinate(metres) Figure 4 – Raw Data (X vs Y) X coordinate (metres) Figure 6 – Board Data and Regression DISCUSSION Part I Table 2– Board and Sphere Measurements BOARD Length 0.3377m 𝑦 = −0.3202𝑥 + 1.6077 Equation SPHERE Centre ( -0.1319, 0.7187) Radius 0.2219m Regression Error 0.0120m 7 Alexander Kennedy, z3218891 The results are summarised in table 1. From analysis of the means for each range and orientation there is no apparent trend. For example at 1m range the perpendicular orientation had the highest mean, for 3m the tilted orientation and for 5m the turned board. Analysis of the standard deviations shows a general trend of slightly increasing as range increases however this increase is extremely small. This could be explained by the cumulative effects of scattering and the spread of the beam sector at larger ranges creating larger discrepancy in range readings. But again, when comparing the differences between standard deviations at a given range there was no obvious correlation. Inspection of the histograms gives further insight into the apparent random nature of variation in the results. Figures 1, 2, 3 shows results(all the graphs can be found in appendix I) based on different orientations at 1m. The 70° turn (green in figure 1) has a very low standard deviation and thus a low spread on the graph. The smallest turn (blue) has the highest spread and the largest angle (red) a moderate spread. Figure 2 similarly shows no correlation for tilts. If there was to be correlation between error and magnitude of tilt/turn, spread on the graph would be proportional to this angle and this is not the case. Figure 3 shows three different samples of data for only perpendicular measurements. The first sample has a very tight grouping. The other two show varying spreads yet it can be seen that the mean of these 3 sets will all be very close. This reinforces that the nature of error is random (other than range which increases error) and thus independent of angle of tilt or turn. The laser accuracy was obtained from the set with the highest standard deviation which was found to be 2.38cm. Whilst there are sources for instrumental and measurement error in measuring tilt and turn, due to the independence of the laser to these factors they were deemed either very small or negligible with respect to this experiment. Measurement of range was taken by the laser itself and whilst it suffers from random error, the average was taken over a large range of samples greatly increasing accuracy. DICUSSION Part II: Figure 4 shows the raw data obtained from the laser in Cartesian form. The hemispherical face of the ball can be seen as well as the angled board to the right, both of which were measured. Figure 5 shows 8 Alexander Kennedy, z3218891 the model of the sphere which was created via a linear regression. The error in the fit of the linear regression was taken by averaging the difference between the raw data and the polynomial was 0.012, which was deemed quite accurate. The intersection of the normals to the interpolated curve and the centre of the circle are shown. Only two normals were used however accuracy could be improved by taking many normal curves at intervals along the circles circumference and averaging the points of intersection to find the centre. By modeling the other hemisphere of the circle error is introduced. A better method would be to have two lasers scanning on either side of the sphere to take a full crosssection. It must be noted that the laser is mounted 200mm of the ground and that the radius of the 2D cross-section taken will likely not correspond to the true radius of the 3D sphere. Figure 6 shows the least squares linear regression superimposed on the data from 200 scans of the laser. Outlying data points were trimmed using the ‘find’ function in Matlab. Due to the spread of the data a least squares linear regression using the ‘pseudoinverse’ Matlab function was employed. The process of least squares regression has limitations with respect to induction of error. If noise is not normally distributed uncorrelated random errors in the fitting process will not be ideal. However figure 6, like earlier data, supports the idea that noise in the data is random and thus the fit of the regression line appears accurate and a good method for the purposes of this experiment. The equation of the line is listed in figure 7. Another limitation of the regression is that range measurements are inherently erroneous whereas the angles the laser scans at are far more reliable. In the process of solving for regression constants ‘a’ and ‘b’ method the reciprocal of the range is taken (equation 1.2 ) which according to theory of errors in quadrature increases the magnitude of it’s error. However as the range change in range between readings is small compared to the value of the range, due to the 0.5° resolution of the laser, this was deemed acceptable for the purpose of this experiment. To obtain the length of the board, the line was interpolated between the maximum and minimum data points. This approximation was used for simplicity; a more accurate method would be to have two vertical lines interpolated through the first and last three data points and measure the distance along the regression line to where it intersected these lines. CONCLUSION 9 Alexander Kennedy, z3218891 From the results it can be seen that laser data for the most part is independent of the tilt or turn of an object. This has a greater affect on the repeatability of data rather than accuracy as the mean is a powerful tool for removing random noise. The data showed a very slight correlation between range and the magnitude of the error, however this affect was extremely small and not present in the perpendicularly orientated board. The co-ordinates of the centre of the sphere and radius were found based on a second degree polynomial regression which fit the raw data to within a standard deviation of 1.2cm. It can therefore be concluded that the laser was successfully used to accurately measure the attributes of the board and sphere to a known degree of accuracy of 2.38cm. REFERENCES [1] “Least Squares Calibration”, Martin Brown, 3rd September 1998, UK; http://www.nezumi.demon.co.uk/consult/leastsq.htm [2] Cracknell, Arthur P.; Hayes, Ladson (2007) [1991], Introduction to Remote Sensing (2 ed.), London: Taylor and Francis [3] Dodge, Y. (2003) The Oxford Dictionary of Statistical Terms, OUP [4] ”SICK; Sensor Intelligence”, SICK Corporation, 1st October 2009, USA; http://www.sick.com/group/EN/home/Pages/Homepage1.aspx APPENDIX I: 10 Alexander Kennedy, z3218891 Turn Tilt Range= 1 metre(i=180°) Range= 3 metre(i=180°) Range= 5 metre(i=180°) 11 Alexander Kennedy, z3218891 90 Degree Comparison Range =1 metre(i=180°) Range=3 metre(i=180°) 12 Alexander Kennedy, z3218891 Range= 5 metre(i=180°) 13 Alexander Kennedy, z3218891 APPENDIX II: FUNCTION Load Objects.mat (contains structure X.scans) FOR angles from 0 to 360 from X.scans Convert angles to radians and store in matrix ‘angle’ FOR radii from 0 to 200 from X.scans Convert radii and angles from polar to Cartesian coordinates and store in matrices ‘xq’ and ’ yq’ FUNCTION Plot ‘xq’ vs ‘yq’ to obtain raw laser data FOR radii from 0 to 200 from X.scans FOR angles from <sphere start coordinate> to <sphere end coordinate> from X.scans Convert radii and angles from polar to Cartesian coordinates in matrices ‘xx’ and ’ yy’ FUNCTION Interpolate coordinate matrices ‘xx’ and ‘yy’ and store equation as ‘solution’ FOR length of ‘xx’ and ‘yy’ Subtract difference between interpolated function value and raw Cartesian ‘xx’ and ‘yy’ value and store into matrix ‘delta’ FUNCTION Take standard deviation of matrix ‘delta’ and store as ‘error’ FUNCTION Differentiate interpolated function value and store as ‘tangent gradient’ FUNCTION Reciprocate and take negative of ‘tangent gradient’ and store as ‘normal gradient’ FOR length of ‘xx’ and ‘yy’ FUNCTION Substitute ‘xx’ and ‘yy’ using point gradient formula: 𝑦 − 𝑦𝑦 = (𝑛𝑜𝑟𝑚𝑎𝑙 𝑔𝑟𝑎𝑑𝑖𝑒𝑛𝑡) ∗ (𝑥 − 𝑥𝑥) FUNCTION simultaneously solve for all normal equations and store points in ‘intersections’ matrix FUNCTION Take mean of ‘intersections’ matrix and store as ‘centre coordinate’ FUNCTION Take standard deviation of ‘intersections’ matrix and store as ‘centre error’ 14 Alexander Kennedy, z3218891 FUNCTION Take perpendicular distance between tangential points and intersection and similarly take mean and standard deviation, storing as diameter and diameter error. APPENDIX III: clf; close all; clc; %program management commands %load files and save them into matrix load '5m_90_90_a.mat' data=(X.Scans(:,180)); load '3m_90_90_a.mat' data = [data,(X.Scans(:,180))]; load '3m_90_90_a.mat' data = [data,(X.Scans(:,180))]; %stats commands stats_matrix=[data(:,1);data(:,2);data(:,3)]; %rearranges data matrix into vectors suitable %for computing statistics mean(stats_matrix) var(stats_matrix) std(stats_matrix) %plot commands hist(data) xlabel('Range (cm)') ylabel('Frequency (scan numbers)') title('Range vs Frequency') legend('90 turn, 90 tilt')%,'90 turn, 90 tilt','90 turn, 90 tilt')