Real-Time Particle Filter Localization on a Cortex-M7 Microcontroller: A Zephyr and Micro-ROS Implementation
Resource-constrained robotic platforms require localization estimators with predictable computational and memory costs. This paper presents the implementation and experimental characterization of a compact hybrid Extended Kalman Filter (EKF)–particle estimator on a single STM32H745 Cortex-M7 core under Zephyr RTOS and micro-ROS, distributed by STMicroelectronics, the Linux Foundation, and eProsima, respectively. This study originates from an existing autonomous-vehicle prototype whose localization pipeline runs on an NVIDIA Jetson platform and comprises two estimators in cascade: a 15-state pose-fusion EKF, which combines wheel-odometry and inertial data into a filtered local pose, followed by a map and vision-aided particle filter that uses the EKF output for particle propagation and incorporates UWB and occupancy-map likelihoods. This architecture provides both the application context and the reference trajectory for the present work, but its computational and sensing requirements prevent direct migration to a microcontroller. The localization function is therefore reformulated as a three-state estimator using wheel-encoder velocity, inertial measurements, and pre-trilaterated Ultra-Wideband (UWB) position fixes. A shared EKF maintains a Gaussian state approximation and supports particle-cloud regeneration, avoiding per-particle covariance matrices. The estimator is integrated into a statically allocated, two-thread architecture that separates middleware communication from estimation. Its performance was evaluated using a Hardware-in-the-Loop (HIL) approach, in which recorded vehicle sensor data were replayed through the physical STM32H745 target. An additional on-vehicle run verified the estimator’s operation within the live ROS 2 sensor graph. At the default configuration of 256 particles, the estimator achieved a position RMSE of 0.235±0.003 m (mean ± SD of run-level RMSE across 18 replays of the reference session in four campaigns) relative to the vehicle’s on-board reference estimator. In the dedicated operating-point campaign, the estimator had a mean update time of approximately 1.13 ms and no observed violations of the adopted 5 ms estimator-step limit. Accuracy changed only marginally for particle counts of 64 or more, whereas computational cost increased approximately linearly with particle count. The complete firmware occupied 196 KB of FLASH and 158 KB of RAM. These results establish the feasibility and empirical real-time envelope of the proposed embedded implementation, while absolute localization accuracy and performance under genuinely multimodal likelihoods remain subjects for future validation.
Authors
- Andrea Bonci (ORCID: https://orcid.org/0000-0003-0265-1598)
- Alessandro Di Biase (ORCID: https://orcid.org/0009-0008-2888-7295)
- Federico Brunella
- Matteo Colletta
- Angjelo Libofsha
Institutions
- Marche Polytechnic University (IT)
- Polytechnic University of Bari (IT)
Publication Details
- Journal
- Electronics
- Published
- 2026-10-04
- DOI
- https://doi.org/10.3390/electronics15194537
- Primary Topic
- Robotics and Sensor-Based Localization
- Type
- article
- Field-Weighted Citation Impact
- 0.00