Discrete Unilateral Constrained Extended Kalman Filter in an Embedded System
Abstract
1. Introduction
2. Preliminaries
2.1. Discrete Extended Kalman Filter
- is the estimation of the state before .
- is the predicted covariance matrix of the estimation error.
- is the Kalman gain.
- describes, although locally, the optimal estimation of .
- is the updated covariance matrix of the estimation error.
- and are symmetric and positive definite matrices capturing in their diagonals the variances of and , respectively.
2.2. Discrete System with Unilateral Constraints
2.3. Discrete Hybrid Van der Pol Oscillator
3. Discrete Unilateral Constrained Extended Kalman Filter
- The system trajectory reaches the impact surface during the time instants and the estimated trajectory remains beyond this surface, i.e., and . For this scenario, the error is
- The estimated trajectory reaches the constraint during the impact time instants and the system trajectory remains beyond this surface, i.e., and . For this scenario, the error is
4. Results
4.1. MATLAB Simulation
4.2. Experimental Results
- In the first process, the estimated average execution time of the main algorithm on the dsPIC33EP512MU810 in U1 was 248 µs per iteration. The execution time is based on the clock frequency and code efficiency, which was aimed at minimizing the execution time of operations.
- In the second process, the four state variables were reproduced by DAC60508 in 120 µs per iteration.
- In the third process, a graphic routine generated points and lines to display the phase portraits on the TFT-LCD screen of U1. This process took 67.932 ms per iteration to convert the numerical data into a text string and display it, illustrating estimated and real phase portraits.
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
Abbreviations
DAC | Digital-to-Analog Converter |
DHVPO | Discrete Hybrid Van der Pol Oscillator |
DRE | Difference Riccati Equation |
DUCEKF | Discrete Unilateral Constrained Extended Kalman Filter |
EKF | Extended Kalman Filter |
ES | Embedded System |
KF | Kalman Filter |
LCD | Liquid Crystal Display |
SPI | Serial Peripheral Interface |
TFT | Thin Film Transistor |
WGN | White Gaussian Noise |
Appendix A. Algorithm Implementation
Process | Description | Step | Time (s) |
---|---|---|---|
1 | Main algorithm of DHVPO (12) and DUCEKF (16) computed on U1. | 9–19 | 248 |
2 | Graphical representation of the phase plane from DHVPO (12) versus phase plane from DUCEKF (16). Numerical values of the states , , , and are also displayed on the TFT-LCD. | 20–22 | 67,932 |
3 | Output of state variables and of DHVPO (12), and and of DUCEKF (16) reproduced by DAC. | 23 | 120 |
TOTAL | 68,300 |
Appendix A.1. Experimental Validation via DAC Output and TFT-LCD
Appendix A.2. Experimental Validation Using Execution Time-Paths
- At step 10, an initial condition is evaluated. If the condition is true, the algorithm proceeds along Route 1 (0.2 s); otherwise, it follows Route 2 (0.2 s). The evaluation in this conditional aims to determine the previous DHVPO position to establish the direction of position change, whether decreasing or increasing, for the next conditional.
- step 13 evaluates a second condition. A true result leads to Route 3 (243 s), while a false result directs execution to Route 4 (252 s). This evaluation checks if the DHVPO has made contact with the impact surface. If the position is positive, falls within the activation set, and is decreasing, then it indicates that the impact surface has been reached.
- step 17 introduces a third conditional branch. If the condition holds, Route 5 (0.8 s) is selected; otherwise, Route 6 (0.8 s) is taken. This condition occurs only if the previous condition has not been met, which implies that the DHVPO did not hit the impact surface. In this case, it is necessary to verify whether the DUCEKF has impacted the surface. If it has, then the DUCEKF is positioned on the impact surface prior to the DHVPO, and a hold is applied since the DUCEKF is synchronized with the DHVPO to execute the transition. If the DUCEK has not hit the surface, the EKF continues its operation in the smooth branch.
- Path 1: uses Routes 1, 4, and 6.
- Path 2: uses Routes 2, 4, and 6.
- Path 3: uses Routes 2 and 3.
- Path 4: uses Routes 2, 4, and 6.
Path | k Iteration | Route, Time (s) | Route, Time (s) | Route, Time (s) | Qty |
---|---|---|---|---|---|
1 | 1 | 1, 0.2 | 4, 252 | 6, 0.8 | 1 |
2 | 2–314 | 2, 0.2 | 4, 252 | 6, 0.8 | 313 |
3 | 315 | 2, 0.2 | 3, 243 | – | 1 |
4 | 316–350 | 2, 0.2 | 4, 252 | 6, 0.8 | 35 |
Appendix A.3. Statistical Analysis of Execution Times
- P: total number of k executed iterations (i.e., 350 total iterations covering the occurrences of the four paths).
- : number of occurrences for each unique execution path i, with .
- : total execution time for a complete route sequence corresponding to path i.
- Mean:The execution time for paths 1, 2, and 4 is identical and is denoted by = 253.0 s. In contrast, path 3 has a different execution time, defined as = 243.2 s. The sample weighted mean is:
- Variance and Standard Deviation:The variance is defined as:Replacing with numbers:
References
- Kalman, R.E. A New Approach to Linear Filtering and Prediction Problems. Trans. ASME-J. Basic Eng. 1960, 82, 35–45. [Google Scholar] [CrossRef]
- Kong, N.J.; Payne, J.J.; Council, G.; Johnson, A.M. The Salted Kalman Filter: Kalman filtering on hybrid dynamical systems. Automatica 2021, 131, 109752. [Google Scholar] [CrossRef]
- Gao, Y.; Yuan, C.; Gu, Y. Invariant filtering for legged humanoid locomotion on a dynamic rigid surface. IEEE/ASME Trans. Mechatron. 2022, 27, 1900–1909. [Google Scholar] [CrossRef]
- Chatzis, M.N.; Chatzi, E.N.; Triantafyllou, S.P. A discontinuous extended Kalman filter for non-smooth dynamic problems. Mech. Syst. Signal Process. 2017, 92, 13–29. [Google Scholar] [CrossRef]
- Li, H.; Zhou, Z.; Li, X.; Zhang, X. Design of nonsmooth Kalman filter for compound sandwich systems with backlash and dead zone. Int. J. Robust Nonlinear Control 2021, 31, 7072–7086. [Google Scholar] [CrossRef]
- Zhu, J.; Li, T.; Wang, Z. A parameter estimation method based on discontinuous unscented Kalman filter for non-smooth gap systems. Mech. Syst. Signal Process. 2023, 204, 110821. [Google Scholar] [CrossRef]
- Li, B.; Tan, Y.; Zhou, L.; Dong, R. Robust-nonsmooth Kalman filtering for stochastic sandwich systems with dead-zone. Int. J. Control. Autom. Syst. 2021, 19, 101–111. [Google Scholar] [CrossRef]
- Chatzis, M.N.; Chatzi, E.N. A discontinuous unscented Kalman filter for non-smooth dynamic problems. Front. Built Environ. 2017, 3, 56. [Google Scholar] [CrossRef]
- Westervelt, E.R.; Grizzle, J.W.; Chevallereau, C.; Choi, J.H.; Morris, B. Feedback Control of Dynamic Bipedal Robot Locomotion; CRC Press: Boca Raton, FL, USA, 2018. [Google Scholar]
- Chevallereau, C.; Grizzle, J.W.; Shih, C.L. Asymptotically stable walking of a five-link underactuated 3-D bipedal robot. IEEE Trans. Robot. 2009, 25, 37–50. [Google Scholar] [CrossRef]
- Montano, O.; Orlov, Y.; Aoustin, Y.; Chevallereau, C. Orbital stabilization of an underactuated bipedal gait via nonlinear H∞ control using measurement feedback. Auton. Robot. 2017, 41, 1277–1295. [Google Scholar] [CrossRef]
- Herrera, L.; Orlov, Y.; Montaño, O.; Aguilar, L.T.; Verdés, R.I. Robust Tracking Control of Mechanical Hybrid Systems Driven by Electrical Actuators. IFAC-PapersOnLine 2020, 53, 9106–9111. [Google Scholar] [CrossRef]
- Possieri, C.; Sassano, M.; Galeani, S.; Teel, A.R. The linear quadratic regulator for periodic hybrid systems. Automatica 2020, 113, 108772. [Google Scholar] [CrossRef]
- Chevallereau, C.; Abba, G.; Plestan, F.; Westervelt, E.; de Wit, C.C.; Grizzle, J. Rabbit: A testbed for advanced control theory. IEEE Control Syst. Mag. 2003, 23, 57–79. [Google Scholar]
- Herrmann, F.; Schmälzle, P. Simple explanation of a well-known collision experiment. Am. J. Phys. 1981, 49, 761–764. [Google Scholar] [CrossRef]
- Cross, R. The coefficient of restitution for collisions of happy balls, unhappy balls, and tennis balls. Am. J. Phys. 2000, 68, 1025–1031. [Google Scholar] [CrossRef]
- Herrera, L.; Meza-Sánchez, M.; Clemente, E. Unilateral Constrained Extended Kalman Filter. IEEE Control Syst. Lett. 2024, 8, 2015–2020. [Google Scholar] [CrossRef]
- Herrera, L.; Montano, O.; Orlov, Y. Hopf bifurcation of hybrid Van der Pol oscillators. Nonlinear Anal. Hybrid Syst. 2017, 26, 225–238. [Google Scholar] [CrossRef]
- Méndez-Ramírez, R.; Arellano-Delgado, A.; Murillo-Escobar, M.A.; Cruz-Hernández, C. Multimedia contents encryption using the chaotic MACM system on a smart-display. In Cryptographic and Information Security Approaches for Images and Videos; CRC Press: Boca Raton, FL, USA, 2018; pp. 263–295. [Google Scholar]
- Dilys, J.; Stankevič, V.; Łuksza, K. Implementation of extended Kalman filter with optimized execution time for sensorless control of a PMSM using ARM cortex-M3 microcontroller. Energies 2021, 14, 3491. [Google Scholar] [CrossRef]
- Ma, Y.; Duan, P.; He, P.; Zhang, F.; Chen, H. FPGA implementation of extended Kalman filter for SOC estimation of lithium-ion battery in electric vehicle. Asian J. Control 2019, 21, 2126–2136. [Google Scholar] [CrossRef]
- Simon, D. Optimal State Estimation: Kalman, H Infinity, and Nonlinear Approaches; John Wiley & Sons: Hoboken, NJ, USA, 2006. [Google Scholar]
- Montano, O.E.; Orlov, Y.; Aoustin, Y. Nonlinear H∞ control under unilateral constraints. Int. J. Control 2016, 89, 2549–2571. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 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/).
Share and Cite
Herrera, L.; Méndez-Ramírez, R. Discrete Unilateral Constrained Extended Kalman Filter in an Embedded System. Sensors 2025, 25, 4636. https://doi.org/10.3390/s25154636
Herrera L, Méndez-Ramírez R. Discrete Unilateral Constrained Extended Kalman Filter in an Embedded System. Sensors. 2025; 25(15):4636. https://doi.org/10.3390/s25154636
Chicago/Turabian StyleHerrera, Leonardo, and Rodrigo Méndez-Ramírez. 2025. "Discrete Unilateral Constrained Extended Kalman Filter in an Embedded System" Sensors 25, no. 15: 4636. https://doi.org/10.3390/s25154636
APA StyleHerrera, L., & Méndez-Ramírez, R. (2025). Discrete Unilateral Constrained Extended Kalman Filter in an Embedded System. Sensors, 25(15), 4636. https://doi.org/10.3390/s25154636