3.1. The UGV Platform
The UGV platform used in this study was a MDB LV600 PRO (MDB, Fossacesia, Italy) multipurpose remote-controlled platform designed to operate in outdoor environments, as illustrated in
Figure 1.
The aim was to make this robotic platform autonomous by integrating a variety of multimodal sensors. The sensors were integrated in a sensor module called Sentry (as shown in
Figure 1 and attached on the top of the platform), and were responsible for the machine’s perception and control, enabling autonomous localization and navigation [
15,
16].
One of the fundamental parameters for the autonomous navigation of a robot is its orientation, which specifically consists of a direction vector indicating the alignment of the robot, with north coinciding with the Y-axis and east coinciding with the X-axis, projected onto a two-dimensional map. This orientation was determined by a Bosch BMM150 (Bosch Sensortec GmbH, Reutlingen, Germany) magnetometer present in the Sentry module. The magnetometer sensor measures the magnetic fields using the Hall effect [
17]. The sensor characteristics are shown in
Table 1.
The sensor has a semiconductor plate with an electric current flowing through it. When this semiconductor is exposed to an external magnetic field, a Lorentz force is applied, resulting in the movement of electrons to one side of the plate, generating a potential difference called the Hall voltage. This voltage is directly proportional to the intensity of the applied magnetic field, and the sensor measures the Hall voltage and converts it into a magnetic field reading [
17]. The BMM150 sensor contains three axes with high precision for detecting weak and strong magnetic fields. These characteristics contribute to the precise estimates of the robot’s state. Its structure can be observed in
Figure 2.
In this sensor, Hall effect components are responsible for detecting the magnetic fields around it and converting this information into an electrical signal. Subsequently, there are signal conditioning circuits that amplify/process the Hall sensor signal to ensure a more reliable reading. Then, the analog signal is converted into a digital signal through an ADC, which provides compatibility with microcontrollers and other electronic devices. The BMM150 sensor includes communication interfaces, such as the inter-integrated circuit (I2C) or serial peripheral interface (SPI) [
17]. This sensor is coupled to a module called Duro Inertial (
Figure 3) from Swift Navigation, which in turn is attached to the top of the Sentry.
The data from the magnetometer sensor is read using the Robot Operating System (ROS) framework, which communicates via the Ethernet with the Duro Inertial sensor, as depicted in
Figure 4. The corresponding source code is available at [
18].
Through the raw data obtained from the magnetometer, it is possible to manipulate the data to achieve the heading. Therefore, the following sections will discuss the performance of several moving average filtering techniques, with the aim of reducing the noise present in the signals.
3.2. Moving Average Filters
Moving average filters are widely used in engineering and economics to identify trends, smooth time-series data that exhibit short-term fluctuations, or to filter signals that are corrupted by AWGN noise. The most common versions are implemented using FIR filters, with the output, at each instant, being the weighted sum of a fixed number of past values of the input signal. This process is thereafter repeated, moving the window in order to calculate the mentioned weighted sum using new time-series data that includes new input samples, while discarding the oldest ones.
In a simple moving average (SMA) filter [
19], all the input data are equally weighted to produce an output value, which is obtained by multiplying the last
N input samples by a 1/
N factor and discarding those that fall outside this range. The SMA filter impulse response is, therefore, given by:
where
N is the filter length or number of samples taken in the averaging process.
The linear decay moving average (LDMA) filter, as the name indicates, is a moving average FIR filter whose weighting factors will decay linearly. The most recent input signal samples will have the highest weights and the oldest ones the lowest. The filter impulse response is similar to the Bartlett window, but only the decaying part is considered, thus
hLDMA is no longer even symmetrical around a central peak value. The LDMA filter impulse response is defined using expression [
20]:
The raised cosine moving average (RCMA) filter, as before, emphasizes the most recent input samples, which have the maximum weight, and undervalues the oldest ones. The proposed filter is based on the Hanning filter; however, only the part in which the weight values are progressively decreasing, according to a raised cosine shape, is considered (see
Figure A1 of
Appendix A), resulting in the RCMA impulse response:
Finally, an IIR filter named the exponential moving average (EMA) is considered to diminish the noise variance in the acquired signal. The EMA filter, first introduced in [
21], has an impulse response in which the past input values are geometrically reduced accordingly to their oldness. The EMA filter impulse response is given by:
The
β parameter, called the smoothing coefficient, is a positive real value less than one, which directly reflects the time constant that is intended to be implemented by the filter. In order to hold a unit DC gain, the filter constants
α and
β must fulfill the equation
α = 1 −
β. Moreover, Refs. [
20,
21] defines the relationship between the smoothing geometric constant
β and the SMA filter length
N, which results in a group delay or lag value equal to
, which is the one associated with an even symmetric or an asymmetric impulse response.
In order to design the most suitable filter, aiming to mitigate the inherent noise present in the magnetometer’s signals, it is necessary to analyze the frequency responses of the proposed filters.
The analysis of the SMA filter is a mature subject [
19,
22]; its transfer function is given by:
The zeros of
HSMA(
z) are located over the unit circle of the
z plane, starting at
z = 1, being separated by angles equal to 2π/
N. A pole-zero cancellation occurs at
z = 1, allowing the desired unitary DC gain. The location of the zeros on the unit circle leads to frequencies with zero gain and distinctive side lobes in the magnitude of the frequency response, as depicted in
Figure 5a,b for filters with
N equal to 11 and 21, respectively.
The LDMA filter transfer function is described by:
Analyzing the frequency response of the LDMA filter, it is possible to verify the existence of two poles at
z = 1 that will be canceled by two zeros of
HLDMA(
z); double pole-zero cancellation, being the remaining zeros now located inside the unit circle, resulting in a smoother frequency response at higher frequencies, as showed in
Figure 5.
The proposed RCMA filter transfer function is obtained by applying the definition:
developing the equation and dividing the summation in two, and thereafter applying the infinite geometric sum formula and the Euler identity, we get:
The RCMA filter transfer function is now rewritten considering that
:
The filter transfer function
HRCMA(
z) is given by:
The filter transfer function has three poles located on the unit circle that will cancel with three zeros, the remaining zeros are located inside the unit circle, resulting in a smooth magnitude response and a nonlinear phase response, which contrasts with the characteristics and the zero’s location on the Hanning window (
Figure A4 of
Appendix A).
The EMA filter transfer function is given by:
which corresponds to a first order IIR filter having a single pole at
z =
β, being its location fundamental to the noise mitigation and the definition of the time constant values.
3.3. Noise Reduction Analysis
The extraction of the desired signal from an acquired signal, which usually includes AWGN noise, is performed by means of an accurately designed filter H(z) that removes the unwanted noise leaving unaffected the desired signal features. Keeping in mind the peculiarities of the intended application, in this case the evaluation of the UGV heading based on coordinates taken from the magnetometer’s sensors, the designed denoise filter must remove as much noise as possible, with the minimum delay and distortion, preserving a unitary gain at frequencies close to DC.
The noise reduction effectiveness of a digital linear filter is measured by the noise-reduction factor (NRF), which quantifies the ratio of the output mean square noise values with respect to its input counterpart, defined by the following equations:
The output and input mean square noise values of the noise components of the signals are defined by and by , and , being the output and input noise time sequences, respectively, with , and also assuming linear filter usage that independently affects the desired signal and undesired noise that are superposed. Parseval’s theorem is also used to evaluate the energy of the filtered noise signal in the time domain, which is equivalent to the energy evaluated in the frequency domain, integrating the square of the filter magnitude response.
The NRF expressions of the considered moving average filters, SMA, LDMA, RCMA, and EMA, shown in
Table 2, were evaluated using (13).
The noise-reduction factor of the proposed RCMA filter follows definition (13):
By developing the binomial and dividing the summation into three parts, we obtain:
From the individual sums, we obtain the
expression:
The formulas were validated by simulations performed in MATLAB R2024a. In those simulations, it was considered that a deterministic signal (constant or sinusoidal) was corrupted by AWGN noise, with a particular variance value. The simulated NRF values were thereafter evaluated, dividing the filtered noise signal variance by the variance of the input noise for 108 length sequences.
From the results, shown in
Figure 6, it is observed that the NRF value decreases with the increase in the filter length, improving the noise mitigation capabilities of the mentioned digital filters. For comparison purposes, an equivalent
β parameter is used for the EMA filter that satisfies (5). Among the studied filters, the SMA filter is always the one that offers the best performance in terms of noise reduction for the same equivalent filter length.
Keeping in mind that the planned solution will be implemented in the real-time trajectory control of an autonomous UGV, it is crucial that its position and direction values have been acquired and processed with minimum latency. The autonomous vehicle’s heading values are obtained using the magnetometer’s signals that are corrupted by noise, thus the noise minimizations filters must introduce minimum latency or lag. Thus, from now on, the performed analysis must consider the filter delay as the reference parameter instead of the filter order. Moreover, the literature has shown that a larger noise-reduction factor is always associated with an increase in the filter group delay or lag.
The application of linear-phase FIR filters, implemented by even or odd symmetrical windows, is a mature topic, resulting in a group delay value equal to . The delay group is also independent of the frequency, being the derivative of the filter delay. That value is constant irrespective of the observed frequency. As presented above, the SMA filter has a symmetrical impulse response around a central point, satisfying the previous assumptions. The proposed LDMA and RCMA filter impulse responses are no longer even symmetrical, since they have been restricted to the descending part of the classical Bartlett and Hanning windows, respectively.
To evaluate the group delay (GD) at DC, the lag or latency of the proposed filters, we used a generic formula presented in [
23]. The group delay at DC is evaluated computing the following summation:
where
n is the index number and
is the filter impulse response. This expression is easily computed by simply multiplying, element by element, the filter impulse response vector, by a vector with linear increasing integer values (ramp signal).
Appling (17) to the analyzed filters result in expressions, shown in
Table 3, that can be used to evaluate the GD of the proposed filters based only on the filter length
N. The GD expression for the RCMA filter approximates the exact result computed, as the filter length increases the error of that evaluation becomes negligible.
From the results presented in
Figure 7 it can be concluded that the GD value increases with the increase in the filter length. The RCMA filter produces the lowest latency, followed by the LDMA filter. Due to its even symmetry, the SMA filter produces a group delay value higher than the mentioned ones. It can also be concluded that the RCMA and LDMA filters have a lower latency value than that associated with the Bartlett and Hanning windows, for the same filter length.
Figure 7 is a valuable resource in the assessment of the filter lengths that produce the same GD or latency value. As an example, for a target latency equal to 10 samples it is advisable to use: an SMA filter with
N = 21; an LDMA filter with
N = 31; an RCMA filter with
N = 35; and an EMA filter with
β equal to 10/11.
To validate the GD expressions, simulations were conducted to quantify the filtered signal delay regarding a sinusoidal input signal.
Figure 8a,b presents the sinusoidal response of the considered filters, SMA, LDMA, RCMA and EMA, for lengths equal to 11 and 21, or equivalent values, respectively. From the obtained results it can be concluded that the RCMA filter presents the lowest latency at 119.38 ms, followed by the LDMA filter with a value of 133.33 ms and, finally, the SMA and EMA filters present a similar GD value of 200 ms. The same tendency is observed for filters with a length equal to 21. The filtered sinusoidal signal amplitudes are slightly different; this arises from the different gain values of the filter’s magnitude frequency response at the signal frequency
, as shown in
Figure 5a,b, with the EMA filter magnitude being the lowest and the RCMA filter the highest one.
The next stage of our analysis consists of a comparative study on the performance of moving average filters, assuming that the filters are of equal length. From the obtained results, as shown in
Table 4, we can conclude that the SMA filtering technique outperforms the LDMA and RCMA techniques. The NRF value of the SMA filter is the lowest one among the considered filters; on the other hand, the latency or group delay value of the SMA filter is the largest. Although the EMA filter presents a similar result with respect to the SMA filter, its step response exhibits an undesirable behavior, underperforming in comparison to the other analyzed filters. In the conducted analysis, the magnetometer signals have been taken at a sampling rate of 25 Hz, i.e., a sampling time interval of 40 ms.
Filters processing time delay, as already known, have a noticeable degrading effect on control system performance, namely those that involve close loop control [
24]. Thus, for the considered UGV position control mechanism, two maximum latency values were defined for the conducted analysis and simulations: 200 ms and 400 ms. For the abovementioned sampling time of 40 ms, the latency values correspond to 5 and 10 samples, respectively. Thus, knowing that the SMA filter latency is equal to
, then these values correspond to filter lengths equal to
NSMA = 11 (200 ms latency) and
NSMA = 21 (400 ms latency).
The next step is the LDMA filter
NLDMA value assessment, which results in the same group delay value with respect to a particular SMA filter. Rearranging the expressions presented in
Table 3, it is possible to evaluate the
NLDMA, based on the SMA filter
NSMA value, using (18).
The obtained
NLDMA value is now used to evaluate the NRF of the LDMA filter, which produces the same latency as an SMA filter with length
NSMA. From the obtained expression and results, we conclude that this innovative solution always outperforms the SMA filter, ensuring a given latency target value.
An SMA filter of length 11 reduces the noise by a factor of 0.09091 (1/11) and produces a latency equal to five samples, those values are compared with an LDMA filter of length 16, which produces the same latency and reduces the noise by a factor of 0.08088 (11/136), as can be seen in
Table 5. As explained before, the SNR is inversely proportional to the NRF, thus the proposed LDMA filter usage outperforms the SMA filter by 0.50753 dB. For longer filter lengths that value converges to 0.51153 dB. Moreover, the observed trend in the results is independent of the latency value, as can be seen for the LDMA filter of length 31, which outperforms the SMA filter of length 21, both filters having a group delay of 10 samples.
Despite the lack of a closed formula to assess the group delay of the RCMA filter, it is possible to observe from the results presented in
Table 5 that an RCMA filter with
N = 17 will reduce the noise by a factor of 0.08488, with a latency value of 190.60 ms. This result is better than the one obtained for the SMA filter, but slightly worse than the corresponding one attained for the LDMA filter. If a 1.2% increase in the latency value to 202.48 ms is allowed, then an
N = 18 filter with an NRF value of 0.08033 can be used, which performs better than the equivalent LDMA filter of length 16. The same trend is observed in the filter’s performance, if a 400 ms group delay was considered as a design constraint value.
The obtained results can also be verified in the frequency domain.
Figure 9 presents the frequency response of the filters for an equal group delay, with it being possible to observe the lowest magnitude of the LDMA and RCMA filters’ frequency responses for frequencies higher than that associated with the first null of the SMA filter’s response. That observation explains the improved performance in regard to the noise reduction goal of those filters with different lengths, while maintaining the latency constant. A non-significant advancement was obtained from the EMA filter usage.
Now, to validate the new proposed method, a transient analysis of the considered filters is performed [
25].
Figure 10a shows the step response of the filters, assuming that they have a length of 11. From the results obtained, it is possible to conclude that the LDMA and RCMA filters respond faster than the SMA filter, this is consistent with the lower GD values observed; however, all three filters, SMA, LDMA and RCMA, reach the final stage value after 11 samples only, due to the inherent DC unit normalization [
20,
25]. The EMA filter step response is slower and takes a significantly extended time period to reach the final value of the step. In that analysis, a
β = 5/6 value was considered for the EMA filter, which is equivalent to an SMA filter with
N = 11, according to (5).
Figure 10b presents the step response of the filters, with different length values, which produce the same GD or latency value. Once again, all the filters respond faster than the SMA filter until a particular point, around 80% of its final value. Thereafter, the LDMA and RCMA filter responses are slower, since the weights associated with the oldest values of their impulsive response are significantly smaller, contributing less to the output value. Moreover, only after 16 and 18 times, the sampling interval, respectively, did the mentioned LDMA and RCMA filters reach the exact step value.