# Localization of LHD Machines in Underground Conditions Using IMU Sensors and DTW Algorithm
## 3 Materials and Methods
### Application of the Algorithm  
The signal used for pattern recognition is the \(Z\)-axis accelerometer values. These are the linear acceleration values measured along the axis perpendicular to the plane on which the vehicle is driving. These values are therefore proportional to the vibration on this axis and seem to correspond best to the problem presented. Figure 7 shows four examples of accelerometer signals measured during training drives for the first pattern--(a) panels 1-5 directly one after the other. It can be seen that the signals vary in length and it is difficult to visually determine the similarities between them. Figure 5: Test rig used in experiments: (**a**) wheeled robot, (**b**) exemplary layout of modular mock-up simulating road conditions in an underground mine. Figure 6: Schemes of patterns prepared for the experiments. Figure 8 shows the graphs of the \(Z\)-axis accelerometer for three test drives along the route containing pattern (a). It can be seen that there is a greater variance in the first part of the signal, which corresponds to driving through the panels of the pattern that were placed at the start of the route. At the same time, it can be seen that this fragment is much longer, containing the first 7-8 s of the signal (training drives lasted up to 2 s). This is mainly due to the necessity of frequent correction of the vehicle's route and deliberate stopping before entering the ramp that was placed behind the pattern. The accelerometer measurements during the test drives were compared with the signals corresponding to the pattern for each training drive. An example of the results of the normalized Euclidean distance, which is the result of the DTW algorithm, is presented in Figure 9. It can be seen that the signals look very similar in each drive, which results from experimenting in laboratory conditions. It is not expected to obtain similar repeatability  
Figure 8: Accelerometer signals for three test drives for the pattern (a) composed of panels 1–5. Figure 7: Examples of accelerometer signals for training driving for pattern (a), composed of panels 1–5. during subsequent drives in industrial conditions. In each case, the moment of the pattern occurrence was correctly detected as the fragment with the lowest normalized DTW distance. In Figure 9, these are the fragments marked with a green circle. The same method was repeated for the subsequent shorter patterns--(b) composed of panels 1, 3, and 5 arranged directly one after the other; and (c) isolated panels 1, 3, and 5. In case (b), despite the shortened pattern, good results were still obtained, where the detection of the moment of pattern occurrence was possible for each signal (an example of matches is presented in Figure 10). However, there were signals in which too high a threshold resulted in a wrong match (the fragment marked with a yellow circle). On the other hand, when using only single panels as a pattern, it cannot be said that the DTW method allows the determination of the moment of pattern occurrence. Figure 11 shows exemplary results using panel number 3. The erroneous detection of the moment of pattern occurrence is marked in red, and the fragment that should have been detected is marked in green. However, it should be remembered that in this case, the length of the pattern was about 18 cm, which is approximately the wheelbase of the remote vehicle used for testing. This shows that the pattern must be long and complex enough to be detected by the DTW algorithm. Figure 10: DTW distance for selected training and test drives for pattern (b), composed of panels 1, 3, and 5 arranged directly one after the other. Figure 9: Normalized DTW distance between signals for three test drives and training drives for pattern (a), composed of panels 1–5.