**1. Introduction**

Measurement of track geometry irregularities is a fundamental task in railway track maintenance with immense economic significance worldwide. Geometric irregularity is the most important track feature affecting safety and comfort of the rail transport. There are two different equipment that rail administrations and infrastructure managers use for track irregularity measurement: man-driven *rail track trolleys* (RTT) and *track recording vehicles* (TRV), also called *laboratory vehicles* or *inspection vehicles*. There are many companies that manufacture both types of equipment. The technology behind the RTT is simple and accurate. The relative irregularities, this is, gauge and cross-level are measured with a distance sensor, like an LVDT, and an inclinometer, respectively. The absolute irregularities, alignment and longitudinal profile require and absolute positioning system, like a total station or a very accurate GNSS. The technology used in TRV is more varied. Essentially, there are two technologies [1]: versine measurement systems (VMS), also called chordbased measurement systems and inertial measurement systems (IMS) or optical-inertial measurement systems. In addition to the sensors used, the main difference between these two methods is on the reference kinematics. The VMS use a physical reference, the chord, that can be a solid bar or a laser beam, while the IMS use an inertial reference frame or, in other words, the frame does not physically exist. The existence of the physical reference is an important advantage of the VMS that improves its accuracy. The main drawback of the VMS is that only irregularities with wave-lengths shorter than the length of the physical reference can be measured. A purely inertial IMS, as those based on accelerometer measurements, is based on the premise that the measuring device follows a trajectory that

**Citation:** Escalona, J.L.; Urda, P.; Muñoz, S. A Track Geometry Measuring System Based on Multibody Kinematics, Inertial Sensors and Computer Vision. *Sensors* **2021**, *21*, 683. https://doi. org/10.3390/s21030683

Academic Editor: Felipe Jiménez Received: 22 December 2020 Accepted: 15 January 2021 Published: 20 January 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

is parallel to one of the rails or the track centerline. This is in practice very difficult to obtain, or even impossible, if one wants to get the four irregularities with a single device. However, the most serious problem of the IMS is not that but the need to integrate the sensor signals in time to get the irregularities. The resulting accuracy depends very much on the filtering and other signal processing techniques that are needed to avoid the signal drift due to the integration.

The scientific foundation of the VMS is based on simple kinematics that only requires the measurements of distance sensors. The main challenge is to find the transfer function between the chord measurements and the vertical and lateral track irregularities [1,2]. The kinematics of the IMS is much more involved, due to the use of the inertial frame, as mentioned previously, and the use of different sensors (distance sensors, optical and inertial) requiring sensor fusion algorithms. To the authors' best knowledge, the description of the TRV used in the early eighties in British Rail by Lewis [3] remains the most complete description of the kinematics and signal processing behind the track geometry measurement with IMS. This paper tries to fill this gap. In a paper by Escalona [4], the calculation of the track vertical geometry using inertial sensors mounted on an un-suspended bogie was fully described, including analytical relationships, transfer functions, sensor fusion algorithms and signal processing. However, the method was valid only for the vertical geometry and the results were not experimentally validated.

Despite the existence of different measuring equipment, there is a need for improvement of the technology in track geometry inspection. RRT are much cheaper than TRV (small rail administrations cannot afford TRV) but much slower also. As a result, the frequency of track geometry inspection is not as high as desired. Due to this reason, there is an increasing tendency in the railway industry and research teams to developed track geometry measuring systems (TGMS) to be installed in in-service vehicles. That way, the frequency of the inspection is increased, the vehicle response to the irregularity can be measured simultaneously, and the time-evolution of the irregularities can be followed closely. However, what the sensors can get in an in-service vehicle, in general, is not a measurement of the irregularity but an estimation. There are two approaches: purely kinematic or model-based methods. Weston et al. published a set of papers [5–7] showing the measurement of vertical and lateral track irregularities using accelerometers and gyroscopes mounted in the bogie frame and a very simple kinematic model of the vehicle motion. Although these papers do not show results in frequency domain, the measured irregularities could only be relatively accurate for low frequencies, because the bogie frame does not follow the high frequency irregularities. Lee et al. [8] presented a Kalman filter data fusion approach based on accelerometer signals mounted on the body frame and the axle-box. Tsai et al. [9,10] presented a fast inspection technique based on the Hilbert–Huang Transform, that is a very useful time–frequency analysis technique, applied to the signal of an accelerometer mounted on the axle-box of an in-service car. Both methods that are based on axle-box-mounted accelerometers are only valid to measure vertical track irregularities. Tsumashima et al. [11] estimated the vertical track geometry using the accelerations measured in the car-body of the Japanese Shinkansen using a Kalman filter based on a very basic car model. In a more recent work, Tsumashima [12] has develop a method to detect and isolate track faults that are later classified using machine learning techniques. Tsumashima and Hirose [13] have applied the time–frequency Hilbert–Huang Transform method to identify track faults using the measured car-body acceleration as the input.

This paper describes a TGMS based on inertial sensors and computer vision that can be installed in in-service vehicles. The 3D kinematics used for the geometry measurements considers a general track design geometry, and the assumed kinematic approximations and simplifications are fully described. As a result of the background of the authors in on the development of multibody dynamics models for railway simulations [14–16], the presented kinematic equations follow the multibody formalism. The kinematic equations used for the computer vision are adapted to this formalism. The sensor fusion algorithms and signal processing tools used to find the track irregularities are explained also. The presented

TGMS has been built, tested and validated in an experimental scale track facility. Compared with the existing IMS methods that are implemented in the industry, the contribution of the method presented in this paper lies in the description of the methodology and the experimental validation. To the authors' best knowledge, the algorithms used to turn the sensors data into measured irregularities have not been described in the scientific literature, or they are described using an over-simplified track geometry, for example, assuming that the track is straight. This information is not provided by the companies that work in the important business of track inspection. In addition, an experimental proof of the accuracy of the equipment used for this task in not generally provided by these companies. This paper provides a full description of the signal processing that can be used to turn the sensors data into track irregularities. As shown below, the kinematic analysis needed to this end is not straightforward. This paper also provides an experimental validation of the measured irregularities. Authors do not claim that the presented method is more accurate or more efficient than existing methods, simply because the data are not accessible to compare.

This paper is organized as follows: Section 2 describes the sensors needed and the main features of the TGMS. Section 3 explains the kinematics of the irregular track and the rail vehicles based on the multibody dynamics formalism. Section 4 applies this formalism to the kinematics of the computer vision with the pin-hole camera model. Section 5 explains the method that is used to find the relative position of the rail cross-sections with respect to the moving vehicle using the computer vision data. Section 6 shows the kinematic relationships that are used to find the four track irregularities: gauge variation, cross-level, alignment and vertical profile, as a function of the sensors data. Section 7 describes a Kalman filter that is used to calculate the TGMS relative orientation with respect to the track. Section 8 describes an odometry algorithm that is used to locate at any instant the vehicle along the track. Section 9 explains the method that is used to find the relative trajectory of the TGMS with respect to the track centerline. The content of Sections 5–9 includes all the calculations needed to obtain the track irregularities out of the sensors data. Finally, Section 10 shows the experimental setup that has been used to build and validate the TGMS system and Section 11 compares the measured irregularities with accurate reference values. Summary and conclusions are given in Section 12.

#### **2. Description of the TGMS**

The TGMS sketched in Figure 1 (only right-side equipment in shown here) comprises:


It is important that the cameras, lasers and IMU are installed in a solid that can be considered as a rigid body when moving with the vehicle. The lasers and cameras must be equipped with orientation mechanisms that can be fully locked when the TGMS is working. The laser projectors draw red lines (when using a red laser) in the rail-heads (one on the left, one on the right) that are filmed by the video cameras. The information provided by the position and orientation of the red lines in the rails, together with the acceleration and angular velocity acquired with the IMU, are used to find the track geometry irregularities.

**Figure 1.** Kinematics of the Track Geometry Measuring System (TGMS) installed in a vehicle moving along the track.

The main features of the proposed system are:


Measuring devices must be selected taking into account the dusty environment under the train, affecting mainly the computer vision system, and the high level of accelerations that they will be subjected to. Protecting the video cameras and laser projectors may be solved, in part, locating them in a closed box with a polycarbonate window that must be cleaned frequently. Regarding the high level of accelerations, their expected value depends on the solid where the equipment is installed. The most critical body would be the axle-box (wheelset level) where the vertical accelerations can reach 100 g in high velocity trains. Reducing the possibility of damaging the measuring devices due to excessive accelerations is achieved if the equipment is installed at the car-body level.

#### **3. Kinematics of the Irregular Track and the Railway Vehicle**

This section includes the kinematic description of the rail geometry as a combination of a design geometry and the irregularities, and the kinematic description of an arbitrary body moving along the track, like the TGMS. Before presenting the kinematics, the different frames that are used and the nomenclature used to describe vectors, matrices and their components are described.

#### *3.1. Frames of Reference*

As shown in Figures 2 and 3, four different frames are used in railroad kinematics:


**Figure 2.** Kinematics of a body moving along the track.

The definition of the TF is such that the *X<sup>t</sup>* axis is tangent to the track design centerline, the *Y<sup>t</sup>* axis is perpendicular to *X<sup>t</sup>* and connects the origin *Olrp* of the LRP and the origin *Orrp* of the RRP in the design track geometry (with no track irregularities) and the *Z<sup>t</sup>* axis is perpendicular to both *X<sup>t</sup>* and *Y<sup>t</sup>* . Therefore, the TF is not the Frenet frame of the design track centerline. Each body *i* moving along the track has an associated TF at each instant of time. Its position and orientation can be obtained substituting the position of the body along the track, *s<sup>i</sup>* (*t*), in the functions **R***<sup>t</sup>* (*s*) and **A***<sup>t</sup>* (*s*) that are explained in next section. More details about the rail kinematics and the nomenclature used in this work for vectors and rotation matrices can be found in [17].

**Figure 3.** Kinematics of the irregular track cross-section.
