*3.2. Robustness Test*

For evaluating the robustness of the filter, the four-bar linkage is equipped with a torsional spring actuating over the crank angle. In order to replicate a failure, at 5 s, the spring breaks. In this new scenario, the *real mechanism* continues the maneuver without the spring, while the *observer* is still considering its existence for the dynamics. This test is useful to analyze the response of the filter to unexpected changes. The *observer* is also under the errors of previous tests: 1 m/s<sup>2</sup> in gravity acceleration. In addition, the initial value of the crank angle has an offset of *π*/16 rad.

The results in terms of force estimation are shown in Figure 15. The estimated force can be understood as the torque, which would have to be applied to the crank to compensate the errors. It is equivalent to the difference between the force applied in the *real mechanism* and the *model*. It can be seen how, at the time of 5 s, the *observer* has to subtract the force in the crank. Since there is no spring in the *real mechanism*, the *observer* needs to apply a torque equal in magnitude but different in sign to the torque applied by its spring.

**Figure 15.** Torque estimation for the four-bar linkage for the spring failure scenario. *Obs* refers to the estimated torque and *Ref* refers to the theoretical value.

It can be seen how, except for the encoder configuration, the *observer* tracks the reference values. In addition, the filter responses with immediacy to the spring failure. This time response can be achieved by adjusting the innovation window length, seeking for a compromise between accuracy and time response. For this case, the window length is of 50 samples. Regarding the encoder configuration, the behavior is similar to what could be appreciated in [9]. There is a delay in the estimation and the noise is noticeable. It can be explained by the fact that obtaining acceleration from position information.

With respect to the other three configurations, the estimations present a reduced noise, being the use of accelerometers the most accurate solution. The use of gyroscopes shows a good behavior before the spring breaks. Once this event takes place, both tests show a remarkable overshooting which is quickly corrected at expenses of higher noise. However, in both cases, it can be appreciated how the noise is being reduced with time. This is in line with what is shown in Figure 16.

**Figure 16.** Error and confidence interval of the position, velocity and acceleration of the crank angle in the configuration which considers a gyroscope on the coupler.

It can be seen how the confidence interval becomes wider when the spring breaks. In terms of the PNCM, it means that the AerrorEKF-FE has detected the change in the *real mechanism*. To address this new modeling error, the filter increases the values of the PNCM giving more relevance to the sensor measurements. Once that the *observer* tracks the new scenario of the *real mechanism*, the covariances are reduced together with the noise of the estimations.

### *3.3. Computational Cost*

For most of the industrial applications, it is required to achieve real-time performance. In previous works, the errorEKF-FE has proven to be capable of running in real time with complex multibody models [10]. Hence, it is of interest to analyze the increment in computational cost derived by the presented adaptive procedure.

It is important to remark that this work is developed in MATLAB®, which is not oriented to real-time applications. Hence, measuring the computation time of the algorithm is not a fair test. However, since the errorEKF-FE and AerrorEKF-FE are executed under the same conditions, a reference in the increment in computational cost can be derived. It can be seen in Table 5. From the results, it can be concluded that the AerrorEKF requires about the double of time than the error errorEKF-FE for computing the same simulation.

**Table 5.** Computational cost analysis of the AerrorEKF-FE. The simulations tested correspond to the use of position sensors.


#### **4. Discussion**

From the presented results, it can be seen that the adaptive version of the errorEKF-FE solves one of the main drawbacks of the filter: setting the values of the process noise covariance matrix. The tests performed during this work show that, with independence of the initial assumptions on the PNCM, the AerrorEKF-FE converge to an accurate solution. As shown during the accuracy test, the AerrorEKF-FE is able to achieve a similar level of error in the estimations despite of the initial values of the PNCM. This allows to reduce the development time of multibody-based Kalman filters, where the determination of the statistics of the system is a tedious process. In addition, even though the maximum likelihood method depends on a sliding window of the past innovation, the filter has shown an acceptable response to sudden changes in the system. Through the simulation of a sudden failure in the *real mechanism*, the robustness of the filter is tested. The results show that the estimator is able to track the new situation and correct the new error with accuracy, without compromising the convergence of the simulation.

It can also be concluded that, although the measurement noise covariance matrix can also be estimated through the ML method, in this particular case it led to a filter divergence in the absence of accelerometers. When the estimator detects an error, it starts to rely on the corrections in the measurements instead of the model. However, through sensors in position or velocity, the acceleration cannot be obtained with accuracy and hence, the error cannot be corrected. This, together with the non-linearities of the model, leads to a divergence of the filter. In addition, the estimation of the MNCM did not offer an improvement of the estimations. However, as opposite from the PNCM, it is possible to obtain an acceptable initial value for the MNCM after characterizing the sensors or through the information provided by the manufacturer of each sensor.

The length of the sliding window for the innovation sequence is also an important factor and one of the main limitations of the approach. A large window size can result into wrong estimations in maneuvers with high variability. This is one of the known disadvantages of the ML method, since there does not exist a general rule in order to select the most suitable innovation window length. Algorithms such as Sage-Husa are focused on minimizing the impact of the window length by giving different weights to the elements of past events, giving higher weights to the more recent events.

Regarding the computational cost, the AerrorEKF-FE has lower efficiency than the errorEKF-FE due to the adaptive procedure. Estimating the process noise covariance matrix each time step entails an increment of the computations per time step, which is turned into a noticeable increment of computational cost. This limitation can be critical in real-time applications. It is necessary to test the computational cost of the method in each particular application. The efficiency of the estimator not only depends on the algorithm, but on the platform where it is going to be executed. This also implies to explore the possibility of increasing the efficiency of the solution. Since the estimation of the noise covariance matrices is independent from the state estimation each time step, the code execution can be parallelized, increasing the algorithm efficiency and reducing the computational cost of the approach.
