  Two core competencies of a mobile robot are to build a map of the environment
and to estimate its own pose on the basis of this map and incoming sensor
readings. To account for the uncertainties in this process, one typically
employs probabilistic state estimation approaches combined with a model of the
specific sensor. Over the past years, lidar sensors have become a popular
choice for mapping and localization. However, many common lidar models perform
poorly in unstructured, unpredictable environments, they lack a consistent
physical model for both mapping and localization, and they do not exploit all
the information the sensor provides, e.g. out-of-range measurements. In this
paper, we introduce a consistent physical model that can be applied to mapping
as well as to localization. It naturally deals with unstructured environments
and makes use of both out-of-range measurements and information about the ray
path. The approach can be seen as a generalization of the well-established
reflection model, but in addition to counting ray reflections and traversals in
a specific map cell, it considers the distances that all rays travel inside
this cell. We prove that the resulting map maximizes the data likelihood and
demonstrate that our model outperforms state-of-the-art sensor models in
extensive real-world experiments.
