  The operational environments in which a mobile robot executes its missions
often exhibit non-flat terrain characteristics, encompassing outdoor and indoor
settings featuring ramps and slopes. In such scenarios, the conventional
methodologies employed for localization encounter novel challenges and
limitations. This study delineates a localization framework incorporating
ground elevation and incline considerations, deviating from traditional 2D
localization paradigms that may falter in such contexts. In our proposed
approach, the map encompasses elevation and spatial occupancy information,
employing Gridmaps and Octomaps. At the same time, the perception model is
designed to accommodate the robot's inclined orientation and the potential
presence of ground as an obstacle, besides usual structural and dynamic
obstacles. We provide an implementation of our approach fully working with
Nav2, ready to replace the baseline AMCL approach when the robot is in
non-planar environments. Our methodology was rigorously tested in both
simulated environments and through practical application on actual robots,
including the Tiago and Summit XL models, across various settings ranging from
indoor and outdoor to flat and uneven terrains. Demonstrating exceptional
precision, our approach yielded error margins below 10 centimeters and 0.05
radians in indoor settings and less than 1.0 meters in extensive outdoor
routes. While our results exhibit a slight improvement over AMCL in indoor
environments, the enhancement in performance is significantly more pronounced
when compared to 3D SLAM algorithms. This underscores the considerable
robustness and efficiency of our approach, positioning it as an effective
strategy for mobile robots tasked with navigating expansive and intricate
indoor/outdoor environments.
