$ show cra-ros-pkg/robot_localization
robot_localization is a ROS 2 package providing nonlinear state estimation for mobile robots using Extended (EKF) and Unscented Kalman Filters (UKF). It fuses multiple sensor inputs—including odometry, IMU, GPS, pose, and twist measurements—into a consistent, filtered pose estimate (position, orientation, velocities, accelerations) published as `/odometry/filtered` and broadcast as TF transforms following REP-105 conventions. The architecture is centered around a templated `RosFilter<T>` class that wraps the core `FilterBase` abstract class, handling measurement queuing, differential/relative modes, Mahalanobis outlier rejection, and diagnostic monitoring. Key entry points are `ekf_node`, `ukf_node`, and `navsat_transform_node` (for GPS-to-local Cartesian conversion), all instantiated from `ros_filter.cpp` and `navsat_transform.cpp`. The package also provides services like `SetPose`, `SetDatum`, `ToLL`, and `GetState`, and includes lifecycle node support for managed operation. The codebase is well-known for its extensive parameterization—each sensor input can be individually configured with update vectors, differential/relative flags, noise terms, and rejection thresholds—making it adaptable to diverse robot platforms. It depends on Eigen for linear algebra, GeographicLib for geodetic conversions, and standard ROS 2 infrastructure (tf2, diagnostic_updater). The core filter logic (`FilterBase`) and coordinate conversion utilities (`navsat_conversions.hpp`) are clean, isolated components that can be reused outside the ROS ecosystem. Despite its popularity and solid engineering, the repository shows signs of technical drift: incomplete ROS 1→ROS 2 migration, deprecated API usage (`rclcpp::Duration::from_seconds`), commented-out bag-based tests, and a monolithic `RosFilter` implementation that mixes configuration, callbacks, and filter logic. Issue templates explicitly state that the package will soon be deprecated and feature requests will not be addressed, indicating transition to a maintenance-only state.
The LLM identified 3 files worth highlighting for reuse:
Abstract base class for nonlinear state estimation (EKF/UKF). Provides pure virtual methods `predict()` and `correct()`, plus concrete implementations for Mahalanobis distance outlier rejection, angle wrapping, control term injection, and state covariance management. Contains no ROS dependencies, making it directly reusable in non-ROS projects. The design cleanly separates filter mathematics from sensor I/O.
Header-only utility for converting between latitude/longitude and UTM coordinates (UTM zone, easting, northing) and between ECEF (Earth-Centered Earth-Fixed) and ENU (East-North-Up) local frames. Implements standard geodetic formulas with WGS-84 ellipsoid. Self-contained, requires only <cmath> and <angles>, and is easily extractable for any robotics project needing GPS coordinate transformations.
Provides on-demand state estimation by interpolating/extrapolating from a circular buffer of historical filter states. Allows querying the estimated pose at any arbitrary timestamp, not just the latest filter update. The `RosRobotLocalizationListener` wraps this class with TF-aware state retrieval. The algorithm is generic and could be reused for any time-series state estimation (e.g., path smoothing, motion replay).